Initial commit, derived from former development (2018-2020=
This commit is contained in:
33
snap7b.h
Normal file
33
snap7b.h
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user