go-waku/library/signals.c

24 lines
613 B
C
Raw Normal View History

2022-03-21 19:15:53 -04:00
// ======================================================================================
// cgo compilation (for desktop platforms and local tests)
// ======================================================================================
#include <stdio.h>
#include <stddef.h>
#include <stdbool.h>
#include "_cgo_export.h"
2023-10-28 19:37:53 -04:00
typedef void (*callback)(int retCode, const char *jsonEvent, void* userData);
2022-03-21 19:15:53 -04:00
callback gCallback = 0;
2023-10-28 19:37:53 -04:00
bool ServiceSignalEvent(const char *jsonEvent) {
2022-03-21 19:15:53 -04:00
if (gCallback) {
2023-10-28 19:37:53 -04:00
gCallback(0, jsonEvent, NULL);
2022-03-21 19:15:53 -04:00
}
return true;
}
void SetEventCallback(void *cb) {
gCallback = (callback)cb;
}