From 7bfe8ade59cb8500ba39939a5aa6f18e5c242cd1 Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Thu, 6 Jun 2019 15:26:02 +0200 Subject: 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 --- src/4a-hal-manager/4a-hal-manager-cb.c | 13 ++++++++++--- 1 file 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, + ¤tHalData->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 { -- cgit 1.2.3-korg