wrap7/snap7b.h

34 lines
689 B
C
Raw Normal View History

#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);
}