summaryrefslogtreecommitdiffstats
path: root/binding/binding.c
diff options
context:
space:
mode:
authorTobias Jahnke <tobias.jahnke@microchip.com>2019-10-15 15:14:30 +0200
committerTobias Jahnke <tobias.jahnke@microchip.com>2019-10-16 06:11:37 +0000
commite91eaa18befd14446d280311c9bd5c05f29801f0 (patch)
treec8921df433cacd724a7ade71f74be2aa962adff0 /binding/binding.c
parent6854f72cb81b10e1add164e754aba1952df5b269 (diff)
unicens-controller: add DOA feature
Introduce a new API to retrieve the current direction of audio (DOA) recognized by the microphone. Bug-AGL: SPEC-2899 Signed-off-by: Tobias Jahnke <tobias.jahnke@microchip.com> Change-Id: I387efaeaf0cffd06b3d88efbeeaf2ef7eb23c780
Diffstat (limited to 'binding/binding.c')
-rw-r--r--binding/binding.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/binding/binding.c b/binding/binding.c
index cebc54a..1d19fdb 100644
--- a/binding/binding.c
+++ b/binding/binding.c
@@ -38,6 +38,7 @@ static int init(afb_api_t api) {
AFB_API_NOTICE(afbBindingRoot, "UNICENS-CONTROLLER: INIT");
wrap_ucs_init(api);
wrap_ucs_subscribe_sync();
+ wrap_ucs_subscriberx_sync();
return 0;
}
@@ -47,10 +48,15 @@ static void on_availability_cb(uint16_t node, bool available) {
microphone_availablility_changed(node, available);
}
+static void on_message_rx_cb(uint16_t node, uint16_t msg_id, uint16_t data_sz, uint8_t *data_ptr) {
+ microphone_message_received(node, msg_id, data_sz, data_ptr);
+}
+
/* callback for handling events */
static void onevent(afb_api_t api, const char *event, struct json_object *object) {
AFB_API_NOTICE(afbBindingRoot, "UNICENS-CONTROLLER: Event: %s object: %s", event, json_object_get_string(object));
wrap_ucs_interpret_event(event, object, &on_availability_cb);
+ wrap_ucs_interpretrx_event(event, object, &on_message_rx_cb);
}
static void ping(afb_req_t request) {
@@ -63,6 +69,7 @@ static const afb_verb_t verbs[] = {
{.verb = "slimamp_master_volume_set", .session = AFB_SESSION_NONE, .callback = slimamp_master_vol_set_api, .auth = NULL},
{.verb = "amplifier_master_volume_set", .session = AFB_SESSION_NONE, .callback = amplifier_master_vol_set_api, .auth = NULL},
{.verb = "microphone_mode_set", .session = AFB_SESSION_NONE, .callback = microphone_mode_set_api, .auth = NULL},
+ {.verb = "microphone_doa_get", .session = AFB_SESSION_NONE, .callback = microphone_doa_get_api, .auth = NULL},
{NULL}
};