summaryrefslogtreecommitdiff
path: root/android/sco.h
diff options
context:
space:
mode:
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>2014-11-17 16:16:38 +0100
committerSzymon Janc <szymon.janc@tieto.com>2014-11-24 12:33:42 +0100
commit2f95a764867888e33c9577bcd35d1f70693f340b (patch)
tree815ec99cef62dce8500f87d6eef6bf5d73c9de06 /android/sco.h
parent8da8df121d005cafc54a0a01808c0f97cefc4eb9 (diff)
downloadbluez-2f95a764867888e33c9577bcd35d1f70693f340b.tar.gz
android/sco: Add SCO helper library
This patch adds sco lib which gives means to create SCO object with API to create listening socket, connect and disconnect. This is going to be common code for HFP HF and HFP GW. For now we support only one SCO at the time. SCO listening socket is created once bt_sco_new() is called, but SCO connection is possible only if confirm and connect callbacks are registered. Sco lib is not aware about voice settings. Those must be provided on bt_sco_connect or in confirm callback. This patch also adds this lib to Android build.
Diffstat (limited to 'android/sco.h')
-rw-r--r--android/sco.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/android/sco.h b/android/sco.h
new file mode 100644
index 000000000..4e1a2b3cf
--- /dev/null
+++ b/android/sco.h
@@ -0,0 +1,51 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+enum sco_status {
+ SCO_STATUS_OK,
+ SCO_STATUS_ERROR,
+};
+
+struct bt_sco;
+
+struct bt_sco *bt_sco_new(const bdaddr_t *local_bdaddr);
+
+struct bt_sco *bt_sco_ref(struct bt_sco *sco);
+void bt_sco_unref(struct bt_sco *sco);
+
+bool bt_sco_connect(struct bt_sco *sco, const bdaddr_t *remote_addr,
+ uint16_t voice_settings);
+void bt_sco_disconnect(struct bt_sco *sco);
+bool bt_sco_get_fd_and_mtu(struct bt_sco *sco, int *fd, uint16_t *mtu);
+
+typedef bool (*bt_sco_confirm_func_t) (const bdaddr_t *remote_addr,
+ uint16_t *voice_settings);
+typedef void (*bt_sco_conn_func_t) (enum sco_status status,
+ const bdaddr_t *addr);
+typedef void (*bt_sco_disconn_func_t) (const bdaddr_t *addr);
+
+void bt_sco_set_confirm_cb(struct bt_sco *sco,
+ bt_sco_confirm_func_t func);
+void bt_sco_set_connect_cb(struct bt_sco *sco, bt_sco_conn_func_t func);
+void bt_sco_set_disconnect_cb(struct bt_sco *sco,
+ bt_sco_disconn_func_t func);