diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-10-10 14:33:20 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-10-17 11:29:21 +0200 |
commit | bb538c86503e1f507cb51e269e3709e48458c325 (patch) | |
tree | 6ce4b43c547789ffeeb4d0fadffcb47fa5219450 /lib | |
parent | 702d110ad948cc98cb67e3a094ff434735ad1af8 (diff) |
Add a function for dynamic dependencies handling
Add a function to get number of dynamic dependencies in dependency list.
BUG-AGL: SPEC-2886
Change-Id: Ieb912bdb476c833c9f9c71710690b83976fc3d73
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/4a-hal-utilities/4a-hal-utilities-data.c | 20 | ||||
-rw-r--r-- | lib/4a-hal-utilities/4a-hal-utilities-data.h | 1 |
2 files changed, 21 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 6d1afd0..ea92b0e 100644 --- a/lib/4a-hal-utilities/4a-hal-utilities-data.c +++ b/lib/4a-hal-utilities/4a-hal-utilities-data.c @@ -313,6 +313,26 @@ int HalUtlGetNumberOfProbedDevicesInList(struct cds_list_head *probedDevicesList return HalUtlGetNumberOfNodesInList(probedDevicesListHead); } +int HalUtlGetNumberOfDynamicProbedDevicesInList(struct cds_list_head *probedDevicesListHead) +{ + int numberOfDynamicProbedDevicesInList = 0; + + struct InternalHalProbedDevice *currentProbedDevice; + + if(! probedDevicesListHead) + return -1; + + if(cds_list_empty(probedDevicesListHead)) + return 0; + + cds_list_for_each_entry(currentProbedDevice, probedDevicesListHead, node) { + if(currentProbedDevice->deviceClass == DYNAMIC_PROBED_DEVICE) + numberOfDynamicProbedDevicesInList++; + } + + return numberOfDynamicProbedDevicesInList; +} + struct InternalHalProbedDevice *HalUtlSearchProbedDeviceDataById(struct cds_list_head *probedDevicesListHead, char *uid) { diff --git a/lib/4a-hal-utilities/4a-hal-utilities-data.h b/lib/4a-hal-utilities/4a-hal-utilities-data.h index 0b62416..8e94078 100644 --- a/lib/4a-hal-utilities/4a-hal-utilities-data.h +++ b/lib/4a-hal-utilities/4a-hal-utilities-data.h @@ -159,6 +159,7 @@ int HalUtlRemoveSelectedProbedDeviceFromList(struct cds_list_head *probedDevices struct InternalHalProbedDevice *probedDeviceToRemove); int HalUtlRemoveAllProbedDevicesFromList(struct cds_list_head *probedDevicesListHead); int HalUtlGetNumberOfProbedDevicesInList(struct cds_list_head *probedDevicesListHead); +int HalUtlGetNumberOfDynamicProbedDevicesInList(struct cds_list_head *probedDevicesListHead); struct InternalHalProbedDevice *HalUtlSearchProbedDeviceDataById(struct cds_list_head *probedDevicesListHead, char *uid); int HalUtlGetProbedDeviceCardNbUsingUid(struct cds_list_head *probedDevicesListHead, char *uid); |