diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-10-10 18:02:38 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-10-17 11:29:21 +0200 |
commit | aecba74555859e2a7276b0fd3b1112837936dfa2 (patch) | |
tree | 2120ffe5cc54105bc48e0e8184868aabe29f1500 /src/4a-internals-hal/4a-internals-hal-alsacore-link.h | |
parent | fecb0ecc03662e634fa2464776ac4d5b0bd2fda3 (diff) |
Handle 'alsacore' events in a dedicated function
Handle 'alsacore' events in a dedicated function.
For now, only 'controls' events are handled. This modification
will also ease addition of other 'alsacore' events.
BUG-AGL: SPEC-2885
Change-Id: Ie56d4d58242fd7ff78306d85b54d48ed771f3227
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to 'src/4a-internals-hal/4a-internals-hal-alsacore-link.h')
-rw-r--r-- | src/4a-internals-hal/4a-internals-hal-alsacore-link.h | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/src/4a-internals-hal/4a-internals-hal-alsacore-link.h b/src/4a-internals-hal/4a-internals-hal-alsacore-link.h index 84a096a..0694a81 100644 --- a/src/4a-internals-hal/4a-internals-hal-alsacore-link.h +++ b/src/4a-internals-hal/4a-internals-hal-alsacore-link.h @@ -19,6 +19,7 @@ #define _INTERNALS_HAL_ALSACORE_LINK_INCLUDE_ #include <stdio.h> +#include <string.h> #include <wrap-json.h> @@ -29,17 +30,31 @@ #include <ctl-config.h> #include "4a-hal-utilities-alsa-data.h" +#include "4a-hal-utilities-data.h" -#define ALSACORE_API "alsacore" +#define ALSACORE_API "alsacore" +#define ALSACORE_API_NAME_LENGTH strlen(ALSACORE_API) -#define ALSACORE_SUBSCRIBE_VERB "subscribe" -#define ALSACORE_UNSUBSCRIBE_VERB "unsubscribe" -#define ALSACORE_GETINFO_VERB "infoget" -#define ALSACORE_CTLGET_VERB "ctlget" -#define ALSACORE_CTLSET_VERB "ctlset" -#define ALSACORE_ADDCTL_VERB "addcustomctl" +#define ALSACORE_SUBSCRIBE_VERB "subscribe" +#define ALSACORE_UNSUBSCRIBE_VERB "unsubscribe" +#define ALSACORE_GETINFO_VERB "infoget" +#define ALSACORE_CTLGET_VERB "ctlget" +#define ALSACORE_CTLSET_VERB "ctlset" +#define ALSACORE_ADDCTL_VERB "addcustomctl" -#define ALSACORE_CARD_CONTROL_EVENT_NAME "controls" +#define ALSACORE_CARD_CONTROL_EVENT_NAME "controls" + +#define ALSACORE_EVENT_NAME_BEGIN (ALSACORE_API_NAME_LENGTH + 1) +#define ALSACORE_CARD_CONTROL_EVENT_NAME_PREFIX "hw:" +#define ALSACORE_CARD_CONTROL_EVENT_NAME_PREFIX_LENGTH strlen(ALSACORE_CARD_CONTROL_EVENT_NAME_PREFIX) +#define ALSACORE_CARD_CONTROL_EVENT_BEGIN (ALSACORE_EVENT_NAME_BEGIN + ALSACORE_CARD_CONTROL_EVENT_NAME_PREFIX_LENGTH) + +// Enum for handled alsacore events + +enum aslacoreEventType { + ALSACORE_EVENT_CARD_CONTROL_CHANGE = 0, + ALSACORE_UNRECOGNIZED_EVENT = 1 +}; // Enum for the type of subscription/unsubscription to do with alsacore enum AlsacoreSubscribeUnsubscribeType { @@ -50,6 +65,12 @@ enum AlsacoreSubscribeUnsubscribeType { // Alsa control types map from string function snd_ctl_elem_type_t InternalHalMapsAlsaTypeToEnum(const char *label); +// Internals HAL alsacore events handler function +int InternalHalHandleAlsaCoreEvents(afb_api_t apiHandle, + const char *evtLabel, + json_object *eventJ, + struct HalData *currentHalData); + // Internals HAL alsacore calls funtions int InternalHalGetCardInfo(afb_api_t apiHandle, json_object *requestJ, json_object **responseJ); int InternalHalSubscribeToAlsacoreCardEvent(afb_api_t apiHandle, char *cardId); |