summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-01-08 15:09:09 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-01-13 14:33:16 +0200
commit48449b66323fe731a56188cd366e8befeee5f2a4 (patch)
tree0668f4cabce3aecea57ab62bbab1c9dab43621cb /android
parentbb36b8aa44ddcb1ad807d03d6fc11d0159c4e755 (diff)
audio/A2DP: Add implemention of audio Close command
Diffstat (limited to 'android')
-rw-r--r--android/a2dp.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/android/a2dp.c b/android/a2dp.c
index b6b46e4e5..354895ac2 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -517,11 +517,37 @@ failed:
audio_ipc_send_rsp(AUDIO_OP_OPEN, AUDIO_STATUS_FAILED);
}
+static struct a2dp_endpoint *find_endpoint(uint8_t id)
+{
+ GSList *l;
+
+ for (l = endpoints; l; l = g_slist_next(l)) {
+ struct a2dp_endpoint *endpoint = l->data;
+
+ if (endpoint->id == id)
+ return endpoint;
+ }
+
+ return NULL;
+}
+
static void bt_audio_close(const void *buf, uint16_t len)
{
- DBG("Not Implemented");
+ const struct audio_cmd_close *cmd = buf;
+ struct a2dp_endpoint *endpoint;
+
+ DBG("");
+
+ endpoint = find_endpoint(cmd->id);
+ if (!endpoint) {
+ error("Unable to find endpoint %u", cmd->id);
+ audio_ipc_send_rsp(AUDIO_OP_CLOSE, AUDIO_STATUS_FAILED);
+ return;
+ }
+
+ unregister_endpoint(endpoint);
- audio_ipc_send_rsp(AUDIO_OP_CLOSE, HAL_STATUS_FAILED);
+ audio_ipc_send_rsp(AUDIO_OP_CLOSE, AUDIO_STATUS_SUCCESS);
}
static void bt_stream_open(const void *buf, uint16_t len)