diff options
author | Tobias Jahnke <tobias.jahnke@microchip.com> | 2018-10-10 15:52:57 +0200 |
---|---|---|
committer | Tobias Jahnke <tobias.jahnke@microchip.com> | 2018-10-10 15:52:57 +0200 |
commit | b071fc0882750d28036769c56c046fe1d7ae9942 (patch) | |
tree | d33a0968eb237c4975bc879087cadff57082dd10 /MOST_UNICENS/wrap_unicens.c | |
parent | 6d4cbab774c0fa632ccdf4add35b87d0828ac765 (diff) |
4a-hal-unicens: add Fiberdyne Master Volume
Bug-AGL: SPEC-1758
As preparation before introducing UNICENS 4a plugin:
- Init volume library at first
- Add fiberdyne master volume
- Introduce commands sent by control messages
- Removes outdated controls
- Known issue: turn ALSA volume above "93" to hear some sound
Change-Id: I591c6b109a51c9da602ad08514b67c2ec573e09c
Signed-off-by: Tobias Jahnke <tobias.jahnke@microchip.com>
Diffstat (limited to 'MOST_UNICENS/wrap_unicens.c')
-rw-r--r-- | MOST_UNICENS/wrap_unicens.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/MOST_UNICENS/wrap_unicens.c b/MOST_UNICENS/wrap_unicens.c index 095a2fe..4b75780 100644 --- a/MOST_UNICENS/wrap_unicens.c +++ b/MOST_UNICENS/wrap_unicens.c @@ -334,3 +334,35 @@ OnErrorExit: json_object_put(j_query); return err; } + +extern int wrap_ucs_sendmessage(uint16_t src_addr, uint16_t msg_id, uint8_t *data_ptr, uint8_t data_sz) { + + json_object *j_query, *j_response = NULL; + int err; + int node = (int)src_addr; + int msgid = (int)msg_id; + size_t data_size = (size_t)data_sz; + + /* skip data attribute if possible, wrap_json_unpack may fail to deal with + * an empty Base64 string */ + if (data_size > 0) + wrap_json_pack(&j_query, "{s:i, s:i, s:Y}", "node", node, "msgid", msgid, "data", data_ptr, data_size); + else + wrap_json_pack(&j_query, "{s:i, s:i}", "node", node, "msgid", msgid); + + err = afb_service_call_sync("UNICENS", "sendmessage", j_query, &j_response); + + if (err) { + AFB_ERROR("Failed to call wrap_ucs_sendmessage"); + goto OnErrorExit; + } + else { + AFB_INFO("Called wrap_ucs_sendmessage, res=%s", json_object_to_json_string(j_response)); + json_object_put(j_response); + } + + j_query = NULL; + +OnErrorExit: + return err; +} |