blob: 863be7c2b1f910558c906b2cb94c9873b642056c [file] [log] [blame]
Ewout van Bekkum1c7c83f2021-08-05 11:13:44 -07001.. _module-pw_bluetooth_hci:
2
3================
4pw_bluetooth_hci
5================
6The ``pw_bluetooth_hci`` module contains utilities for using the Host Controller
7Interface as defined by the Bluetooth Core Specification version 5.3.
8
9-----------
10HCI Packets
11-----------
12This module has support to parse a the subset of the HCI packets used in the HCI
13UART Transport Layer are provided as defined in the Bluetooth Core Specification
14version 5.3 "Host Controller Interface Transport Layer" volume 4, part A,
15meaning:
16
17* HCI Command Packet: ``pw::bluetooth_hci::CommandPacket``
18
19* HCI ACL Data Packet: ``pw::bluetooth_hci::AsyncDataPacket``
20
21* HCI SCO Data Packet: ``pw::bluetooth_hci::SyncDataPacket``
22
23* HCI Event Data Packet: ``pw::bluetooth_hci::EventPacket``
24
25------------------------
26HCI UART Transport Layer
27------------------------
28
29Decoding
30========
31A decoder function is provided to parse HCI packets out of a HCI UART Transport
32Layer buffer which may contain multiple packets.
33
34 .. cpp:function:: StatusWithSize DecodeHciUartData(ConstByteSpan data, const DecodedPacketCallback& packet_callback);
35
36 Parses the HCI Packets out of a HCI UART Transport Layer buffer.
37
38 Parses as many complete HCI packets out of the provided buffer based on the
39 HCI UART Transport Layer as defined by Bluetooth Core Specification version
40 5.3 "Host Controller Interface Transport Layer" volume 4, part A.
41
42 The HciPacketCallback is invoked for each full HCI packet.
43
44 Returns the number of bytes processed and a status based on:
45
46 * OK - No invalid packet indicator found.
47 * DATA_LOSS - An invalid packet indicator was detected between packets.
48 Synchronization has been lost. The caller is responsible for
49 regaining synchronization
50
51 .. note:: The caller is responsible for detecting the lack of progress due
52 to an undersized data buffer and/or an invalid length field in case a full
53 buffer is passed and no bytes are processed.
54