1 Android Socket protocol for Bluetooth
2 =====================================
4 Since Android switched from BlueZ (where sockets where nicely implemented) to
5 Bluedroid user space stack there is a need to emulate bluetooth sockets.
7 Android Bluetooth Socket Hardware Abstraction Layer (HAL) bt_sock.h has
10 static btsock_interface_t sock_if = {
16 with following parameters:
18 sock_listen(btsock_type_t type, const char *service_name,
19 const uint8_t *uuid, int chan, int *sock_fd, int flags)
20 sock_connect(const bt_bdaddr_t *bdaddr, btsock_type_t type,
21 const uint8_t *uuid, int chan, int *sock_fd, int flags)
23 socket type RFCOMM is only supported at the moment. uuid and channel used
24 to decide where to connect.
26 sockfd is used to return socket fd to Android framework. It is used to inform
27 framework when remote device is connected.
32 Listens on RFCOMM socket, socket channel is either found based on uuid or
33 channel parameter used directly. Returns sock_fd to Android framework.
35 Through this sock_fd channel number as (int) needs to be written right after
38 When remote device is connected to this socket we shall send accept signal
44 Connects to remote device specified in bd_addr parameter. Socket channel is
45 found by SDP search of remote device by supplied uuid. Returns sock_fd to
48 Through this sock_fd channel number as (int) needs to be written right after
51 When remote device is connected to this socket we shall send connect signal
54 The format of connect/accept signal is shown below:
56 struct hal_sock_connect_signal {
61 } __attribute__((packed));