Initial commit, derived from former development (2018-2020=

This commit is contained in:
2023-11-02 09:17:47 +01:00
parent e234ebcaf9
commit b2948546dc
7 changed files with 1380 additions and 3 deletions

33
snap7b.h Normal file
View File

@@ -0,0 +1,33 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "./snap7-full-1.4.2/release/Wrappers/c-cpp/snap7.h"
extern void logSnap7Server(char *);
#ifdef OS_WINDOWS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
const int EventCallBackLength = 1024;
S7Object Server;
void S7API EventCallBack(void *usrPtr, PSrvEvent PEvent, int Size)
{
// print the event
char *text;
text = (char *)malloc(EventCallBackLength);
Srv_EventText(PEvent, text, EventCallBackLength);
logSnap7Server(text);
free(text);
};
void _RegisterEventCallBack(S7Object Server)
{
Srv_SetEventsCallback(Server, EventCallBack, NULL);
}