aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-08-09 14:31:48 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-08-21 12:55:18 +0200
commit68c4abd337246eb03ffab9366764e565820494a3 (patch)
treee6afeccd866ac2f11ec738d21bd7e62afc3cc0d3
parent5fea6a5fec23527173df1901e4cdf4481223c1a0 (diff)
Migration to binding version 3
For compatibility between different binding versions Submodule app-controller-submodule e3f2c45...4386ec5: > Migration to v3 > Adds v3 function to get binding settings > New function returning the binding root directory > Change the default GLOB pattern > Fix wrong computed length > Add path to the installed widget path. > Controller: Converted README to a gitbook version. Submodule conf.d/app-templates 9c1a0fb..f0b24b0: > Rollback about TEST build type > Adding a TEST build type > Change default compilation options. > Test widget only if there are test materials > Handles more test LABELS. > Missing flag for COVERAGE build type > Create a test widget Change-Id: I4f96cc6773ec4da7eba96f243d6bf06170ef0cb0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
m---------app-controller-submodule0
m---------conf.d/app-templates0
-rw-r--r--conf.d/cmake/config.cmake2
-rw-r--r--src/aft.c28
-rw-r--r--src/mapis.c6
5 files changed, 18 insertions, 18 deletions
diff --git a/app-controller-submodule b/app-controller-submodule
-Subproject e3f2c45eb9c65560f269be9d2a1f4385142c457
+Subproject 4386ec54f811f19a14d0f60688321d4a1a69b78
diff --git a/conf.d/app-templates b/conf.d/app-templates
-Subproject 9c1a0fb10dda08bebffb490152b5cdde6420e18
+Subproject f0b24b0809e1677665760d4341a4169d519079b
diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake
index 02c1ac7..ea9227b 100644
--- a/conf.d/cmake/config.cmake
+++ b/conf.d/cmake/config.cmake
@@ -129,7 +129,7 @@ add_definitions(-DLUA_GLOB_PATTERN="/var/?.lua\\\;")
add_definitions(-DCONTROL_PLUGIN_PATH="./var:${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/lib/plugins:${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/var:${INSTALL_PREFIX}/${PROJECT_NAME}/lib/plugins:${INSTALL_PREFIX}/${PROJECT_NAME}/var:${CMAKE_BINARY_DIR}/package/lib/plugins:${CMAKE_BINARY_DIR}/package/var")
add_definitions(-DCONTROL_CONFIG_PATH="./etc:${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/etc:${INSTALL_PREFIX}/${PROJECT_NAME}/etc:${CMAKE_BINARY_DIR}/package/etc")
add_definitions(-DCTL_PLUGIN_MAGIC=1286576532)
-add_definitions(-DUSE_API_DYN=1 -DAFB_BINDING_VERSION=3 -DAFB_BINDING_WANT_DYNAPI)
+add_definitions(-DAFB_BINDING_VERSION=3)
# Optional location for config.xml.in
# -----------------------------------
diff --git a/src/aft.c b/src/aft.c
index ea5c209..2fad9fb 100644
--- a/src/aft.c
+++ b/src/aft.c
@@ -26,7 +26,7 @@
#define CONTROL_PREFIX "aft"
// default api to print log when apihandle not avaliable
-afb_api_t AFB_default;
+AFB_ApiT AFB_default;
static CtlConfigT *CtrlLoadConfigJson(AFB_ApiT apiHandle, json_object *configJ);
static CtlConfigT *CtrlLoadConfigFile(AFB_ApiT apiHandle, const char *configPath);
@@ -51,8 +51,8 @@ static void ctrlapi_ping(AFB_ReqT request) {
static void ctrlapi_load(AFB_ReqT request) {
const char *configPath = NULL;
- json_object *reqArgs = afb_req_json(request), *configuration = NULL ;
- afb_api_t apiHandle = afb_req_get_api(request);
+ json_object *reqArgs = AFB_ReqJson(request), *configuration = NULL ;
+ AFB_ApiT apiHandle = AFB_ReqGetApi(request);
if(!json_object_object_get_ex(reqArgs, "configuration", &configuration)) {
AFB_ReqFailF(request, "Error", "No 'configuration' key found in request arguments: %s", json_object_get_string(reqArgs));
@@ -93,11 +93,11 @@ static AFB_ApiVerbs CtrlApiVerbs[] = {
{.verb = NULL} /* marker for end of the array */
};
-static int CtrlLoadStaticVerbs(afb_api_t apiHandle, AFB_ApiVerbs *verbs) {
+static int CtrlLoadStaticVerbs(AFB_ApiT apiHandle, AFB_ApiVerbs *verbs) {
int errcount = 0;
for(int idx = 0; verbs[idx].verb; idx++) {
- errcount += afb_api_add_verb(
+ errcount += AFB_ApiAddVerb(
apiHandle, CtrlApiVerbs[idx].verb, NULL, CtrlApiVerbs[idx].callback,
(void *)&CtrlApiVerbs[idx], CtrlApiVerbs[idx].auth, 0, 0);
}
@@ -109,7 +109,7 @@ static int CtrlInitOneApi(AFB_ApiT apiHandle) {
// Hugely hack to make all V2 AFB_DEBUG to work in fileutils
AFB_default = apiHandle;
- CtlConfigT *ctrlConfig = afb_api_get_userdata(apiHandle);
+ CtlConfigT *ctrlConfig = AFB_ApiGetUserData(apiHandle);
return CtlConfigExec(apiHandle, ctrlConfig);
}
@@ -118,7 +118,7 @@ static int CtrlLoadOneApi(void *cbdata, AFB_ApiT apiHandle) {
CtlConfigT *ctrlConfig = (CtlConfigT *)cbdata;
// save closure as api's data context
- afb_api_set_userdata(apiHandle, ctrlConfig);
+ AFB_ApiSetUserData(apiHandle, ctrlConfig);
// add static controls verbs
int err = CtrlLoadStaticVerbs(apiHandle, CtrlApiVerbs);
@@ -131,12 +131,12 @@ static int CtrlLoadOneApi(void *cbdata, AFB_ApiT apiHandle) {
err = CtlLoadSections(apiHandle, ctrlConfig, ctrlSections);
// declare an event event manager for this API;
- afb_api_on_event(apiHandle, CtrlDispatchApiEvent);
+ AFB_ApiOnEvent(apiHandle, CtrlDispatchApiEvent);
// init API function (does not receive user closure ???
- afb_api_on_init(apiHandle, CtrlInitOneApi);
+ AFB_ApiOnInit(apiHandle, CtrlInitOneApi);
- afb_api_seal(apiHandle);
+ AFB_ApiSeal(apiHandle);
return err;
}
@@ -183,17 +183,17 @@ static int CtrlCreateApi(AFB_ApiT apiHandle, CtlConfigT *ctrlConfig) {
wrap_json_object_add(ctrlConfig->configJ, resourcesJ);
wrap_json_object_add(ctrlConfig->configJ, eventsJ);
- if(! afb_api_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, CtrlLoadOneApi, ctrlConfig))
+ if(! AFB_NewApi(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, CtrlLoadOneApi, ctrlConfig))
return ERROR;
return 0;
}
-int afbBindingEntry(afb_api_t apiHandle) {
+int afbBindingEntry(AFB_ApiT apiHandle) {
size_t len = 0, bindingRootDirLen = 0;
char *dirList, *afTestRootDir, *path;
const char *envDirList = NULL, *configPath = NULL, *bindingRootDir = NULL;
- json_object *settings = afb_api_settings(apiHandle), *bpath = NULL;
+ json_object *settings = AFB_GetApiSettings(apiHandle), *bpath = NULL;
AFB_default = apiHandle;
AFB_ApiDebug(apiHandle, "Controller in afbBindingEntry");
@@ -214,7 +214,7 @@ int afbBindingEntry(afb_api_t apiHandle) {
envDirList = getEnvDirList(CONTROL_PREFIX, "CONFIG_PATH");
- bindingRootDir = GetBindingDirPath();
+ bindingRootDir = GetBindingDirPath(apiHandle);
bindingRootDirLen = strlen(bindingRootDir);
if(envDirList) {
diff --git a/src/mapis.c b/src/mapis.c
index ba524a0..ba72857 100644
--- a/src/mapis.c
+++ b/src/mapis.c
@@ -32,7 +32,7 @@ static int LoadOneMapi(void *data, AFB_ApiT apiHandle) {
int savedCount = 0, count = 0, idx = 0;
CtlActionT *savedActions = NULL, *newActions = NULL;
struct mapisHandleT *mapisHandle = (struct mapisHandleT*)data;
- CtlConfigT *ctrlConfig = afb_api_get_userdata(mapisHandle->mainApiHandle);
+ CtlConfigT *ctrlConfig = AFB_ApiGetUserData(mapisHandle->mainApiHandle);
if(PluginConfig(apiHandle, mapisHandle->section, mapisHandle->mapiJ)) {
AFB_ApiError(apiHandle, "Problem loading the plugin as an API for %s, see log message above", json_object_get_string(mapisHandle->mapiJ));
@@ -85,7 +85,7 @@ static int LoadOneMapi(void *data, AFB_ApiT apiHandle) {
}
// declare an event event manager for this API;
- afb_api_on_event(apiHandle, CtrlDispatchApiEvent);
+ AFB_ApiOnEvent(apiHandle, CtrlDispatchApiEvent);
return 0;
}
@@ -114,7 +114,7 @@ static void OneMapiConfig(void *data, json_object *mapiJ) {
json_object_object_del(mapiJ, "events");
mapisHandle->mapiJ = mapiJ;
- if (!afb_api_new_api(mapisHandle->mainApiHandle, uid, info, 1, LoadOneMapi, (void*)mapisHandle))
+ if (!AFB_NewApi(mapisHandle->mainApiHandle, uid, info, 1, LoadOneMapi, (void*)mapisHandle))
AFB_ApiError(mapisHandle->mainApiHandle, "Error creating new api: %s", uid);
}
}