2 static const char _afb_description_v2_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/monitor\"},\"parameters\":[{\""
53 "in\":\"query\",\"name\":\"node\",\"required\":true,\"schema\":{\"type\":"
54 "\"integer\",\"format\":\"int32\"}},{\"in\":\"query\",\"name\":\"msgid\","
55 "\"required\":true,\"schema\":{\"type\":\"integer\",\"format\":\"int32\"}"
56 "},{\"in\":\"query\",\"name\":\"data\",\"required\":true,\"schema\":{\"ty"
57 "pe\":\"array\",\"format\":\"int32\"},\"style\":\"simple\"}],\"responses\""
58 ":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}},\"/sendmessageb64"
59 "\":{\"description\":\"Transmits a control message to a node.\",\"get\":{"
60 "\"x-permissions\":{\"$ref\":\"#/components/x-permissions/controller\"},\""
61 "parameters\":[{\"in\":\"query\",\"name\":\"node\",\"required\":true,\"sc"
62 "hema\":{\"type\":\"integer\",\"format\":\"int32\"}},{\"in\":\"query\",\""
63 "name\":\"msgid\",\"required\":true,\"schema\":{\"type\":\"integer\",\"fo"
64 "rmat\":\"int32\"}},{\"in\":\"query\",\"name\":\"data\",\"required\":fals"
65 "e,\"schema\":{\"type\":\"string\",\"format\":\"byte\"},\"style\":\"simpl"
66 "e\"}],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}"
70 static const struct afb_auth _afb_auths_v2_UNICENS[] = {
71 { .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:initialise" },
72 { .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:monitor" },
73 { .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:controller" }
76 void ucs2_listconfig(struct afb_req req);
77 void ucs2_initialise(struct afb_req req);
78 void ucs2_subscribe(struct afb_req req);
79 void ucs2_subscriberx(struct afb_req req);
80 void ucs2_writei2c(struct afb_req req);
81 void ucs2_sendmessage(struct afb_req req);
82 void ucs2_sendmessageb64(struct afb_req req);
84 static const struct afb_verb_v2 _afb_verbs_v2_UNICENS[] = {
87 .callback = ucs2_listconfig,
88 .auth = &_afb_auths_v2_UNICENS[0],
89 .info = "List Config Files",
90 .session = AFB_SESSION_NONE_V2
94 .callback = ucs2_initialise,
95 .auth = &_afb_auths_v2_UNICENS[0],
96 .info = "configure Unicens2 lib from NetworkConfig.XML.",
97 .session = AFB_SESSION_NONE_V2
101 .callback = ucs2_subscribe,
102 .auth = &_afb_auths_v2_UNICENS[1],
103 .info = "Subscribe to network events.",
104 .session = AFB_SESSION_NONE_V2
107 .verb = "subscriberx",
108 .callback = ucs2_subscriberx,
109 .auth = &_afb_auths_v2_UNICENS[1],
110 .info = "Subscribe to Rx control message events.",
111 .session = AFB_SESSION_NONE_V2
115 .callback = ucs2_writei2c,
116 .auth = &_afb_auths_v2_UNICENS[1],
117 .info = "Writes I2C command to remote node.",
118 .session = AFB_SESSION_NONE_V2
121 .verb = "sendmessage",
122 .callback = ucs2_sendmessage,
123 .auth = &_afb_auths_v2_UNICENS[1],
124 .info = "Transmits a control message to a node.",
125 .session = AFB_SESSION_NONE_V2
128 .verb = "sendmessageb64",
129 .callback = ucs2_sendmessageb64,
130 .auth = &_afb_auths_v2_UNICENS[2],
131 .info = "Transmits a control message to a node.",
132 .session = AFB_SESSION_NONE_V2
143 const struct afb_binding_v2 afbBindingV2 = {
145 .specification = _afb_description_v2_UNICENS,
147 .verbs = _afb_verbs_v2_UNICENS,
149 .init = ucs2_initbinding,