tizen 2.3.1 release
[framework/connectivity/bluez.git] / android / sco.h
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 enum sco_status {
25         SCO_STATUS_OK,
26         SCO_STATUS_ERROR,
27 };
28
29 struct bt_sco;
30
31 struct bt_sco *bt_sco_new(const bdaddr_t *local_bdaddr);
32
33 struct bt_sco *bt_sco_ref(struct bt_sco *sco);
34 void bt_sco_unref(struct bt_sco *sco);
35
36 bool bt_sco_connect(struct bt_sco *sco, const bdaddr_t *remote_addr,
37                                                 uint16_t voice_settings);
38 void bt_sco_disconnect(struct bt_sco *sco);
39 bool bt_sco_get_fd_and_mtu(struct bt_sco *sco, int *fd, uint16_t *mtu);
40
41 typedef bool (*bt_sco_confirm_func_t) (const bdaddr_t *remote_addr,
42                                                 uint16_t *voice_settings);
43 typedef void (*bt_sco_conn_func_t) (enum sco_status status,
44                                                         const bdaddr_t *addr);
45 typedef void (*bt_sco_disconn_func_t) (const bdaddr_t *addr);
46
47 void bt_sco_set_confirm_cb(struct bt_sco *sco,
48                                         bt_sco_confirm_func_t func);
49 void bt_sco_set_connect_cb(struct bt_sco *sco, bt_sco_conn_func_t func);
50 void bt_sco_set_disconnect_cb(struct bt_sco *sco,
51                                                 bt_sco_disconn_func_t func);