summaryrefslogtreecommitdiffstats
path: root/ucs2-afb
diff options
context:
space:
mode:
authorWalt Miner <walt@linux.com>2018-06-08 12:05:51 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2018-06-08 12:05:51 +0000
commitb9b2ba9746e4725d30490f2acd3bcb0334d22130 (patch)
tree15bb61f7690fc90b87e601289c338ba4b5cd8bae /ucs2-afb
parent9e54da1917fc3958d49fa4d7c15c44643c84b75e (diff)
parent2c74cc419677a6470f537a2a374a3b31fee5da07 (diff)
Merge "agl-service-unicens: prepare control message transmission in b64 format" into eel
Diffstat (limited to 'ucs2-afb')
-rw-r--r--ucs2-afb/ucs_apidef.h81
-rw-r--r--ucs2-afb/ucs_apidef.json44
-rw-r--r--ucs2-afb/ucs_binding.c4
3 files changed, 98 insertions, 31 deletions
diff --git a/ucs2-afb/ucs_apidef.h b/ucs2-afb/ucs_apidef.h
index 2323599..6b8c23a 100644
--- a/ucs2-afb/ucs_apidef.h
+++ b/ucs2-afb/ucs_apidef.h
@@ -22,44 +22,55 @@ static const char _afb_description_v2_UNICENS[] =
"event\"},\"event\":{\"type\":\"string\"},\"data\":{\"type\":\"object\"}}"
"}},\"x-permissions\":{\"config\":{\"permission\":\"urn:AGL:permission:UN"
"ICENS:public:initialise\"},\"monitor\":{\"permission\":\"urn:AGL:permiss"
- "ion:UNICENS:public:monitor\"}},\"responses\":{\"200\":{\"description\":\""
- "A complex object array response\",\"content\":{\"application/json\":{\"s"
- "chema\":{\"$ref\":\"#/components/schemas/afb-reply\"}}}}}},\"paths\":{\""
- "/listconfig\":{\"description\":\"List Config Files\",\"get\":{\"x-permis"
- "sions\":{\"$ref\":\"#/components/x-permissions/config\"},\"parameters\":"
- "[{\"in\":\"query\",\"name\":\"cfgpath\",\"required\":false,\"schema\":{\""
- "type\":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/res"
- "ponses/200\"}}}},\"/initialise\":{\"description\":\"configure Unicens2 l"
- "ib from NetworkConfig.XML.\",\"get\":{\"x-permissions\":{\"$ref\":\"#/co"
- "mponents/x-permissions/config\"},\"parameters\":[{\"in\":\"query\",\"nam"
- "e\":\"filename\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\""
- "responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}},\"/sub"
- "scribe\":{\"description\":\"Subscribe to network events.\",\"get\":{\"x-"
- "permissions\":{\"$ref\":\"#/components/x-permissions/monitor\"},\"respon"
- "ses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}},\"/subscribe"
- "rx\":{\"description\":\"Subscribe to Rx control message events.\",\"get\""
- ":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/monitor\"},\""
- "responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}},\"/wri"
- "tei2c\":{\"description\":\"Writes I2C command to remote node.\",\"get\":"
- "{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/monitor\"},\"p"
- "arameters\":[{\"in\":\"query\",\"name\":\"node\",\"required\":true,\"sch"
- "ema\":{\"type\":\"integer\",\"format\":\"int32\"}},{\"in\":\"query\",\"n"
- "ame\":\"data\",\"required\":true,\"schema\":{\"type\":\"array\",\"format"
- "\":\"int32\"},\"style\":\"simple\"}],\"responses\":{\"200\":{\"$ref\":\""
- "#/components/responses/200\"}}}},\"/sendmessage\":{\"description\":\"Tra"
- "nsmits a control message to a node.\",\"get\":{\"x-permissions\":{\"$ref"
- "\":\"#/components/x-permissions/monitor\"},\"parameters\":[{\"in\":\"que"
- "ry\",\"name\":\"node\",\"required\":true,\"schema\":{\"type\":\"integer\""
- ",\"format\":\"int32\"}},{\"in\":\"query\",\"name\":\"msgid\",\"required\""
+ "ion:UNICENS:public:monitor\"},\"controller\":{\"permission\":\"urn:AGL:p"
+ "ermission:UNICENS:public:controller\"}},\"responses\":{\"200\":{\"descri"
+ "ption\":\"A complex object array response\",\"content\":{\"application/j"
+ "son\":{\"schema\":{\"$ref\":\"#/components/schemas/afb-reply\"}}}}}},\"p"
+ "aths\":{\"/listconfig\":{\"description\":\"List Config Files\",\"get\":{"
+ "\"x-permissions\":{\"$ref\":\"#/components/x-permissions/config\"},\"par"
+ "ameters\":[{\"in\":\"query\",\"name\":\"cfgpath\",\"required\":false,\"s"
+ "chema\":{\"type\":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/com"
+ "ponents/responses/200\"}}}},\"/initialise\":{\"description\":\"configure"
+ " Unicens2 lib from NetworkConfig.XML.\",\"get\":{\"x-permissions\":{\"$r"
+ "ef\":\"#/components/x-permissions/config\"},\"parameters\":[{\"in\":\"qu"
+ "ery\",\"name\":\"filename\",\"required\":true,\"schema\":{\"type\":\"str"
+ "ing\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\""
+ "}}}},\"/subscribe\":{\"description\":\"Subscribe to network events.\",\""
+ "get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/monitor\""
+ "},\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}},\""
+ "/subscriberx\":{\"description\":\"Subscribe to Rx control message events"
+ ".\",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/mo"
+ "nitor\"},\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\""
+ "}}}},\"/writei2c\":{\"description\":\"Writes I2C command to remote node."
+ "\",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/mon"
+ "itor\"},\"parameters\":[{\"in\":\"query\",\"name\":\"node\",\"required\""
":true,\"schema\":{\"type\":\"integer\",\"format\":\"int32\"}},{\"in\":\""
"query\",\"name\":\"data\",\"required\":true,\"schema\":{\"type\":\"array"
"\",\"format\":\"int32\"},\"style\":\"simple\"}],\"responses\":{\"200\":{"
- "\"$ref\":\"#/components/responses/200\"}}}}}}"
+ "\"$ref\":\"#/components/responses/200\"}}}},\"/sendmessage\":{\"descript"
+ "ion\":\"Transmits a control message to a node.\",\"get\":{\"x-permission"
+ "s\":{\"$ref\":\"#/components/x-permissions/monitor\"},\"parameters\":[{\""
+ "in\":\"query\",\"name\":\"node\",\"required\":true,\"schema\":{\"type\":"
+ "\"integer\",\"format\":\"int32\"}},{\"in\":\"query\",\"name\":\"msgid\","
+ "\"required\":true,\"schema\":{\"type\":\"integer\",\"format\":\"int32\"}"
+ "},{\"in\":\"query\",\"name\":\"data\",\"required\":true,\"schema\":{\"ty"
+ "pe\":\"array\",\"format\":\"int32\"},\"style\":\"simple\"}],\"responses\""
+ ":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}},\"/sendmessageb64"
+ "\":{\"description\":\"Transmits a control message to a node.\",\"get\":{"
+ "\"x-permissions\":{\"$ref\":\"#/components/x-permissions/controller\"},\""
+ "parameters\":[{\"in\":\"query\",\"name\":\"node\",\"required\":true,\"sc"
+ "hema\":{\"type\":\"integer\",\"format\":\"int32\"}},{\"in\":\"query\",\""
+ "name\":\"msgid\",\"required\":true,\"schema\":{\"type\":\"integer\",\"fo"
+ "rmat\":\"int32\"}},{\"in\":\"query\",\"name\":\"data\",\"required\":fals"
+ "e,\"schema\":{\"type\":\"string\",\"format\":\"byte\"},\"style\":\"simpl"
+ "e\"}],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}"
+ "}}}"
;
static const struct afb_auth _afb_auths_v2_UNICENS[] = {
{ .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:initialise" },
- { .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:monitor" }
+ { .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:monitor" },
+ { .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:controller" }
};
void ucs2_listconfig(struct afb_req req);
@@ -68,6 +79,7 @@ static const struct afb_auth _afb_auths_v2_UNICENS[] = {
void ucs2_subscriberx(struct afb_req req);
void ucs2_writei2c(struct afb_req req);
void ucs2_sendmessage(struct afb_req req);
+ void ucs2_sendmessageb64(struct afb_req req);
static const struct afb_verb_v2 _afb_verbs_v2_UNICENS[] = {
{
@@ -113,6 +125,13 @@ static const struct afb_verb_v2 _afb_verbs_v2_UNICENS[] = {
.session = AFB_SESSION_NONE_V2
},
{
+ .verb = "sendmessageb64",
+ .callback = ucs2_sendmessageb64,
+ .auth = &_afb_auths_v2_UNICENS[2],
+ .info = "Transmits a control message to a node.",
+ .session = AFB_SESSION_NONE_V2
+ },
+ {
.verb = NULL,
.callback = NULL,
.auth = NULL,
diff --git a/ucs2-afb/ucs_apidef.json b/ucs2-afb/ucs_apidef.json
index 954e275..623d58e 100644
--- a/ucs2-afb/ucs_apidef.json
+++ b/ucs2-afb/ucs_apidef.json
@@ -87,6 +87,9 @@
},
"monitor": {
"permission": "urn:AGL:permission:UNICENS:public:monitor"
+ },
+ "controller": {
+ "permission": "urn:AGL:permission:UNICENS:public:controller"
}
},
"responses": {
@@ -235,6 +238,47 @@
"200": {"$ref": "#/components/responses/200"}
}
}
+ },
+ "/sendmessageb64": {
+ "description": "Transmits a control message to a node.",
+ "get": {
+ "x-permissions": {
+ "$ref": "#/components/x-permissions/controller"
+ },
+ "parameters": [
+ {
+ "in": "query",
+ "name": "node",
+ "required": true,
+ "schema": {
+ "type": "integer",
+ "format": "int32"
+ }
+ },
+ {
+ "in": "query",
+ "name": "msgid",
+ "required": true,
+ "schema": {
+ "type": "integer",
+ "format": "int32"
+ }
+ },
+ {
+ "in": "query",
+ "name": "data",
+ "required": false,
+ "schema": {
+ "type": "string",
+ "format": "byte"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {"$ref": "#/components/responses/200"}
+ }
+ }
}
}
}
diff --git a/ucs2-afb/ucs_binding.c b/ucs2-afb/ucs_binding.c
index 49bedf4..ddf44b1 100644
--- a/ucs2-afb/ucs_binding.c
+++ b/ucs2-afb/ucs_binding.c
@@ -857,6 +857,10 @@ PUBLIC void ucs2_sendmessage(struct afb_req request) {
}
}
+PUBLIC void ucs2_sendmessageb64(struct afb_req req) {
+ afb_req_fail_f(req, "not-implemented", "Function not yet implemented.");
+}
+
PUBLIC int ucs2_initbinding(void) {
#ifndef DISABLE_AUTOSTART
char *filename = GetDefaultConfig();