1. STM32WB - Connection Oriented Channel
A COC allows the exchange of Bluetooth® Low Energy data at L2CAP layer without GATT layer. There is no notion of client/server, only central and peripheral.
To set a COC logical link, it is necessary to establish first a Bluetooth® Low Energy link.
Over this Bluetooth® Low Energy link, one or several COC can be established.
1.1. Bluetooth® Low Energy connection and COC establishment
1.1.1. On central side
- Initiate a Bluetooth® Low Energy link: send aci_gap_create_connection
- Wait for HCI_LE_CONNECTION_COMPLETE_EVENT
- Initiate a CoC connection: ACI_L2CAP_COC_CONNECT
- Wait for ACI_L2CAP_COC_CONNECT_CONFIRM_EVENT(get channel_index_list)
Range of channel_index_list for the COC initiator : from 0 to 0x1F
1.1.2. On peripheral side
- Start advertising: send aci_gap_set_discoverable
- Wait for HCI_LE_CONNECTION_COMPLETE_EVENT
- Wait for ACI_L2CAP_COC_CONNECT_EVENT
- Send ACI_L2CAP_COC_CONNECT_CONFIRM
- In hci_command_complete_event, get Channel_number and Channel_Index_List values
Range of channel_index_list for the COC peripheral: from 0x20 to 0x3F
1.2. COC data exchange - from peripheral to central
1.2.1. On peripheral side
Send ACI_L2CAP_COC_TX_DATA (Channel_Index, length, data)
Channel_Index_list get from hci_command_complete_event of ACI_L2CAP_COC_CONNECT_CONFIRM
1.2.2. On central side
Reception of ACI_L2CAP_COC_RX_DATA_EVENT
1.3. COC data exchange - from central to peripheral
1.3.1. On central side
Send ACI_L2CAP_COC_TX_DATA (Channel_Index, length, data)
Channel_Index get in ACI_L2CAP_COC_CONNECT_CONFIRM_EVENT
1.3.2. On peripheral side
Reception of ACI_L2CAP_COC_RX_DATA_EVENT
1.4. Example of Bluetooth® Low Energy connection, COC establishment and data exchange
Bluetooth® Low Energy and COC link establishment |
---|
COC data exchange |
---|
1.5. Code Example
A COC code example has been shared on ST hotspot [1]