summaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-05-23 20:43:00 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:51:00 +0200
commit5fa641b973806749d85e73b7821ac8098d6607f6 (patch)
tree7aeb6b824302b19811f366f74d6a97a53f9f637b /4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c
parent6ff2903f7cff91d10d2261d5d5b931466ea04cad (diff)
Get Hal controller api structure fields properly
Because of a recent change in the app-controller, change the way that metadata was get. Avoid to parse json again and use only CtlConfigT strcuture fields to fill Hal controller api structure. Add a fields info in Hal controller api structure. Change-Id: I17ff00bfd6d0991bed47831a92bf81ddcf3fb4c9 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c
index 3401c93..18cf781 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c
@@ -68,10 +68,6 @@ static struct HalUtlApiVerb CtlHalDynApiStaticVerbs[] =
static int HalCtlsInitOneApi(afb_dynapi *apiHandle)
{
- int apiMetadataUnpackErr, apiHalmetadataUnpackErr;
-
- json_object *apiMetadata, *apiHalmetadata;
-
CtlConfigT *ctrlConfig;
struct SpecificHalData *currentCtlHalData;
@@ -94,27 +90,13 @@ static int HalCtlsInitOneApi(afb_dynapi *apiHandle)
currentCtlHalData->internal = true;
currentCtlHalData->status = HAL_STATUS_UNAVAILABLE;
- if(! json_object_object_get_ex(ctrlConfig->configJ, "metadata", &apiMetadata))
- return -4;
+ currentCtlHalData->name = (char *) ctrlConfig->api;
+ currentCtlHalData->sndCard = (char *) ctrlConfig->uid;
+ currentCtlHalData->info = (char *) ctrlConfig->info;
- if(! json_object_object_get_ex(ctrlConfig->configJ, "hal-metadata", &apiHalmetadata))
- return -5;
-
- apiMetadataUnpackErr = wrap_json_unpack(apiMetadata, "{s:s s?:s s?:s s?:o s?:o !}",
- "uid", NULL,
- "version", &currentCtlHalData->version,
- "api", &currentCtlHalData->name,
- "info", NULL,
- "require", NULL);
- if(apiMetadataUnpackErr)
- return -6;
-
- apiHalmetadataUnpackErr = wrap_json_unpack(apiHalmetadata, "{s:s s:s s:s !}",
- "sndcard", &currentCtlHalData->sndCard,
- "author", &currentCtlHalData->author,
- "date", &currentCtlHalData->date);
- if(apiHalmetadataUnpackErr)
- return -7;
+ currentCtlHalData->author = (char *) ctrlConfig->author;
+ currentCtlHalData->version = (char *) ctrlConfig->version;
+ currentCtlHalData->date = (char *) ctrlConfig->date;
currentCtlHalData->apiHandle = apiHandle;
currentCtlHalData->ctrlConfig = ctrlConfig;