diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-12-13 19:48:36 -0800 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-12-13 22:16:49 -0800 |
commit | 62c16eaa5a9e97145dc2ee2f03f9f900ada27147 (patch) | |
tree | 5c13bcdbf9898c816363566da9b14d441291ee97 | |
parent | a04e0913014e319f7c60e8708824ebe240047882 (diff) |
binding: mediaplayer: fix connect/disconnect of a2dp/avrcp profiles
Bug-AGL: SPEC-1630
Change-Id: I38fc2c131b3d56a4b5a0a87f3bcd0eb27af5bb66
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r-- | binding/afm-mediaplayer-binding.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c index 049fb2d..37cd85e 100644 --- a/binding/afm-mediaplayer-binding.c +++ b/binding/afm-mediaplayer-binding.c @@ -336,18 +336,24 @@ static void avrcp_controls(afb_req_t request) const char *value = afb_req_value(request, "value"); const char *action = NULL; afb_api_t api = afb_req_get_api(request); - int cmd = get_command_index(value), ret; + int cmd, ret; json_object *response, *jresp = NULL; - if (cmd < 0) { - afb_req_fail(request, "failed", "unknown command"); - return; - } + if (!g_strcmp0(value, "connect") || !g_strcmp0(value, "disconnect")) { + action = value; + } else { + cmd = get_command_index(value); - action = avrcp_control_commands[cmd]; - if (!action) { - afb_req_fail(request, "failed", "command not supported"); - return; + if (cmd < 0) { + afb_req_fail(request, "failed", "unknown command"); + return; + } + + action = avrcp_control_commands[cmd]; + if (!action) { + afb_req_fail(request, "failed", "command not supported"); + return; + } } jresp = json_object_new_object(); @@ -501,10 +507,13 @@ static void controls(afb_req_t request) } pthread_mutex_lock(&mutex); - if (data.avrcp_connected) + if (data.avrcp_connected || !g_strcmp0(value, "connect")) { + pthread_mutex_unlock(&mutex); avrcp_controls(request); - else - gstreamer_controls(request); + return; + } + + gstreamer_controls(request); pthread_mutex_unlock(&mutex); } |