#include <sys/types.h>
#include <bt/bt_defs.h>
#include <bt/bt_hci_api.h>
Defines | |
ACL Payload Sizes | |
These are the defines of the different ACL payload sizes | |
#define | BT_ACL_HCI_PKT_HDR_LEN 5 |
#define | BT_ACL_PAYLOAD_SIZE_DH1 26 |
#define | BT_ACL_PAYLOAD_SIZE_DH3 183 |
#define | BT_ACL_PAYLOAD_SIZE_DH5 339 |
#define | BT_ACL_PAYLOAD_SIZE_DM1 16 |
#define | BT_ACL_PAYLOAD_SIZE_DM3 121 |
#define | BT_ACL_PAYLOAD_SIZE_DM5 224 |
Functions | |
u_short | bt_acl_get_max_pkt_len (struct btstack *stack) |
Returns the maximal ACL payload size. | |
u_short | bt_acl_get_pkt_types (struct btstack *stack) |
Returns current setting of ACL packet types to use. | |
Sending ACL Data | |
The following functions define the API provided to send ACL data. | |
long | bt_acl_acquire_write_lock (struct btstack *stack, bt_hci_con_handle_t con_handle, u_char pb_flag, u_char bc_flag, u_short length) |
Acquires a given baseband connection to send ACL data. | |
long | bt_acl_lowlevel_write (struct btstack *stack, u_char *data, u_short len) |
Writes ACL data to the previousely acquired baseband connection. | |
long | bt_acl_send_packet (struct btstack *stack, bt_hci_con_handle_t con_hdl, u_char pb_flag, u_char bc_flag, u_char *data, u_short len) |
Sends an ACL data packet. | |
void | bt_acl_write_lock_release (struct btstack *stack) |
Releases a given baseband connection. | |
ACL Packet Accessors | |
API functions for accessing the header fileds of received ACL packets. | |
u_char | bt_acl_get_bc_flag (struct bt_hci_pkt_acl *pkt) |
Returns the broadcast flag of the ACL packet passed. | |
bt_hci_con_handle_t | bt_acl_get_con_handle (struct bt_hci_pkt_acl *pkt) |
Returns the con handle the ACL packet passed was received on. | |
u_char * | bt_acl_get_data_pointer (struct bt_hci_pkt_acl *pkt) |
Returns a pointer to the payload of an ACL packet. | |
u_char | bt_acl_get_pb_flag (struct bt_hci_pkt_acl *pkt) |
Returns the fragmentation flag of the ACL packet passed. | |
Initialization | |
u_short | bt_acl_init (struct btstack *stack, u_short pkt_types) |
Initializes the ACL layer. |
#define BT_ACL_HCI_PKT_HDR_LEN 5 |
Size of the HCI packet header that gets attached to each acl packet
Note: includes the hci-type field.
#define BT_ACL_PAYLOAD_SIZE_DH1 26 |
Maximal amount of user data (in bytes) that can be sent over an ACL in a single packet using packets of type DH1.
#define BT_ACL_PAYLOAD_SIZE_DH3 183 |
Maximal amount of user data (in bytes) that can be sent over an ACL in a single packet using packets of type DH3.
#define BT_ACL_PAYLOAD_SIZE_DH5 339 |
Maximal amount of user data (in bytes) that can be sent over an ACL in a single packet using packets of type DH5.
#define BT_ACL_PAYLOAD_SIZE_DM1 16 |
Maximal amount of user data (in bytes) that can be sent over an ACL in a single packet using packets of type DM1.
#define BT_ACL_PAYLOAD_SIZE_DM3 121 |
Maximal amount of user data (in bytes) that can be sent over an ACL in a single packet using packets of type DM3.
#define BT_ACL_PAYLOAD_SIZE_DM5 224 |
Maximal amount of user data (in bytes) that can be sent over an ACL in a single packet using packets of type DM5.
long bt_acl_acquire_write_lock | ( | struct btstack * | stack, | |
bt_hci_con_handle_t | con_handle, | |||
u_char | pb_flag, | |||
u_char | bc_flag, | |||
u_short | length | |||
) |
Acquires a given baseband connection to send ACL data.
Basically, this function provides unique access to the bt uart and writes the information needed by the hci layer to send acl data over a given baseband communication link to the bt controller.
stack | The bt-stack to use | |
con_handle | Connection handle of the desired baseband connection | |
pb_flag | Packet Boundary Flag HCI_PB_FIRST_FRAGMENT or HCI_PB_CONTD_FRAGMENT | |
bc_flag | Broadcast Flag HCI_BC_UNICAST, HCI_BC_ACTIVE or HCI_BC_PICONET | |
length | Amount of ACL data to send |
u_char bt_acl_get_bc_flag | ( | struct bt_hci_pkt_acl * | pkt | ) | [inline] |
Returns the broadcast flag of the ACL packet passed.
pkt | Pointer to the received ACL packet |
bt_hci_con_handle_t bt_acl_get_con_handle | ( | struct bt_hci_pkt_acl * | pkt | ) | [inline] |
Returns the con handle the ACL packet passed was received on.
pkt | Pointer to the received ACL packet |
u_char* bt_acl_get_data_pointer | ( | struct bt_hci_pkt_acl * | pkt | ) | [inline] |
Returns a pointer to the payload of an ACL packet.
pkt | Pointer to the received ACL packet |
Returns the maximal ACL payload size.
Note: Maximal ACL payload size depends on the ACL packet types to use. This has to be defined during initialization.
stack | Pointer to the bt-stack in use |
u_char bt_acl_get_pb_flag | ( | struct bt_hci_pkt_acl * | pkt | ) | [inline] |
Returns the fragmentation flag of the ACL packet passed.
pkt | Pointer to the received ACL packet |
Returns current setting of ACL packet types to use.
Note: The ACL packet types to use has to be defined during initialization.
stack | Pointer to the bt-stack in use |
Initializes the ACL layer.
Sets the ACL packet type(s) to use and creates the first ACL buffer.
Note: When dealing with ACL data packets, this function should be called immediately after the bt-stack has been initialized! The reason for this is that setting the ACL packet types to use determines the size of the ACL buffers to be used on the receiving side.
Note: ACL packet type definition can be found in bt_hci_defs.h
stack | The bt-stack to use | |
pkt_types | ACL packet type(s) to use |
Writes ACL data to the previousely acquired baseband connection.
Use bt_acl_acquire_write_lock to get access to a desired baseband connection. Write your data, and release the connection using bt_acl_write_lock_release.
stack | Pointer to the bt-stack in use | |
data | Pointer to the data to be written | |
len | Number of bytes to be written |
long bt_acl_send_packet | ( | struct btstack * | stack, | |
bt_hci_con_handle_t | con_hdl, | |||
u_char | pb_flag, | |||
u_char | bc_flag, | |||
u_char * | data, | |||
u_short | len | |||
) |
Sends an ACL data packet.
stack | Pointer to the bt-stack to use | |
con_hdl | Connection handle of the desired baseband connection | |
pb_flag | Packet Boundary Flag HCI_PB_FIRST_FRAGMENT or HCI_PB_CONTD_FRAGMENT | |
bc_flag | Broadcast Flag HCI_BC_UNICAST, HCI_BC_ACTIVE or HCI_BC_PICONET | |
length | Amount of ACL data to send |
void bt_acl_write_lock_release | ( | struct btstack * | stack | ) | [inline] |
Releases a given baseband connection.
Call this function after you've written your data to the bt-controller using bt_acl_lowlevel_write.
stack | Pointer to the bt-stack in use |