2 static const char _afb_description_UNICENS[] =
3 "{\"openapi\":\"3.0.0\",\"$schema\":\"http:iot.bzh/download/openapi/schem"
4 "a-3.0/default-schema.json\",\"info\":{\"description\":\"\",\"title\":\"u"
5 "cs2\",\"version\":\"1.0\",\"x-binding-c-generator\":{\"api\":\"UNICENS\""
6 ",\"version\":2,\"prefix\":\"ucs2_\",\"postfix\":\"\",\"start\":null,\"on"
7 "event\":null,\"preinit\":null,\"init\":\"ucs2_initbinding\",\"scope\":\""
8 "\",\"private\":false}},\"servers\":[{\"url\":\"ws://{host}:{port}/api/mo"
9 "nitor\",\"description\":\"Unicens2 API.\",\"variables\":{\"host\":{\"def"
10 "ault\":\"localhost\"},\"port\":{\"default\":\"1234\"}},\"x-afb-events\":"
11 "[{\"$ref\":\"#/components/schemas/afb-event\"}]}],\"components\":{\"sche"
12 "mas\":{\"afb-reply\":{\"$ref\":\"#/components/schemas/afb-reply-v2\"},\""
13 "afb-event\":{\"$ref\":\"#/components/schemas/afb-event-v2\"},\"afb-reply"
14 "-v2\":{\"title\":\"Generic response.\",\"type\":\"object\",\"required\":"
15 "[\"jtype\",\"request\"],\"properties\":{\"jtype\":{\"type\":\"string\",\""
16 "const\":\"afb-reply\"},\"request\":{\"type\":\"object\",\"required\":[\""
17 "status\"],\"properties\":{\"status\":{\"type\":\"string\"},\"info\":{\"t"
18 "ype\":\"string\"},\"token\":{\"type\":\"string\"},\"uuid\":{\"type\":\"s"
19 "tring\"},\"reqid\":{\"type\":\"string\"}}},\"response\":{\"type\":\"obje"
20 "ct\"}}},\"afb-event-v2\":{\"type\":\"object\",\"required\":[\"jtype\",\""
21 "event\"],\"properties\":{\"jtype\":{\"type\":\"string\",\"const\":\"afb-"
22 "event\"},\"event\":{\"type\":\"string\"},\"data\":{\"type\":\"object\"}}"
23 "}},\"x-permissions\":{\"config\":{\"permission\":\"urn:AGL:permission:UN"
24 "ICENS:public:initialise\"},\"monitor\":{\"permission\":\"urn:AGL:permiss"
25 "ion:UNICENS:public:monitor\"},\"controller\":{\"permission\":\"urn:AGL:p"
26 "ermission:UNICENS:public:controller\"}},\"responses\":{\"200\":{\"descri"
27 "ption\":\"A complex object array response\",\"content\":{\"application/j"
28 "son\":{\"schema\":{\"$ref\":\"#/components/schemas/afb-reply\"}}}}}},\"p"
29 "aths\":{\"/listconfig\":{\"description\":\"List Config Files\",\"get\":{"
30 "\"x-permissions\":{\"$ref\":\"#/components/x-permissions/config\"},\"par"
31 "ameters\":[{\"in\":\"query\",\"name\":\"cfgpath\",\"required\":false,\"s"
32 "chema\":{\"type\":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/com"
33 "ponents/responses/200\"}}}},\"/initialise\":{\"description\":\"configure"
34 " Unicens2 lib from NetworkConfig.XML.\",\"get\":{\"x-permissions\":{\"$r"
35 "ef\":\"#/components/x-permissions/config\"},\"parameters\":[{\"in\":\"qu"
36 "ery\",\"name\":\"filename\",\"required\":true,\"schema\":{\"type\":\"str"
37 "ing\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\""
38 "}}}},\"/subscribe\":{\"description\":\"Subscribe to network events.\",\""
39 "get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/monitor\""
40 "},\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}},\""
41 "/subscriberx\":{\"description\":\"Subscribe to Rx control message events"
42 ".\",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/mo"
43 "nitor\"},\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\""
44 "}}}},\"/writei2c\":{\"description\":\"Writes I2C command to remote node."
45 "\",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/mon"
46 "itor\"},\"parameters\":[{\"in\":\"query\",\"name\":\"node\",\"required\""
47 ":true,\"schema\":{\"type\":\"integer\",\"format\":\"int32\"}},{\"in\":\""
48 "query\",\"name\":\"data\",\"required\":true,\"schema\":{\"type\":\"array"
49 "\",\"format\":\"int32\"},\"style\":\"simple\"}],\"responses\":{\"200\":{"
50 "\"$ref\":\"#/components/responses/200\"}}}},\"/sendmessage\":{\"descript"
51 "ion\":\"Transmits a control message to a node.\",\"get\":{\"x-permission"
52 "s\":{\"$ref\":\"#/components/x-permissions/controller\"},\"parameters\":"
53 "[{\"in\":\"query\",\"name\":\"node\",\"required\":true,\"schema\":{\"typ"
54 "e\":\"integer\",\"format\":\"int32\"}},{\"in\":\"query\",\"name\":\"msgi"
55 "d\",\"required\":true,\"schema\":{\"type\":\"integer\",\"format\":\"int3"
56 "2\"}},{\"in\":\"query\",\"name\":\"data\",\"required\":false,\"schema\":"
57 "{\"type\":\"string\",\"format\":\"byte\"},\"style\":\"simple\"}],\"respo"
58 "nses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}}}}"
61 static const struct afb_auth _afb_auths_UNICENS[] = {
62 { .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:initialise" },
63 { .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:monitor" },
64 { .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:controller" }
67 void ucs2_listconfig(afb_req req);
68 void ucs2_initialise(afb_req req);
69 void ucs2_subscribe(afb_req req);
70 void ucs2_subscriberx(afb_req req);
71 void ucs2_writei2c(afb_req req);
72 void ucs2_sendmessage(afb_req req);
74 static const struct afb_verb_v2 _afb_verbs_UNICENS[] = {
77 .callback = ucs2_listconfig,
78 .auth = &_afb_auths_UNICENS[0],
79 .info = "List Config Files",
80 .session = AFB_SESSION_NONE
84 .callback = ucs2_initialise,
85 .auth = &_afb_auths_UNICENS[0],
86 .info = "configure Unicens2 lib from NetworkConfig.XML.",
87 .session = AFB_SESSION_NONE
91 .callback = ucs2_subscribe,
92 .auth = &_afb_auths_UNICENS[1],
93 .info = "Subscribe to network events.",
94 .session = AFB_SESSION_NONE
97 .verb = "subscriberx",
98 .callback = ucs2_subscriberx,
99 .auth = &_afb_auths_UNICENS[1],
100 .info = "Subscribe to Rx control message events.",
101 .session = AFB_SESSION_NONE
105 .callback = ucs2_writei2c,
106 .auth = &_afb_auths_UNICENS[1],
107 .info = "Writes I2C command to remote node.",
108 .session = AFB_SESSION_NONE
111 .verb = "sendmessage",
112 .callback = ucs2_sendmessage,
113 .auth = &_afb_auths_UNICENS[2],
114 .info = "Transmits a control message to a node.",
115 .session = AFB_SESSION_NONE
126 const struct afb_binding_v2 afbBindingV2 = {
128 .specification = _afb_description_UNICENS,
130 .verbs = _afb_verbs_UNICENS,
132 .init = ucs2_initbinding,