diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-06-24 14:20:24 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-06-25 09:53:22 +0200 |
commit | 7cc44519439f2e96b88f4b9cc68e96d0668ef7ea (patch) | |
tree | 73f9ff84ed6027b26561748b7f8cc17de388cba4 | |
parent | 3bc5eb3c4da0565fd4138344363207eab62fff9a (diff) |
Add function to get probed device card number
Add function to get probed device card number using its uid.
BUG-AGL: SPEC-2329
Change-Id: I75bd368d0b1d0ab6d41fc0d75b30511fa7e8584f
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
-rw-r--r-- | lib/4a-hal-utilities/4a-hal-utilities-data.c | 12 | ||||
-rw-r--r-- | lib/4a-hal-utilities/4a-hal-utilities-data.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/4a-hal-utilities/4a-hal-utilities-data.c b/lib/4a-hal-utilities/4a-hal-utilities-data.c index 979f46d..3ac2a7c 100644 --- a/lib/4a-hal-utilities/4a-hal-utilities-data.c +++ b/lib/4a-hal-utilities/4a-hal-utilities-data.c @@ -302,6 +302,18 @@ struct InternalHalProbedDevice *HalUtlSearchProbedDeviceDataById(struct cds_list return NULL; } +int HalUtlGetProbedDeviceCardNbUsingUid(struct cds_list_head *probedDevicesListHead, char *uid) +{ + struct InternalHalProbedDevice *currentProbedDeviceData; + + currentProbedDeviceData = HalUtlSearchProbedDeviceDataById(probedDevicesListHead, uid); + if(! currentProbedDeviceData || + ! currentProbedDeviceData->deviceData) + return HAL_UNKNOWN_DEVICE; + + return currentProbedDeviceData->deviceData->cardNb; +} + struct InternalHalDeviceData *HalUtlAllocateAndFillProbedDeviceDataUsingInfoGetResponse(json_object *responseJ) { struct InternalHalDeviceData *currentProbedDeviceData; diff --git a/lib/4a-hal-utilities/4a-hal-utilities-data.h b/lib/4a-hal-utilities/4a-hal-utilities-data.h index 48420cd..1571485 100644 --- a/lib/4a-hal-utilities/4a-hal-utilities-data.h +++ b/lib/4a-hal-utilities/4a-hal-utilities-data.h @@ -162,6 +162,7 @@ int HalUtlRemoveAllProbedDevicesFromList(struct cds_list_head *probedDevicesList int HalUtlGetNumberOfProbedDevicesInList(struct cds_list_head *probedDevicesListHead); struct InternalHalProbedDevice *HalUtlSearchProbedDeviceDataById(struct cds_list_head *probedDevicesListHead, char *uid); +int HalUtlGetProbedDeviceCardNbUsingUid(struct cds_list_head *probedDevicesListHead, char *uid); struct InternalHalDeviceData *HalUtlAllocateAndFillProbedDeviceDataUsingInfoGetResponse(json_object *responseJ); json_object *HalUtlGetJsonForSpecificDependencies(afb_api_t apiHandle, struct InternalHalProbedDevice *requestedProbedDevice, |