diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-05-27 22:27:52 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-10-08 15:51:00 +0200 |
commit | ee559d1b2aab833e1767e9f97b9b9cf97644bd03 (patch) | |
tree | 1f63d08365ae1f89d06198256a4f0ae94bbadf78 | |
parent | fe2759e55720c0927726cb4235e3e203b245998f (diff) |
Handle if some hal info are not available
Handle the case if some hal info are not available when the data of all
registered hal are requested.
Change-Id: Ia55fcc9ff6e964fe23965cf92bb06533c3d11695
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
-rw-r--r-- | 4a-hal/4a-hal-manager/4a-hal-manager-cb.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c index 8df79d6..6373dcb 100644 --- a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c +++ b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c @@ -113,20 +113,21 @@ void HalMgrLoaded(afb_request *request) if(! requestJsonErr && requestOptionValue > 0) { for(cpt = 0; cpt < numberOfLoadedApi; cpt++) { wrap_json_pack(&apiObject, - "{s:s s:i s:s s:i s:s s:s s:s}", + "{s:s s:i s:s s:i s:s s:s s:s s:s}", "api", currentHalData->apiName, "status", (int) currentHalData->status, "sndcard", currentHalData->sndCard, "internal", (int) currentHalData->internal, - "author", currentHalData->author, - "version", currentHalData->version, - "date", currentHalData->date); + "info", currentHalData->info ? currentHalData->info : "", + "author", currentHalData->author ? currentHalData->author : "", + "version", currentHalData->version ? currentHalData->version : "", + "date", currentHalData->date ? currentHalData->date : ""); json_object_array_add(requestAnswer, apiObject); currentHalData = currentHalData->next; } } - // Case if request option is empty or not handled + // Case if request is empty or not handled else { for(cpt = 0; cpt < numberOfLoadedApi; cpt++) { json_object_array_add(requestAnswer, json_object_new_string(currentHalData->apiName)); |