diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-06-18 11:09:35 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-06-18 11:12:33 +0200 |
commit | 870d396127c2e5e247cb85a7921143e78ee81ce4 (patch) | |
tree | 9c4b2df2e40c6716f215f938ff840dba7c4fb61c /lib/4a-hal-utilities/4a-hal-utilities-data.c | |
parent | 7bfe8ade59cb8500ba39939a5aa6f18e5c242cd1 (diff) |
Move function about dependency selection
Move function used to test if a dependency is selected.
BUG-AGL: SPEC-2329
Change-Id: Ic577a33741d705e09dd14a48dde0483db792b97d
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to 'lib/4a-hal-utilities/4a-hal-utilities-data.c')
-rw-r--r-- | lib/4a-hal-utilities/4a-hal-utilities-data.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/lib/4a-hal-utilities/4a-hal-utilities-data.c b/lib/4a-hal-utilities/4a-hal-utilities-data.c index 845ea59..6f85565 100644 --- a/lib/4a-hal-utilities/4a-hal-utilities-data.c +++ b/lib/4a-hal-utilities/4a-hal-utilities-data.c @@ -70,6 +70,33 @@ char *HalUtlGetProbedDeviceClassString(enum ProbedDeviceClasses deviceClass) return NULL; } +int HalUtlIsDependencySelected(struct InternalHalProbedDevice *probedDevice, enum DependencyStatus requestedStatus) +{ + if(! probedDevice) { + return 0; + } + + switch(requestedStatus) { + case UNAVAILABLE_DEPENDENCY: + if(! probedDevice->deviceData) + return 1; + else + return 0; + + case AVAILABLE_DEPENDENCY: + if(probedDevice->deviceData) + return 1; + else + return 0; + + case ALL_DEPENDENCY: + return 1; + + default: + return 0; + } +} + struct InternalHalProbedDevice *HalUtlAddProbedDeviceToProbedDeviceList(struct InternalHalProbedDevice **probedDevicesList) { struct InternalHalProbedDevice *currentProbedDevice; @@ -443,33 +470,6 @@ json_object *HalUtlGetJsonForSpecificDependenciesUsingUid(afb_api_t apiHandle, return requestedProbedDeviceJ; } -int HalUtlIsDependencySelected(struct InternalHalProbedDevice *probedDevice, enum DependencyStatus requestedStatus) -{ - if(! probedDevice) { - return 0; - } - - switch(requestedStatus) { - case UNAVAILABLE_DEPENDENCY: - if(! probedDevice->deviceData) - return 1; - else - return 0; - - case AVAILABLE_DEPENDENCY: - if(probedDevice->deviceData) - return 1; - else - return 0; - - case ALL_DEPENDENCY: - return 1; - - default: - return 0; - } -} - json_object *HalUtlGetJsonArrayForSelectedDependencies(afb_api_t apiHandle, struct InternalHalProbedDevice **probedDevicesList, enum DependencyInfoJsonFormat jsonFormat, |