aboutsummaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.c
diff options
context:
space:
mode:
Diffstat (limited to '4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.c')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.c138
1 files changed, 69 insertions, 69 deletions
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.c
index 4273def..74d0fdd 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.c
@@ -25,7 +25,7 @@
#include <wrap-json.h>
-#include <afb-definitions.h>
+#include <afb/afb-binding.h>
#include "4a-hal-controllers-value-handler.h"
#include "4a-hal-controllers-alsacore-link.h"
@@ -62,7 +62,7 @@ int HalCtlsConvertPercentageToValue(int percentage, int min, int max)
* Convert json object from percentage to value *
******************************************************************************/
-int HalCtlsConvertJsonValueForIntegerControl(AFB_ApiT apiHandle,
+int HalCtlsConvertJsonValueForIntegerControl(afb_api_t apiHandle,
struct CtlHalAlsaCtlProperties *alsaCtlProperties,
json_object *toConvertJ,
json_object **ConvertedJ,
@@ -71,9 +71,9 @@ int HalCtlsConvertJsonValueForIntegerControl(AFB_ApiT apiHandle,
int initialValue, convertedValue;
if(! json_object_is_type(toConvertJ, json_type_int)) {
- AFB_ApiError(apiHandle,
- "Can't convert json value, unrecognized json format (must be an integer) : '%s'",
- json_object_get_string(toConvertJ));
+ AFB_API_ERROR(apiHandle,
+ "Can't convert json value, unrecognized json format (must be an integer) : '%s'",
+ json_object_get_string(toConvertJ));
return -1;
}
@@ -82,10 +82,10 @@ int HalCtlsConvertJsonValueForIntegerControl(AFB_ApiT apiHandle,
switch(requestedConversion) {
case CONVERSION_NORMALIZED_TO_ALSACORE:
if(initialValue < 0 || initialValue > 100) {
- AFB_ApiError(apiHandle,
- "Cannot convert '%i' value, value should be between 0 and 100 ('%s')",
- initialValue,
- json_object_get_string(toConvertJ));
+ AFB_API_ERROR(apiHandle,
+ "Cannot convert '%i' value, value should be between 0 and 100 ('%s')",
+ initialValue,
+ json_object_get_string(toConvertJ));
return -2;
}
@@ -94,11 +94,11 @@ int HalCtlsConvertJsonValueForIntegerControl(AFB_ApiT apiHandle,
alsaCtlProperties->maxval);
if(convertedValue == -INT_MAX) {
- AFB_ApiError(apiHandle,
- "Didn't succeed to convert %i (using min %i et max %i)",
- initialValue,
- alsaCtlProperties->minval,
- alsaCtlProperties->maxval);
+ AFB_API_ERROR(apiHandle,
+ "Didn't succeed to convert %i (using min %i et max %i)",
+ initialValue,
+ alsaCtlProperties->minval,
+ alsaCtlProperties->maxval);
return -3;
}
@@ -115,21 +115,21 @@ int HalCtlsConvertJsonValueForIntegerControl(AFB_ApiT apiHandle,
alsaCtlProperties->maxval);
if(convertedValue == -INT_MAX) {
- AFB_ApiError(apiHandle,
- "Didn't succeed to convert %i (using min %i et max %i)",
- initialValue,
- alsaCtlProperties->minval,
- alsaCtlProperties->maxval);
+ AFB_API_ERROR(apiHandle,
+ "Didn't succeed to convert %i (using min %i et max %i)",
+ initialValue,
+ alsaCtlProperties->minval,
+ alsaCtlProperties->maxval);
return -4;
}
break;
default:
- AFB_ApiError(apiHandle,
- "Can't convert '%i' value, unrecognized conversion type : '%i'",
- initialValue,
- (int) requestedConversion);
+ AFB_API_ERROR(apiHandle,
+ "Can't convert '%i' value, unrecognized conversion type : '%i'",
+ initialValue,
+ (int) requestedConversion);
*ConvertedJ = NULL;
return -5;
}
@@ -139,7 +139,7 @@ int HalCtlsConvertJsonValueForIntegerControl(AFB_ApiT apiHandle,
return 0;
}
-int HalCtlsConvertJsonValueForBooleanControl(AFB_ApiT apiHandle,
+int HalCtlsConvertJsonValueForBooleanControl(afb_api_t apiHandle,
struct CtlHalAlsaCtlProperties *alsaCtlProperties,
json_object *toConvertJ,
json_object **ConvertedJ,
@@ -157,17 +157,17 @@ int HalCtlsConvertJsonValueForBooleanControl(AFB_ApiT apiHandle,
break;
default:
- AFB_ApiError(apiHandle,
- "Can't convert json value, unrecognized format (must be an integer or a boolean) : '%s'",
- json_object_get_string(toConvertJ));
+ AFB_API_ERROR(apiHandle,
+ "Can't convert json value, unrecognized format (must be an integer or a boolean) : '%s'",
+ json_object_get_string(toConvertJ));
return -1;
}
if(initialValue < 0 || initialValue > 1) {
- AFB_ApiError(apiHandle,
- "Cannot convert '%i' value, value should be 0 or 1 ('%s')",
- initialValue,
- json_object_get_string(toConvertJ));
+ AFB_API_ERROR(apiHandle,
+ "Cannot convert '%i' value, value should be 0 or 1 ('%s')",
+ initialValue,
+ json_object_get_string(toConvertJ));
return -2;
}
@@ -181,10 +181,10 @@ int HalCtlsConvertJsonValueForBooleanControl(AFB_ApiT apiHandle,
break;
default:
- AFB_ApiError(apiHandle,
- "Can't convert '%i' value, unrecognized conversion type : '%i'",
- initialValue,
- (int) requestedConversion);
+ AFB_API_ERROR(apiHandle,
+ "Can't convert '%i' value, unrecognized conversion type : '%i'",
+ initialValue,
+ (int) requestedConversion);
*ConvertedJ = NULL;
return -3;
}
@@ -192,7 +192,7 @@ int HalCtlsConvertJsonValueForBooleanControl(AFB_ApiT apiHandle,
return 0;
}
-int HalCtlsConvertJsonValues(AFB_ApiT apiHandle,
+int HalCtlsConvertJsonValues(afb_api_t apiHandle,
struct CtlHalAlsaCtlProperties *alsaCtlProperties,
json_object *toConvertJ,
json_object **ConvertedJ,
@@ -224,11 +224,11 @@ int HalCtlsConvertJsonValues(AFB_ApiT apiHandle,
toConvertObjectJ,
&convertedValueJ,
requestedConversion))) {
- AFB_ApiError(apiHandle,
- "Error %i happened in when trying to convert index %i for integer control ('%s')",
- conversionError,
- idx,
- json_object_get_string(toConvertObjectJ));
+ AFB_API_ERROR(apiHandle,
+ "Error %i happened in when trying to convert index %i for integer control ('%s')",
+ conversionError,
+ idx,
+ json_object_get_string(toConvertObjectJ));
json_object_put(convertedArrayJ);
return -(idx + 1);
}
@@ -240,20 +240,20 @@ int HalCtlsConvertJsonValues(AFB_ApiT apiHandle,
toConvertObjectJ,
&convertedValueJ,
requestedConversion))) {
- AFB_ApiError(apiHandle,
- "Error %i happened in when trying to convert index %i for boolean control ('%s')",
- conversionError,
- idx,
- json_object_get_string(toConvertObjectJ));
+ AFB_API_ERROR(apiHandle,
+ "Error %i happened in when trying to convert index %i for boolean control ('%s')",
+ conversionError,
+ idx,
+ json_object_get_string(toConvertObjectJ));
json_object_put(convertedArrayJ);
return -(idx + 1);
}
break;
default:
- AFB_ApiError(apiHandle,
- "Conversion not handle for the alsa control type %i",
- (int) alsaCtlProperties->type);
+ AFB_API_ERROR(apiHandle,
+ "Conversion not handle for the alsa control type %i",
+ (int) alsaCtlProperties->type);
json_object_put(convertedArrayJ);
return -(idx + 1);
}
@@ -266,7 +266,7 @@ int HalCtlsConvertJsonValues(AFB_ApiT apiHandle,
return 0;
}
-int HalCtlsChangePreviousValuesUsingJson(AFB_ApiT apiHandle,
+int HalCtlsChangePreviousValuesUsingJson(afb_api_t apiHandle,
struct CtlHalAlsaCtlProperties *alsaCtlProperties,
json_object *requestedPercentageVariationJ,
json_object *previousControlValuesJ,
@@ -284,26 +284,26 @@ int HalCtlsChangePreviousValuesUsingJson(AFB_ApiT apiHandle,
requestedPercentageVariation = (int) strtol(requestedPercentageVariationString, &conversionEnd, 10);
if(conversionEnd == requestedPercentageVariationString) {
- AFB_ApiError(apiHandle,
- "Tried to increase/decrease an integer control \
- but string sent in json is not a increase/decrease string : '%s'",
- json_object_get_string(requestedPercentageVariationJ));
+ AFB_API_ERROR(apiHandle,
+ "Tried to increase/decrease an integer control \
+ but string sent in json is not a increase/decrease string : '%s'",
+ json_object_get_string(requestedPercentageVariationJ));
return -1;
}
if(alsaCtlProperties->type != SND_CTL_ELEM_TYPE_INTEGER &&
alsaCtlProperties->type != SND_CTL_ELEM_TYPE_INTEGER64) {
- AFB_ApiError(apiHandle,
- "Tried to increase/decrease values on a incompatible \
- control type (%i), control type must be an integer",
- alsaCtlProperties->type);
+ AFB_API_ERROR(apiHandle,
+ "Tried to increase/decrease values on a incompatible \
+ control type (%i), control type must be an integer",
+ alsaCtlProperties->type);
return -2;
}
if(requestedPercentageVariation < -100 || requestedPercentageVariation > 100) {
- AFB_ApiError(apiHandle,
- "Tried to increase/decrease values but specified change is \
- not a valid percentage, it should be between -100 and 100");
+ AFB_API_ERROR(apiHandle,
+ "Tried to increase/decrease values but specified change is \
+ not a valid percentage, it should be between -100 and 100");
return -3;
}
@@ -312,11 +312,11 @@ int HalCtlsChangePreviousValuesUsingJson(AFB_ApiT apiHandle,
alsaCtlProperties->maxval);
if(requestedeVariation == -INT_MAX) {
- AFB_ApiError(apiHandle,
- "Didn't succeed to convert %i (using min %i et max %i)",
- requestedPercentageVariation,
- alsaCtlProperties->minval,
- alsaCtlProperties->maxval);
+ AFB_API_ERROR(apiHandle,
+ "Didn't succeed to convert %i (using min %i et max %i)",
+ requestedPercentageVariation,
+ alsaCtlProperties->minval,
+ alsaCtlProperties->maxval);
return -4;
}
@@ -331,9 +331,9 @@ int HalCtlsChangePreviousValuesUsingJson(AFB_ApiT apiHandle,
toChangeObjectJ = json_object_array_get_idx(previousControlValuesJ, idx);
if(! json_object_is_type(toChangeObjectJ, json_type_int)) {
- AFB_ApiError(apiHandle,
- "Current json object %s is not an integer",
- json_object_get_string(toChangeObjectJ));
+ AFB_API_ERROR(apiHandle,
+ "Current json object %s is not an integer",
+ json_object_get_string(toChangeObjectJ));
return -(10 + idx);
}