2 static const char _afb_description_v2_low_can[] =
3 "{\"openapi\":\"3.0.0\",\"$schema\":\"http:iot.bzh/download/openapi/schem"
4 "a-3.0/default-schema.json\",\"info\":{\"description\":\"\",\"title\":\"l"
5 "ow-level-can-service\",\"version\":\"4.0\",\"x-binding-c-generator\":{\""
6 "api\":\"low-can\",\"version\":2,\"prefix\":\"\",\"postfix\":\"\",\"start"
7 "\":null,\"onevent\":null,\"init\":\"initv2\",\"scope\":\"\",\"private\":"
8 "false}},\"servers\":[{\"url\":\"ws://{host}:{port}/api/monitor\",\"descr"
9 "iption\":\"Low level CAN API.\",\"variables\":{\"host\":{\"default\":\"l"
10 "ocalhost\"},\"port\":{\"default\":\"1234\"}},\"x-afb-events\":[{\"$ref\""
11 ":\"#/components/schemas/afb-event\"}]}],\"components\":{\"schemas\":{\"a"
12 "fb-reply\":{\"$ref\":\"#/components/schemas/afb-reply-v2\"},\"afb-event\""
13 ":{\"$ref\":\"#/components/schemas/afb-event-v2\"},\"afb-reply-v2\":{\"ti"
14 "tle\":\"Generic response.\",\"type\":\"object\",\"required\":[\"jtype\","
15 "\"request\"],\"properties\":{\"jtype\":{\"type\":\"string\",\"const\":\""
16 "afb-reply\"},\"request\":{\"type\":\"object\",\"required\":[\"status\"],"
17 "\"properties\":{\"status\":{\"type\":\"string\"},\"info\":{\"type\":\"st"
18 "ring\"},\"token\":{\"type\":\"string\"},\"uuid\":{\"type\":\"string\"},\""
19 "reqid\":{\"type\":\"string\"}}},\"response\":{\"type\":\"object\"}}},\"a"
20 "fb-event-v2\":{\"type\":\"object\",\"required\":[\"jtype\",\"event\"],\""
21 "properties\":{\"jtype\":{\"type\":\"string\",\"const\":\"afb-event\"},\""
22 "event\":{\"type\":\"string\"},\"data\":{\"type\":\"object\"}}}},\"x-perm"
23 "issions\":{\"monitor\":{\"permission\":\"urn:AGL:permission:low-can:publ"
24 "ic:monitor\"},\"write\":{\"permission\":\"urn:AGL:permission:low-can:pla"
25 "tform:write\"}},\"responses\":{\"200\":{\"description\":\"A complex obje"
26 "ct array response\",\"content\":{\"application/json\":{\"schema\":{\"$re"
27 "f\":\"#/components/schemas/afb-reply\"}}}}}},\"paths\":{\"/subscribe\":{"
28 "\"description\":\"Subscribe to CAN signals events\",\"parameters\":[{\"i"
29 "n\":\"query\",\"name\":\"event\",\"required\":false,\"schema\":{\"type\""
30 ":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/responses"
31 "/200\"}}},\"/unsubscribe\":{\"description\":\"Unsubscribe previously sus"
32 "cribed signals.\",\"parameters\":[{\"in\":\"query\",\"name\":\"event\",\""
33 "required\":false,\"schema\":{\"type\":\"string\"}}],\"responses\":{\"200"
34 "\":{\"$ref\":\"#/components/responses/200\"}}},\"/get\":{\"description\""
35 ":\"get a current value of CAN message\",\"parameters\":[{\"in\":\"query\""
36 ",\"name\":\"event\",\"required\":false,\"schema\":{\"type\":\"string\"}}"
37 "],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}},\"/"
38 "list\":{\"description\":\"get a supported CAN message list\",\"responses"
39 "\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}},\"/auth\":{\"des"
40 "cription\":\"Authenticate session to be raise Level Of Assurance.\",\"ge"
41 "t\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/write\"},\""
42 "responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}},\"/wri"
43 "te\":{\"description\":\"Write a CAN messages to the CAN bus.\",\"get\":{"
44 "\"x-permissions\":{\"LOA\":1},\"parameters\":[{\"in\":\"query\",\"name\""
45 ":\"bus_name\",\"required\":false,\"schema\":{\"type\":\"string\"}},{\"in"
46 "\":\"query\",\"name\":\"frame\",\"required\":false,\"schema\":{\"type\":"
47 "\"array\"},\"parameters\":[{\"in\":\"query\",\"name\":\"can_id\",\"requi"
48 "red\":false,\"schema\":{\"type\":\"string\"}},{\"in\":\"query\",\"name\""
49 ":\"can_dlc\",\"required\":false,\"schema\":{\"type\":\"string\"}},{\"in\""
50 ":\"query\",\"name\":\"can_data\",\"required\":false,\"schema\":{\"type\""
51 ":\"string\"}}]},{\"in\":\"query\",\"name\":\"signal_name\",\"required\":"
52 "false,\"schema\":{\"type\":\"string\"}},{\"in\":\"query\",\"name\":\"sig"
53 "nal_value\",\"required\":false,\"schema\":{\"type\":\"integer\"}}],\"res"
54 "ponses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}}}}"
57 #include <afb/afb-binding>
59 /*static const struct afb_auth _afb_auths_v2_low_can[] = {
60 { .type = afb_auth_Permission, .text = "urn:AGL:permission::platform:can:write", .next = NULL}
63 const struct afb_auth _afb_auths_v2_low_can[] = {afb::auth_permission("urn:AGL:permission::platform:can:write")};
65 void subscribe(struct afb_req req);
66 void unsubscribe(struct afb_req req);
67 void get(struct afb_req req);
68 void list(struct afb_req req);
69 void auth(struct afb_req req);
70 void write(struct afb_req req);
72 static const struct afb_verb_v2 _afb_verbs_v2_low_can[] = {
75 .callback = subscribe,
77 .info = "Subscribe to CAN signals events",
78 .session = AFB_SESSION_NONE_V2
81 .verb = "unsubscribe",
82 .callback = unsubscribe,
84 .info = "Unsubscribe previously suscribed signals.",
85 .session = AFB_SESSION_NONE_V2
91 .info = "get a current value of CAN message",
92 .session = AFB_SESSION_NONE_V2
98 .info = "get a supported CAN message list",
99 .session = AFB_SESSION_NONE_V2
104 .auth = &_afb_auths_v2_low_can[0],
105 .info = "Authenticate session to be raise Level Of Assurance.",
106 .session = AFB_SESSION_NONE_V2
112 .info = "Write a CAN messages to the CAN bus.",
113 .session = AFB_SESSION_LOA_1_V2
124 const struct afb_binding_v2 afbBindingV2 = {
126 .specification = _afb_description_v2_low_can,
128 .verbs = _afb_verbs_v2_low_can,