HCI RAW channel
Overview
HCI RAW channel API is intended to expose HCI interface to the remote entity. The local Bluetooth controller gets owned by the remote entity and host Bluetooth stack is not used. RAW API provides direct access to packets which are sent and received by the Bluetooth HCI driver.
API Reference
- group hci_raw
HCI RAW channel.
Defines
-
BT_HCI_ERR_EXT_HANDLED
-
BT_HCI_RAW_CMD_EXT(_op, _min_len, _func)
Helper macro to define a command extension.
- Parameters:
_op – Opcode of the command.
_min_len – Minimal length of the command.
_func – Handler function to be called.
Enums
-
enum [anonymous]
Values:
-
enumerator BT_HCI_RAW_MODE_PASSTHROUGH = 0x00
Passthrough mode.
While in this mode the buffers are passed as is between the stack and the driver.
-
enumerator BT_HCI_RAW_MODE_H4 = 0x01
H:4 mode.
While in this mode H:4 headers will added into the buffers according to the buffer type when coming from the stack and will be removed and used to set the buffer type.
-
enumerator BT_HCI_RAW_MODE_PASSTHROUGH = 0x00
Functions
-
int bt_send(struct net_buf *buf)
Send packet to the Bluetooth controller.
Send packet to the Bluetooth controller. Caller needs to implement netbuf pool.
- Parameters:
buf – netbuf packet to be send
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_hci_raw_set_mode(uint8_t mode)
Set Bluetooth RAW channel mode.
Set access mode of Bluetooth RAW channel.
- Parameters:
mode – Access mode.
- Returns:
Zero on success or (negative) error code otherwise.
-
uint8_t bt_hci_raw_get_mode(void)
Get Bluetooth RAW channel mode.
Get access mode of Bluetooth RAW channel.
- Returns:
Access mode.
-
void bt_hci_raw_cmd_ext_register(struct bt_hci_raw_cmd_ext *cmds, size_t size)
Register Bluetooth RAW command extension table.
Register Bluetooth RAW channel command extension table, opcodes in this table are intercepted to sent to the handler function.
- Parameters:
cmds – Pointer to the command extension table.
size – Size of the command extension table.
-
int bt_enable_raw(struct k_fifo *rx_queue)
Enable Bluetooth RAW channel:
Enable Bluetooth RAW HCI channel.
- Parameters:
rx_queue – netbuf queue where HCI packets received from the Bluetooth controller are to be queued. The queue is defined in the caller while the available buffers pools are handled in the stack.
- Returns:
Zero on success or (negative) error code otherwise.
-
struct bt_hci_raw_cmd_ext
- #include <hci_raw.h>
Public Members
-
uint16_t op
Opcode of the command.
-
size_t min_len
Minimal length of the command.
-
uint8_t (*func)(struct net_buf *buf)
Handler function.
Handler function to be called when a command is intercepted.
- Param buf:
Buffer containing the command.
- Return:
HCI Status code or BT_HCI_ERR_EXT_HANDLED if command has been handled already and a response has been sent as oppose to BT_HCI_ERR_SUCCESS which just indicates that the command can be sent to the controller to be processed.
-
uint16_t op
-
BT_HCI_ERR_EXT_HANDLED