summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-06-06 15:26:02 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-06-06 15:29:04 +0200
commit7bfe8ade59cb8500ba39939a5aa6f18e5c242cd1 (patch)
treec2a6d76d710d4cc577beca704d373d4b14aa2dbe
parent7b0f5cbc7e27204d334766a3a270352603805e12 (diff)
Add 'hal-dependencies' info in 'loaded' response
Add all 'hal-dependencies' compact json info in response of hal-manager 'loaded' verb call. BUG-AGL: SPEC-2329 Change-Id: I45a94c80be078236fbc581e62654f5261e1b281e Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
-rw-r--r--src/4a-hal-manager/4a-hal-manager-cb.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/4a-hal-manager/4a-hal-manager-cb.c b/src/4a-hal-manager/4a-hal-manager-cb.c
index dd55eeb..396bab2 100644
--- a/src/4a-hal-manager/4a-hal-manager-cb.c
+++ b/src/4a-hal-manager/4a-hal-manager-cb.c
@@ -73,7 +73,7 @@ void HalMgrLoaded(afb_req_t request)
struct HalMgrData *halMgrData;
struct HalData *currentHalData;
- json_object *requestJson, *requestAnswer, *apiRequestedInfoJ;
+ json_object *requestJson, *requestAnswer, *dependenciesJ, *apiRequestedInfoJ;
apiHandle = afb_req_get_api(request);
if(! apiHandle) {
@@ -116,8 +116,14 @@ void HalMgrLoaded(afb_req_t request)
else
snprintf(cardIdString, sizeof(cardIdString), "not-found");
+ dependenciesJ = HalUtlGetJsonArrayForAllDependencies(apiHandle,
+ &currentHalData->internalHalData->probedDevicesList,
+ DEPENDENCY_COMPACT_JSON);
+ if(! dependenciesJ)
+ AFB_REQ_WARNING(request, "Didn't succeed to generate all dependencies compact json array");
+
wrapRet = wrap_json_pack(&apiRequestedInfoJ,
- "{s:s s:i s:s s:i s:s s:s s:s s:s s:s s:s}",
+ "{s:s s:i s:s s:i s:s s:s s:s s:s s:s s:s s?:o}",
"api", currentHalData->apiName,
"status", (int) currentHalData->status,
"sndcard", currentHalData->sndCardPath,
@@ -127,7 +133,8 @@ void HalMgrLoaded(afb_req_t request)
"author", currentHalData->author ? currentHalData->author : "",
"version", currentHalData->version ? currentHalData->version : "",
"date", currentHalData->date ? currentHalData->date : "",
- "snd-dev-id", cardIdString);
+ "snd-dev-id", cardIdString,
+ "dependencies", dependenciesJ);
}
// Case if request is empty or not handled
else {