aboutsummaryrefslogtreecommitdiffstats
path: root/high-can-binding/high-can-binding-hat.cpp
blob: 71dd3b7fc1dc85ec329b809ddb46039976cf5ade (plain)
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
#include "high-can-binding-hat.hpp"
#include <cstddef>
/// Interface between the daemon and the binding

static int init_service();

static const struct afb_verb_v2 verbs[]=
{
    { .verb= "subscribe",	.callback= subscribe,	.auth = NULL, .session = 0 },
    { .verb= "unsubscribe",	.callback= unsubscribe,	.auth = NULL, .session = 0 },
    { .verb= "get",	        .callback= get,	.auth = NULL, .session = 0 },
    { .verb= NULL, .callback=NULL, .auth = NULL, .session = 0 }
};

const struct afb_binding_v2 afbBindingV2 = {
    .api = "high-can",
    .specification = "",
    .verbs = verbs,
    .preinit = NULL,
    .init = init_service,
    .onevent = onEvent,
    .noconcurrency = 1
};

/// @brief Initialize the binding.
///
/// @return Exit code, zero if success.
int init_service()
{
    AFB_NOTICE("high level binding is initializing");
    afb_daemon_require_api("low-can", 1);
    initHigh();
    AFB_NOTICE("high level binding is initialized and running");
    return 0;
}