summaryrefslogtreecommitdiff
path: root/android/socket-api.txt
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2013-12-03 17:53:11 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-12-08 17:32:05 +0200
commitcb284a7adc1483872925b8bcfb0075f2e9314bca (patch)
tree10621a54ab40cd28b8ab2565776f7360c0aaff4c /android/socket-api.txt
parent22d3278a5a02f8e1366ef930a4e02ce91c87e14c (diff)
downloadbluez-cb284a7adc1483872925b8bcfb0075f2e9314bca.tar.gz
android/doc: Add socket-api.txt document
Document describes how socket HAL is working.
Diffstat (limited to 'android/socket-api.txt')
-rw-r--r--android/socket-api.txt61
1 files changed, 61 insertions, 0 deletions
diff --git a/android/socket-api.txt b/android/socket-api.txt
new file mode 100644
index 000000000..9f622f984
--- /dev/null
+++ b/android/socket-api.txt
@@ -0,0 +1,61 @@
+Android Socket protocol for Bluetooth
+=====================================
+
+Since Android switched from BlueZ (where sockets where nicely implemented) to
+Bluedroid user space stack there is a need to emulate bluetooth sockets.
+
+Android Bluetooth Socket Hardware Abstraction Layer (HAL) bt_sock.h has
+only 2 functions:
+
+static btsock_interface_t sock_if = {
+ sizeof(sock_if),
+ sock_listen,
+ sock_connect
+};
+
+with following parameters:
+
+sock_listen(btsock_type_t type, const char *service_name,
+ const uint8_t *uuid, int chan, int *sock_fd, int flags)
+sock_connect(const bt_bdaddr_t *bdaddr, btsock_type_t type,
+ const uint8_t *uuid, int chan, int *sock_fd, int flags)
+
+socket type RFCOMM is only supported at the moment. uuid and channel used
+to decide where to connect.
+
+sockfd is used to return socket fd to Android framework. It is used to inform
+framework when remote device is connected.
+
+listen()
+========
+
+Listens on RFCOMM socket, socket channel is either found based on uuid or
+channel parameter used directly. Returns sock_fd to Android framework.
+
+Through this sock_fd channel number as (int) needs to be written right after
+listen() succeeds.
+
+When remote device is connected to this socket we shall send accept signal
+through sock_fd
+
+connect()
+=========
+
+Connects to remote device specified in bd_addr parameter. Socket channel is
+found by SDP search of remote device by supplied uuid. Returns sock_fd to
+Android framework.
+
+Through this sock_fd channel number as (int) needs to be written right after
+connects() succeeds.
+
+When remote device is connected to this socket we shall send connect signal
+through sock_fd
+
+The format of connect/accept signal is shown below:
+
+struct hal_sock_connect_signal {
+ short size;
+ uint8_t bdaddr[6];
+ int channel;
+ int status;
+} __attribute__((packed));