go-waku/library/signals.c

24 lines
610 B
C
Raw Normal View History

2022-03-21 23:15:53 +00:00
// ======================================================================================
// cgo compilation (for desktop platforms and local tests)
// ======================================================================================
#include <stdio.h>
#include <stddef.h>
#include <stdbool.h>
#include "_cgo_export.h"
2023-08-10 13:30:38 +00:00
typedef void (*callback)(const char *jsonEvent, size_t len_0);
2022-03-21 23:15:53 +00:00
callback gCallback = 0;
2023-08-10 13:30:38 +00:00
bool ServiceSignalEvent(const char *jsonEvent, size_t len_0) {
2022-03-21 23:15:53 +00:00
if (gCallback) {
2023-08-10 13:30:38 +00:00
gCallback(jsonEvent, len_0);
2022-03-21 23:15:53 +00:00
}
return true;
}
void SetEventCallback(void *cb) {
gCallback = (callback)cb;
}