tizen 2.3.1 release
[framework/connectivity/bluez.git] / android / a2dp-sink.c
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2014  Intel Corporation. All rights reserved.
6  *
7  *
8  *  This library is free software; you can redistribute it and/or
9  *  modify it under the terms of the GNU Lesser General Public
10  *  License as published by the Free Software Foundation; either
11  *  version 2.1 of the License, or (at your option) any later version.
12  *
13  *  This library is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  *  Lesser General Public License for more details.
17  *
18  *  You should have received a copy of the GNU Lesser General Public
19  *  License along with this library; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  */
23
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27
28 #include <stdbool.h>
29 #include <glib.h>
30
31 #include "lib/bluetooth.h"
32 #include "src/log.h"
33 #include "hal-msg.h"
34 #include "ipc.h"
35 #include "a2dp-sink.h"
36
37 static struct ipc *hal_ipc = NULL;
38
39 static void bt_a2dp_sink_connect(const void *buf, uint16_t len)
40 {
41         /* TODO */
42
43         DBG("");
44
45         ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_A2DP_SINK, HAL_OP_A2DP_CONNECT,
46                                                         HAL_STATUS_UNSUPPORTED);
47 }
48
49 static void bt_a2dp_sink_disconnect(const void *buf, uint16_t len)
50 {
51         /* TODO */
52
53         DBG("");
54
55         ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_A2DP_SINK, HAL_OP_A2DP_DISCONNECT,
56                                                         HAL_STATUS_UNSUPPORTED);
57 }
58
59 static const struct ipc_handler cmd_handlers[] = {
60         /* HAL_OP_A2DP_CONNECT */
61         { bt_a2dp_sink_connect, false, sizeof(struct hal_cmd_a2dp_connect) },
62         /* HAL_OP_A2DP_DISCONNECT */
63         { bt_a2dp_sink_disconnect, false,
64                                 sizeof(struct hal_cmd_a2dp_disconnect) },
65 };
66
67 bool bt_a2dp_sink_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode)
68 {
69         DBG("");
70
71         hal_ipc = ipc;
72         ipc_register(hal_ipc, HAL_SERVICE_ID_A2DP_SINK, cmd_handlers,
73                                                 G_N_ELEMENTS(cmd_handlers));
74
75         return true;
76 }
77
78 void bt_a2dp_sink_unregister(void)
79 {
80         DBG("");
81
82         ipc_unregister(hal_ipc, HAL_SERVICE_ID_A2DP_SINK);
83         hal_ipc = NULL;
84 }