summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-09-26 17:20:57 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-09-26 17:21:19 +0200
commit6236c29b391fda6454aaf8083a24552370f5e62f (patch)
tree5ac3d0369014787e3fea24a04ab4e230a438fd8a
parentb7bc1f15345104ad5a202d9a5df9a80717f06e71 (diff)
Update call to 'subscribe' verb of 'alsacore' api
Update call to 'subscribe' verb of 'alsacore' api to match last '4a-alsacore' events/subscription handling updates. BUG-AGL: SPEC-2832 Change-Id: Ib6b5e1f4536440fd4f83a07d66fe047bfa889a5b Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
-rw-r--r--src/4a-internals-hal/4a-internals-hal-alsacore-link.c5
-rw-r--r--src/4a-internals-hal/4a-internals-hal-alsacore-link.h15
-rw-r--r--src/4a-internals-hal/4a-internals-hal-cb.c2
3 files changed, 14 insertions, 8 deletions
diff --git a/src/4a-internals-hal/4a-internals-hal-alsacore-link.c b/src/4a-internals-hal/4a-internals-hal-alsacore-link.c
index 130cea5..bb1c4c9 100644
--- a/src/4a-internals-hal/4a-internals-hal-alsacore-link.c
+++ b/src/4a-internals-hal/4a-internals-hal-alsacore-link.c
@@ -110,7 +110,10 @@ int InternalHalSubscribeToAlsaCardEvent(afb_api_t apiHandle, char *cardId)
json_object *subscribeQueryJ, *responseJ = NULL;
- wrapRet = wrap_json_pack(&subscribeQueryJ, "{s:s}", "devid", cardId);
+ wrapRet = wrap_json_pack(&subscribeQueryJ,
+ "{s:s, s:s}",
+ "event", ALSACORE_CARD_CONTROL_EVENT_NAME,
+ "devid", cardId);
if(wrapRet) {
AFB_API_ERROR(apiHandle, "Didn't succeed to allocate subscription query json object");
return -1;
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 03af081..dccf266 100644
--- a/src/4a-internals-hal/4a-internals-hal-alsacore-link.h
+++ b/src/4a-internals-hal/4a-internals-hal-alsacore-link.h
@@ -30,12 +30,15 @@
#include "4a-hal-utilities-alsa-data.h"
-#define ALSACORE_API "alsacore"
-#define ALSACORE_SUBSCRIBE_VERB "subscribe"
-#define ALSACORE_GETINFO_VERB "infoget"
-#define ALSACORE_CTLGET_VERB "ctlget"
-#define ALSACORE_CTLSET_VERB "ctlset"
-#define ALSACORE_ADDCTL_VERB "addcustomctl"
+#define ALSACORE_API "alsacore"
+
+#define ALSACORE_SUBSCRIBE_VERB "subscribe"
+#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"
// Alsa control types map from string function
snd_ctl_elem_type_t InternalHalMapsAlsaTypeToEnum(const char *label);
diff --git a/src/4a-internals-hal/4a-internals-hal-cb.c b/src/4a-internals-hal/4a-internals-hal-cb.c
index cc8fea5..a81871c 100644
--- a/src/4a-internals-hal/4a-internals-hal-cb.c
+++ b/src/4a-internals-hal/4a-internals-hal-cb.c
@@ -67,7 +67,7 @@ void InternalHalDispatchApiEvent(afb_api_t apiHandle, const char *evtLabel, json
if(evtLabel[idx] != '\0' &&
(sscanf(&evtLabel[idx + 1], "%d", &cardidx) == 1)) {
- if(wrap_json_unpack(eventJ, "{s:i s:o !}", "id", &numid, "val", &valuesJ)) {
+ if(wrap_json_unpack(eventJ, "{s:i s:o}", "id", &numid, "val", &valuesJ)) {
AFB_API_ERROR(apiHandle,
"Invalid alsacore event received label=%s value=%s",
evtLabel,