aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2017-08-24 10:27:04 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-13 15:02:24 +0100
commit95f819a0a60f7c11aab87503320bf0e2eb8d513f (patch)
treeaec480b2061ece6f4fdf6170b2fa34830b39b59f
parent9e4777ac18066647828f280b608f9b07d8267ed0 (diff)
Clean up module naming
-rw-r--r--afb-source/CMakeLists.txt49
-rw-r--r--afb-source/ctl-apidef.h118
-rw-r--r--nbproject/configurations.xml100
3 files changed, 178 insertions, 89 deletions
diff --git a/afb-source/CMakeLists.txt b/afb-source/CMakeLists.txt
new file mode 100644
index 0000000..40469dc
--- /dev/null
+++ b/afb-source/CMakeLists.txt
@@ -0,0 +1,49 @@
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: Fulup Ar Foll <fulup@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+# Include LUA only when requested
+if(CONTROL_SUPPORT_LUA)
+ message(STATUS "Notice: LUA Controler Support Selected")
+ set(CTL_LUA_SOURCE ctl-lua.c)
+ ADD_COMPILE_OPTIONS(-DCONTROL_SUPPORT_LUA)
+ ADD_COMPILE_OPTIONS(-DCONTROL_LUA_EVENT="luaevt")
+ ADD_COMPILE_OPTIONS(-DCONTROL_LUA_PATH="${CMAKE_SOURCE_DIR}/conf.d/project/lua.d:${CMAKE_INSTALL_PREFIX}/controller-plugins/ctl-lua.d")
+else(CONTROL_SUPPORT_LUA)
+ message(STATUS "Warning: LUA Without Support ")
+endif(CONTROL_SUPPORT_LUA)
+
+# Add target to project dependency list
+PROJECT_TARGET_ADD(controller)
+
+ # Define project Targets
+ ADD_LIBRARY(${TARGET_NAME} MODULE ctl-binding.c ctl-timer.c ctl-dispatch.c ${CTL_LUA_SOURCE})
+
+ SET_OPENAPI_FILENAME("ctl-apidef")
+ # Binder exposes a unique public entry point
+ SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
+ PREFIX "afb-"
+ LABELS "BINDINGV2"
+ LINK_FLAGS ${BINDINGS_LINK_FLAG}
+ OUTPUT_NAME ${TARGET_NAME}
+ )
+
+ TARGET_LINK_LIBRARIES(${TARGET_NAME}
+ afb-utilities
+ ${link_libraries}
+ )
+
diff --git a/afb-source/ctl-apidef.h b/afb-source/ctl-apidef.h
new file mode 100644
index 0000000..5738f64
--- /dev/null
+++ b/afb-source/ctl-apidef.h
@@ -0,0 +1,118 @@
+
+static const char _afb_description_v2_aaaa[] =
+ "{\"openapi\":\"3.0.0\",\"$schema\":\"http:iot.bzh/download/openapi/schem"
+ "a-3.0/default-schema.json\",\"info\":{\"description\":\"\",\"title\":\"c"
+ "ontroler\",\"version\":\"1.0\",\"x-binding-c-generator\":{\"api\":\"aaaa"
+ "\",\"version\":2,\"prefix\":\"ctlapi_\",\"postfix\":\"\",\"start\":null,"
+ "\"onevent\":\"DispatchOneEvent\",\"init\":\"CtlBindingInit\",\"scope\":\""
+ "\",\"private\":false}},\"servers\":[{\"url\":\"ws://{host}:{port}/api/po"
+ "lctl\",\"description\":\"Unicens2 API.\",\"variables\":{\"host\":{\"defa"
+ "ult\":\"localhost\"},\"port\":{\"default\":\"1234\"}},\"x-afb-events\":["
+ "{\"$ref\":\"#/components/schemas/afb-event\"}]}],\"components\":{\"schem"
+ "as\":{\"afb-reply\":{\"$ref\":\"#/components/schemas/afb-reply-v2\"},\"a"
+ "fb-event\":{\"$ref\":\"#/components/schemas/afb-event-v2\"},\"afb-reply-"
+ "v2\":{\"title\":\"Generic response.\",\"type\":\"object\",\"required\":["
+ "\"jtype\",\"request\"],\"properties\":{\"jtype\":{\"type\":\"string\",\""
+ "const\":\"afb-reply\"},\"request\":{\"type\":\"object\",\"required\":[\""
+ "status\"],\"properties\":{\"status\":{\"type\":\"string\"},\"info\":{\"t"
+ "ype\":\"string\"},\"token\":{\"type\":\"string\"},\"uuid\":{\"type\":\"s"
+ "tring\"},\"reqid\":{\"type\":\"string\"}}},\"response\":{\"type\":\"obje"
+ "ct\"}}},\"afb-event-v2\":{\"type\":\"object\",\"required\":[\"jtype\",\""
+ "event\"],\"properties\":{\"jtype\":{\"type\":\"string\",\"const\":\"afb-"
+ "event\"},\"event\":{\"type\":\"string\"},\"data\":{\"type\":\"object\"}}"
+ "}},\"x-permissions\":{\"control\":{\"permission\":\"urn:AGL:permission:a"
+ "udio:public:control\"},\"dispatch\":{\"permission\":\"urn:AGL:permission"
+ ":audio:public:dispatch\"},\"request\":{\"permission\":\"urn:AGL:permissi"
+ "on:audio:public:request\"},\"debug\":{\"permission\":\"urn:AGL:permissio"
+ "n:audio:public:debug\"}},\"responses\":{\"200\":{\"description\":\"A com"
+ "plex object array response\",\"content\":{\"application/json\":{\"schema"
+ "\":{\"$ref\":\"#/components/schemas/afb-reply\"}}}}}},\"paths\":{\"/ping"
+ "\":{\"description\":\"Ping Binding\",\"get\":{\"x-permissions\":{\"$ref\""
+ ":\"#/components/x-permissions/control\"},\"parameters\":[{\"in\":\"query"
+ "\",\"name\":\"args\",\"required\":false,\"schema\":{\"type\":\"json\"}}]"
+ ",\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}},\"/"
+ "subscribe\":{\"description\":\"Subcribe Audio Agent Policy Control End\""
+ ",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/contr"
+ "ol\"},\"parameters\":[{\"in\":\"query\",\"name\":\"event_patern\",\"requ"
+ "ired\":true,\"schema\":{\"type\":\"string\"}}],\"responses\":{\"200\":{\""
+ "$ref\":\"#/components/responses/200\"}}}},\"/dispatch\":{\"description\""
+ ":\"Request Access to Navigation Audio Channel.\",\"get\":{\"x-permission"
+ "s\":{\"$ref\":\"#/components/x-permissions/dispatch\"},\"parameters\":[{"
+ "\"in\":\"query\",\"name\":\"zone\",\"required\":false,\"schema\":{\"type"
+ "\":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/respons"
+ "es/200\"}}}},\"/request\":{\"description\":\"Execute LUA string script.\""
+ ",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/reque"
+ "st\"},\"parameters\":[{\"in\":\"query\",\"name\":\"func\",\"required\":t"
+ "rue,\"schema\":{\"type\":\"string\"}},{\"in\":\"query\",\"name\":\"args\""
+ ",\"required\":false,\"schema\":{\"type\":\"array\"}}],\"responses\":{\"2"
+ "00\":{\"$ref\":\"#/components/responses/200\"}}}},\"/debuglua\":{\"descr"
+ "iption\":\"Execute LUA string script.\",\"get\":{\"x-permissions\":{\"$r"
+ "ef\":\"#/components/x-permissions/debug\"},\"parameters\":[{\"in\":\"que"
+ "ry\",\"name\":\"filename\",\"required\":true,\"schema\":{\"type\":\"stri"
+ "ng\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}"
+ "}}}}}"
+;
+
+static const struct afb_auth _afb_auths_v2_aaaa[] = {
+ { .type = afb_auth_Permission, .text = "urn:AGL:permission:audio:public:control" },
+ { .type = afb_auth_Permission, .text = "urn:AGL:permission:audio:public:dispatch" },
+ { .type = afb_auth_Permission, .text = "urn:AGL:permission:audio:public:request" },
+ { .type = afb_auth_Permission, .text = "urn:AGL:permission:audio:public:debug" }
+};
+
+ void ctlapi_ping(struct afb_req req);
+ void ctlapi_subscribe(struct afb_req req);
+ void ctlapi_dispatch(struct afb_req req);
+ void ctlapi_request(struct afb_req req);
+ void ctlapi_debuglua(struct afb_req req);
+
+static const struct afb_verb_v2 _afb_verbs_v2_aaaa[] = {
+ {
+ .verb = "ping",
+ .callback = ctlapi_ping,
+ .auth = &_afb_auths_v2_aaaa[0],
+ .info = NULL,
+ .session = AFB_SESSION_NONE_V2
+ },
+ {
+ .verb = "subscribe",
+ .callback = ctlapi_subscribe,
+ .auth = &_afb_auths_v2_aaaa[0],
+ .info = NULL,
+ .session = AFB_SESSION_NONE_V2
+ },
+ {
+ .verb = "dispatch",
+ .callback = ctlapi_dispatch,
+ .auth = &_afb_auths_v2_aaaa[1],
+ .info = NULL,
+ .session = AFB_SESSION_NONE_V2
+ },
+ {
+ .verb = "request",
+ .callback = ctlapi_request,
+ .auth = &_afb_auths_v2_aaaa[2],
+ .info = NULL,
+ .session = AFB_SESSION_NONE_V2
+ },
+ {
+ .verb = "debuglua",
+ .callback = ctlapi_debuglua,
+ .auth = &_afb_auths_v2_aaaa[3],
+ .info = NULL,
+ .session = AFB_SESSION_NONE_V2
+ },
+ { .verb = NULL }
+};
+
+const struct afb_binding_v2 afbBindingV2 = {
+ .api = "aaaa",
+ .specification = _afb_description_v2_aaaa,
+ .info = NULL,
+ .verbs = _afb_verbs_v2_aaaa,
+ .preinit = NULL,
+ .init = CtlBindingInit,
+ .onevent = DispatchOneEvent,
+ .noconcurrency = 0
+};
+
diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml
index a3d914b..71d6f6a 100644
--- a/nbproject/configurations.xml
+++ b/nbproject/configurations.xml
@@ -30,12 +30,6 @@
<in>feature_tests.cxx</in>
</df>
</df>
- <df name="ctl-binding">
- <in>ctl-binding.c</in>
- <in>ctl-dispatch.c</in>
- <in>ctl-lua.c</in>
- <in>ctl-timer.c</in>
- </df>
<df name="ctl-plugin">
<in>ctl-plugin-sample.c</in>
</df>
@@ -83,6 +77,7 @@
<preBuild>
<preBuildCommandWorkingDir>build</preBuildCommandWorkingDir>
<preBuildCommand>cmake ..</preBuildCommand>
+ <preBuildFirst>true</preBuildFirst>
</preBuild>
</makefileType>
<item path="afb-source/ctl-binding.c" ex="false" tool="0" flavor2="3">
@@ -96,7 +91,7 @@
<pElem>build/afb-source</pElem>
</incDir>
<preprocessorList>
- <Elem>CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/afb-controller/conf.d/project/json.d:/home/fulup/opt/afb-controller/json.d"</Elem>
+ <Elem>CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/afb-controller/conf.d/project/json.d:/home/fulup/opt/Controller-binding/json.d"</Elem>
<Elem>CONTROL_CONFIG_POST="control"</Elem>
<Elem>CONTROL_CONFIG_PRE="onload"</Elem>
<Elem>CONTROL_DOSCRIPT_PRE="doscript"</Elem>
@@ -104,11 +99,11 @@
<Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/afb-controller/conf.d/project/lua.d:/home/fulup/opt/controller-plugins/ctl-lua.d"</Elem>
<Elem>CONTROL_MAXPATH_LEN=255</Elem>
<Elem>CONTROL_ONLOAD_PROFILE="onload-default"</Elem>
- <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/AGL-AppFW/afb-controller/build:/home/fulup/opt/afb-controller/lib/controller-plugins:/usr/lib/afb/controller-plugins/ctlplug"</Elem>
+ <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/AGL-AppFW/afb-controller/build:/home/fulup/opt/Controller-binding/lib/controller-plugins:/usr/lib/afb/controller-plugins/ctlplug"</Elem>
<Elem>CONTROL_SUPPORT_LUA</Elem>
<Elem>CTL_PLUGIN_MAGIC=2468013579</Elem>
<Elem>NATIVE_LINUX</Elem>
- <Elem>controller_EXPORTS</Elem>
+ <Elem>control_afb_EXPORTS</Elem>
</preprocessorList>
</cTool>
</item>
@@ -181,26 +176,13 @@
</cTool>
</item>
<item path="afb-utilities/filescan-utils.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <cTool flags="1">
<incDir>
- <pElem>/usr/include/json-c</pElem>
- <pElem>../../../opt/include</pElem>
- <pElem>/usr/include/p11-kit-1</pElem>
- <pElem>/usr/include/lua5.3</pElem>
+ <pElem>../../../opt/include/afb</pElem>
<pElem>afb-utilities</pElem>
+ <pElem>/usr/include/json-c</pElem>
<pElem>build/afb-utilities</pElem>
</incDir>
- <preprocessorList>
- <Elem>CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/afb-controller/conf.d/project/json.d:/home/fulup/opt/afb-controller/json.d"</Elem>
- <Elem>CONTROL_CONFIG_POST="control"</Elem>
- <Elem>CONTROL_CONFIG_PRE="onload"</Elem>
- <Elem>CONTROL_DOSCRIPT_PRE="doscript"</Elem>
- <Elem>CONTROL_MAXPATH_LEN=255</Elem>
- <Elem>CONTROL_ONLOAD_PROFILE="onload-default"</Elem>
- <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/AGL-AppFW/afb-controller/build:/home/fulup/opt/afb-controller/lib/controller-plugins:/usr/lib/afb/controller-plugins/ctlplug"</Elem>
- <Elem>CTL_PLUGIN_MAGIC=2468013579</Elem>
- <Elem>NATIVE_LINUX</Elem>
- </preprocessorList>
</cTool>
</item>
<item path="afb-utilities/wrap-json.c" ex="false" tool="0" flavor2="3">
@@ -226,24 +208,8 @@
</item>
<item path="build/CMakeFiles/feature_tests.cxx" ex="false" tool="1" flavor2="4">
</item>
- <item path="ctl-binding/ctl-binding.c" ex="false" tool="0" flavor2="0">
- <cTool flags="0">
- </cTool>
- </item>
- <item path="ctl-binding/ctl-dispatch.c" ex="false" tool="0" flavor2="0">
- <cTool flags="0">
- </cTool>
- </item>
- <item path="ctl-binding/ctl-lua.c" ex="false" tool="0" flavor2="0">
- <cTool flags="0">
- </cTool>
- </item>
- <item path="ctl-binding/ctl-timer.c" ex="false" tool="0" flavor2="0">
- <cTool flags="0">
- </cTool>
- </item>
<item path="ctl-plugin/ctl-plugin-sample.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <cTool flags="1">
</cTool>
</item>
<folder path="0/build">
@@ -253,60 +219,16 @@
</incDir>
</cTool>
</folder>
- <folder path="0/ctl-binding">
- <cTool>
- <incDir>
- <pElem>/usr/include/json-c</pElem>
- <pElem>../../../opt/include</pElem>
- <pElem>/usr/include/p11-kit-1</pElem>
- <pElem>/usr/include/lua5.3</pElem>
- <pElem>ctl-binding</pElem>
- <pElem>afb-utilities</pElem>
- <pElem>build/ctl-binding</pElem>
- </incDir>
- <preprocessorList>
- <Elem>CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/afb-controller/conf.d/project/json.d:/home/fulup/opt/afb-controller/json.d"</Elem>
- <Elem>CONTROL_CONFIG_POST="control"</Elem>
- <Elem>CONTROL_CONFIG_PRE="onload"</Elem>
- <Elem>CONTROL_DOSCRIPT_PRE="doscript"</Elem>
- <Elem>CONTROL_LUA_EVENT="luaevt"</Elem>
- <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/afb-controller/conf.d/project/lua.d:/home/fulup/opt/controller-plugins/ctl-lua.d"</Elem>
- <Elem>CONTROL_MAXPATH_LEN=255</Elem>
- <Elem>CONTROL_ONLOAD_PROFILE="onload-default"</Elem>
- <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/AGL-AppFW/afb-controller/build:/home/fulup/opt/afb-controller/lib/controller-plugins:/usr/lib/afb/controller-plugins/ctlplug"</Elem>
- <Elem>CONTROL_SUPPORT_LUA</Elem>
- <Elem>CTL_PLUGIN_MAGIC=2468013579</Elem>
- <Elem>NATIVE_LINUX</Elem>
- <Elem>afb_controller_EXPORTS</Elem>
- </preprocessorList>
- </cTool>
- </folder>
<folder path="0/ctl-plugin">
<cTool>
<incDir>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>ctl-plugin</pElem>
<pElem>/usr/include/json-c</pElem>
- <pElem>../../../opt/include</pElem>
- <pElem>/usr/include/p11-kit-1</pElem>
<pElem>/usr/include/lua5.3</pElem>
- <pElem>ctl-binding</pElem>
- <pElem>afb-utilities</pElem>
+ <pElem>afb-source</pElem>
<pElem>build/ctl-plugin</pElem>
</incDir>
- <preprocessorList>
- <Elem>CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/afb-controller/conf.d/project/json.d:/home/fulup/opt/afb-controller/json.d"</Elem>
- <Elem>CONTROL_CONFIG_POST="control"</Elem>
- <Elem>CONTROL_CONFIG_PRE="onload"</Elem>
- <Elem>CONTROL_DOSCRIPT_PRE="doscript"</Elem>
- <Elem>CONTROL_LUA_EVENT="luaevt"</Elem>
- <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/afb-controller/conf.d/project/lua.d:/home/fulup/opt/controller-plugins/ctl-lua.d"</Elem>
- <Elem>CONTROL_MAXPATH_LEN=255</Elem>
- <Elem>CONTROL_ONLOAD_PROFILE="onload-default"</Elem>
- <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/AGL-AppFW/afb-controller/build:/home/fulup/opt/afb-controller/lib/controller-plugins:/usr/lib/afb/controller-plugins/ctlplug"</Elem>
- <Elem>CONTROL_SUPPORT_LUA</Elem>
- <Elem>CTL_PLUGIN_MAGIC=2468013579</Elem>
- <Elem>NATIVE_LINUX</Elem>
- <Elem>audio_plugin_sample_EXPORTS</Elem>
- </preprocessorList>
</cTool>
</folder>
</conf>