-
Notifications
You must be signed in to change notification settings - Fork 2
/
ubus.hpp
38 lines (35 loc) · 806 Bytes
/
ubus.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef NODE_UBUS_INCLUDED
#define NODE_UBUS_INCLUDED
#include <nan.h>
extern "C"
{
#include <libubus.h>
#include <json-c/json.h>
#include <libubox/blobmsg.h>
#include <libubox/blobmsg_json.h>
}
extern "C" {
struct ubus_event_handler_extended
{
ubus_event_handler event_handler;
void * data;
};
}
namespace node_ubus {
class UBus : public Nan::ObjectWrap {
public:
UBus();
static void Initialize(v8::Handle<v8::Object> target);
private:
struct ubus_context *ctx_;
struct ubus_event_handler_extended listener_;
uv_poll_t * poll_;
static NAN_METHOD(New);
static NAN_METHOD(Connect);
static NAN_METHOD(Send);
bool Connect(const char * type);
bool Send(const char * type, const char * json_string);
static void Callback(uv_poll_t *w, int status, int events);
};
}
#endif