summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/4a-hal-utilities/4a-hal-utilities-data.c66
-rw-r--r--lib/4a-hal-utilities/4a-hal-utilities-data.h4
2 files changed, 59 insertions, 11 deletions
diff --git a/lib/4a-hal-utilities/4a-hal-utilities-data.c b/lib/4a-hal-utilities/4a-hal-utilities-data.c
index b6d8abb..6d1afd0 100644
--- a/lib/4a-hal-utilities/4a-hal-utilities-data.c
+++ b/lib/4a-hal-utilities/4a-hal-utilities-data.c
@@ -611,8 +611,13 @@ json_object *HalUtlGetJsonForSpecificDependenciesUsingUid(afb_api_t apiHandle,
return NULL;
}
- if(! probedDevicesListHead || cds_list_empty(probedDevicesListHead)) {
- AFB_API_ERROR(apiHandle, "Probed device list is empty");
+ if(! probedDevicesListHead) {
+ AFB_API_ERROR(apiHandle, "Probed device list is not valid");
+ return NULL;
+ }
+
+ if(cds_list_empty(probedDevicesListHead)) {
+ AFB_API_INFO(apiHandle, "Probed device list is empty");
return NULL;
}
@@ -655,7 +660,7 @@ json_object *HalUtlGetJsonArrayForSelectedDependencies(afb_api_t apiHandle,
}
if(! probedDevicesListHead || cds_list_empty(probedDevicesListHead)) {
- AFB_API_ERROR(apiHandle, "Probed device list is empty");
+ AFB_API_ERROR(apiHandle, "Probed device list is not valid or empty");
return NULL;
}
@@ -699,8 +704,13 @@ json_object *HalUtlGetJsonArrayForAvailableDependencies(afb_api_t apiHandle,
return NULL;
}
- if(! probedDevicesListHead || cds_list_empty(probedDevicesListHead)) {
- AFB_API_ERROR(apiHandle, "Probed device list is empty");
+ if(! probedDevicesListHead) {
+ AFB_API_ERROR(apiHandle, "Probed device list is not valid");
+ return NULL;
+ }
+
+ if(cds_list_empty(probedDevicesListHead)) {
+ AFB_API_INFO(apiHandle, "Probed device list is empty");
return NULL;
}
@@ -713,6 +723,12 @@ json_object *HalUtlGetJsonArrayForAvailableDependencies(afb_api_t apiHandle,
return NULL;
}
+ if(! json_object_array_length(requestedDependenciesInfoJ)) {
+ AFB_API_INFO(apiHandle, "No available devices (dependencies) in list");
+ json_object_put(requestedDependenciesInfoJ);
+ return NULL;
+ }
+
return requestedDependenciesInfoJ;
}
@@ -727,8 +743,13 @@ json_object *HalUtlGetJsonArrayForAllDependencies(afb_api_t apiHandle,
return NULL;
}
- if(! probedDevicesListHead || cds_list_empty(probedDevicesListHead)) {
- AFB_API_ERROR(apiHandle, "Probed device list is empty");
+ if(! probedDevicesListHead) {
+ AFB_API_ERROR(apiHandle, "Probed device list is not valid");
+ return NULL;
+ }
+
+ if(cds_list_empty(probedDevicesListHead)) {
+ AFB_API_INFO(apiHandle, "Probed device list is empty");
return NULL;
}
@@ -737,7 +758,13 @@ json_object *HalUtlGetJsonArrayForAllDependencies(afb_api_t apiHandle,
jsonFormat,
ALL_DEPENDENCY);
if(! requestedDependenciesInfoJ) {
- AFB_API_ERROR(apiHandle, "Didn't succeed get available devices (dependencies) info");
+ AFB_API_ERROR(apiHandle, "Didn't succeed get all devices (dependencies) info");
+ return NULL;
+ }
+
+ if(! json_object_array_length(requestedDependenciesInfoJ)) {
+ AFB_API_ERROR(apiHandle, "No devices (dependencies) info returned but list is not empty");
+ json_object_put(requestedDependenciesInfoJ);
return NULL;
}
@@ -842,7 +869,7 @@ json_object *HalUtlGetJsonArrayForAllMixersData(afb_api_t apiHandle, struct cds_
}
if(cds_list_empty(mixerDataListHead)) {
- AFB_API_ERROR(apiHandle, "Mixer data list is empty");
+ AFB_API_INFO(apiHandle, "Mixer data list is empty");
return NULL;
}
@@ -863,6 +890,12 @@ json_object *HalUtlGetJsonArrayForAllMixersData(afb_api_t apiHandle, struct cds_
json_object_array_add(mixerDataArrayJ, currentMixerDataJ);
}
+ if(! json_object_array_length(mixerDataArrayJ)) {
+ AFB_API_ERROR(apiHandle, "No mixer info returned but list is not empty");
+ json_object_put(mixerDataArrayJ);
+ return NULL;
+ }
+
return mixerDataArrayJ;
}
@@ -992,8 +1025,13 @@ json_object *HalUtGetJsonArrayForAllHalMapControls(afb_api_t apiHandle, struct c
return NULL;
}
- if(! halMapListHead || cds_list_empty(halMapListHead)) {
- AFB_API_ERROR(apiHandle, "HalMap data list is empty");
+ if(! halMapListHead) {
+ AFB_API_ERROR(apiHandle, "HalMap data list is not valid");
+ return NULL;
+ }
+
+ if(cds_list_empty(halMapListHead)) {
+ AFB_API_INFO(apiHandle, "HalMap data list is empty");
return NULL;
}
@@ -1014,6 +1052,12 @@ json_object *HalUtGetJsonArrayForAllHalMapControls(afb_api_t apiHandle, struct c
json_object_array_add(halMapDataArrayJ, currentHalMapDataJ);
}
+ if(! json_object_array_length(halMapDataArrayJ)) {
+ AFB_API_ERROR(apiHandle, "No HalMap info returned but list is not empty");
+ json_object_put(halMapDataArrayJ);
+ return NULL;
+ }
+
return halMapDataArrayJ;
}
diff --git a/lib/4a-hal-utilities/4a-hal-utilities-data.h b/lib/4a-hal-utilities/4a-hal-utilities-data.h
index 5677dac..fe55495 100644
--- a/lib/4a-hal-utilities/4a-hal-utilities-data.h
+++ b/lib/4a-hal-utilities/4a-hal-utilities-data.h
@@ -194,6 +194,10 @@ int HalUtlRemoveSelectedHalMapData(struct cds_list_head *halMapListHead,
struct InternalHalAlsaMap *halMapDataToRemove);
int HalUtlRemoveAllHalMapData(struct cds_list_head *halMapListHead);
int HalUtlGetNumberOfHalMapDataInList(struct cds_list_head *halMapListHead);
+json_object *HalUtlGetJsonForSpecificDependenciesUsingUid(afb_api_t apiHandle,
+ struct cds_list_head *probedDevicesListHead,
+ char *uid,
+ enum DependencyInfoJsonFormat jsonFormat);
json_object *HalUtGetJsonArrayForSpecificHalMapControl(afb_api_t apiHandle,
struct InternalHalAlsaMap *currentHalMapData);
json_object *HalUtGetJsonArrayForAllHalMapControls(afb_api_t apiHandle, struct cds_list_head *halMapListHead);