summaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.h
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-12-19 10:59:37 +0100
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-12-20 15:18:36 +0100
commit5283492076fa4a0e537c255337d4139ab33896f7 (patch)
tree9e599eacfac0053541ce3faa8577626c13739be7 /4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.h
parentd4d1991ec1a666e798f27fc78e77a19c0bbf4ef3 (diff)
Improve ALSA controls volume values conversion
Rework halmap ALSA controls volume conversion to be able to add new types of volume conversions easily. Bug-AGL: SPEC-1313 Change-Id: I0949f25c24a349e7409233f51b3d5738ebc43a8a Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.h')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.h b/4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.h
index 5f91aaa..f976fe8 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.h
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-value-handler.h
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-#ifndef _HAL_CTLS_VALUE_NORMALIZATION_INCLUDE_
-#define _HAL_CTLS_VALUE_NORMALIZATION_INCLUDE_
+#ifndef _HAL_CTLS_VALUE_CONVERSION_INCLUDE_
+#define _HAL_CTLS_VALUE_CONVERSION_INCLUDE_
#include <stdio.h>
@@ -24,11 +24,21 @@
#include "4a-hal-controllers-alsacore-link.h"
+// Enum for the type of conversion requested
+enum ConversionType {
+ CONVERSION_NORMALIZED_TO_ALSACORE = 1,
+ CONVERSION_ALSACORE_TO_NORMALIZED = 2
+};
+
// Simple conversion value to/from percentage functions
int HalCtlsConvertValueToPercentage(double val, double min, double max);
int HalCtlsConvertPercentageToValue(int percentage, int min, int max);
// Convert json object from percentage to value
-int HalCtlsNormalizeJsonValues(AFB_ApiT apiHandle, struct CtlHalAlsaCtlProperties *alsaCtlProperties, json_object *toConvertJ, json_object ** ConvertedJ);
+int HalCtlsConvertJsonValues(AFB_ApiT apiHandle,
+ struct CtlHalAlsaCtlProperties *alsaCtlProperties,
+ json_object *toConvertJ,
+ json_object **ConvertedJ,
+ enum ConversionType requestedConversion);
-#endif /* _HAL_CTLS_VALUE_NORMALIZATION_INCLUDE_ */ \ No newline at end of file
+#endif /* _HAL_CTLS_VALUE_CONVERSION_INCLUDE_ */ \ No newline at end of file