BLE#

This module includes the platform abstraction for BLE Host communication.

The platform needs to implement Bluetooth LE 4.2 or higher.

Modules#

otBleLinkCapabilities

otBleRadioPacket

Typedefs#

typedef struct otBleLinkCapabilities

Represent BLE link capabilities.

typedef struct otBleRadioPacket

Represents a BLE packet.

Functions#

otPlatBleEnable(otInstance *aInstance)

Enable the Bluetooth Low Energy radio.

otPlatBleDisable(otInstance *aInstance)

Disable the Bluetooth Low Energy radio.

otPlatBleGetAdvertisementBuffer(otInstance *aInstance, uint8_t **aAdvertisementBuffer)

Gets BLE Advertising buffer.

otPlatBleGapAdvSetData(otInstance *aInstance, uint8_t *aAdvertisementData, uint16_t aAdvertisementLen)

Sets BLE Advertising data.

otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval)

Starts BLE Advertising procedure.

otPlatBleGapAdvStop(otInstance *aInstance)

Stops BLE Advertising procedure.

void
otPlatBleGapOnConnected(otInstance *aInstance, uint16_t aConnectionId)

The BLE driver calls this method to notify OpenThread that a BLE Central Device has been connected.

void
otPlatBleGapOnDisconnected(otInstance *aInstance, uint16_t aConnectionId)

The BLE driver calls this method to notify OpenThread that the BLE Central Device has been disconnected.

otPlatBleGapDisconnect(otInstance *aInstance)

Disconnects BLE connection.

otPlatBleGattMtuGet(otInstance *aInstance, uint16_t *aMtu)

Reads currently use value of ATT_MTU.

void
otPlatBleGattOnMtuUpdate(otInstance *aInstance, uint16_t aMtu)

The BLE driver calls this method to notify OpenThread that ATT_MTU has been updated.

otPlatBleGattServerIndicate(otInstance *aInstance, uint16_t aHandle, const otBleRadioPacket *aPacket)

Sends ATT Handle Value Indication.

void
otPlatBleGattServerOnWriteRequest(otInstance *aInstance, uint16_t aHandle, const otBleRadioPacket *aPacket)

The BLE driver calls this method to notify OpenThread that an ATT Write Request packet has been received.

void
otPlatBleGetLinkCapabilities(otInstance *aInstance, otBleLinkCapabilities *aBleLinkCapabilities)

Function to retrieve from platform BLE link capabilities.

bool
otPlatBleSupportsMultiRadio(otInstance *aInstance)

Function to retrieve from platform multiradio support of BLE and IEEE.

Macros#

#define

Time slot duration on PHY layer in microseconds (0.625ms).

#define

Minimum allowed interval for advertising packet in OT_BLE_ADV_INTERVAL_UNIT units (20ms).

#define

Maximum allowed interval for advertising packet in OT_BLE_ADV_INTERVAL_UNIT units (10.24s).

#define

Default interval for advertising packet (ms).

#define
OT_BLE_ADV_INTERVAL_UNIT OT_BLE_TIMESLOT_UNIT

Unit used to calculate interval duration (0.625ms).

#define

Maximum allowed ATT MTU size (must be >= 23).

#define

Default power value for BLE.

#define

TOBLE service UUID.

Typedef Documentation#

otBleLinkCapabilities#

typedef struct otBleLinkCapabilities otBleLinkCapabilities

Represent BLE link capabilities.


Definition at line 113 of file include/openthread/platform/ble.h

otBleRadioPacket#

typedef struct otBleRadioPacket otBleRadioPacket

Represents a BLE packet.


Definition at line 123 of file include/openthread/platform/ble.h

Function Documentation#

otPlatBleEnable#

otError otPlatBleEnable (otInstance * aInstance)

Enable the Bluetooth Low Energy radio.

Parameters
[in]aInstance

The OpenThread instance structure.

Note

  • BLE Device should use the highest ATT_MTU supported that does not exceed OT_BLE_ATT_MTU_MAX octets.


Definition at line 140 of file include/openthread/platform/ble.h

otPlatBleDisable#

otError otPlatBleDisable (otInstance * aInstance)

Disable the Bluetooth Low Energy radio.

Parameters
[in]aInstance

The OpenThread instance structure.

When disabled, the BLE stack will flush event queues and not generate new events. The BLE peripheral is turned off or put into a low power sleep state. Any dynamic memory used by the stack should be released, but static memory may remain reserved.


Definition at line 155 of file include/openthread/platform/ble.h

otPlatBleGetAdvertisementBuffer#

otError otPlatBleGetAdvertisementBuffer (otInstance * aInstance, uint8_t ** aAdvertisementBuffer, aAdvertisementLen)

Gets BLE Advertising buffer.

Parameters
[in]aInstance

The OpenThread instance structure.

[in]aAdvertisementBuffer

The formatted TCAT advertisement frame.

[in]aAdvertisementLen

The TCAT advertisement frame length.

Note

  • This function shall be used only for BLE Peripheral role. Returned buffer should have enough space to fit max advertisement defined by specification.


Definition at line 174 of file include/openthread/platform/ble.h

otPlatBleGapAdvSetData#

otError otPlatBleGapAdvSetData (otInstance * aInstance, uint8_t * aAdvertisementData, uint16_t aAdvertisementLen)

Sets BLE Advertising data.

Parameters
[in]aInstance

The OpenThread instance structure.

[in]aAdvertisementData

The formatted TCAT advertisement frame.

[in]aAdvertisementLen

The TCAT advertisement frame length.

Note

  • This function shall be used only for BLE Peripheral role.


Definition at line 189 of file include/openthread/platform/ble.h

otPlatBleGapAdvStart#

otError otPlatBleGapAdvStart (otInstance * aInstance, uint16_t aInterval)

Starts BLE Advertising procedure.

Parameters
[in]aInstance

The OpenThread instance structure.

[in]aInterval

The interval between subsequent advertising packets in OT_BLE_ADV_INTERVAL_UNIT units. Shall be within OT_BLE_ADV_INTERVAL_MIN and OT_BLE_ADV_INTERVAL_MAX range or OT_BLE_ADV_INTERVAL_DEFAULT for a default value set at compile time.

The BLE device shall use undirected advertising with no filter applied. A single BLE Advertising packet must be sent on all advertising channels (37, 38 and 39).

Note

  • This function shall be used only for BLE Peripheral role.


Definition at line 211 of file include/openthread/platform/ble.h

otPlatBleGapAdvStop#

otError otPlatBleGapAdvStop (otInstance * aInstance)

Stops BLE Advertising procedure.

Parameters
[in]aInstance

The OpenThread instance structure.

Note

  • This function shall be used only for BLE Peripheral role.


Definition at line 223 of file include/openthread/platform/ble.h

otPlatBleGapOnConnected#

void otPlatBleGapOnConnected (otInstance * aInstance, uint16_t aConnectionId)

The BLE driver calls this method to notify OpenThread that a BLE Central Device has been connected.

Parameters
[in]aInstance

The OpenThread instance structure.

[in]aConnectionId

The identifier of the open connection.


Definition at line 232 of file include/openthread/platform/ble.h

otPlatBleGapOnDisconnected#

void otPlatBleGapOnDisconnected (otInstance * aInstance, uint16_t aConnectionId)

The BLE driver calls this method to notify OpenThread that the BLE Central Device has been disconnected.

Parameters
[in]aInstance

The OpenThread instance structure.

[in]aConnectionId

The identifier of the closed connection.


Definition at line 241 of file include/openthread/platform/ble.h

otPlatBleGapDisconnect#

otError otPlatBleGapDisconnect (otInstance * aInstance)

Disconnects BLE connection.

Parameters
[in]aInstance

The OpenThread instance structure.

The BLE device shall use the Remote User Terminated Connection (0x13) reason code when disconnecting from the peer BLE device..


Definition at line 254 of file include/openthread/platform/ble.h

otPlatBleGattMtuGet#

otError otPlatBleGattMtuGet (otInstance * aInstance, uint16_t * aMtu)

Reads currently use value of ATT_MTU.

Parameters
[in]aInstance

The OpenThread instance structure.

[out]aMtu

A pointer to output the current ATT_MTU value.


Definition at line 269 of file include/openthread/platform/ble.h

otPlatBleGattOnMtuUpdate#

void otPlatBleGattOnMtuUpdate (otInstance * aInstance, uint16_t aMtu)

The BLE driver calls this method to notify OpenThread that ATT_MTU has been updated.

Parameters
[in]aInstance

The OpenThread instance structure.

[in]aMtu

The updated ATT_MTU value.


Definition at line 277 of file include/openthread/platform/ble.h

otPlatBleGattServerIndicate#

otError otPlatBleGattServerIndicate (otInstance * aInstance, uint16_t aHandle, const otBleRadioPacket * aPacket)

Sends ATT Handle Value Indication.

Parameters
[in]aInstance

The OpenThread instance structure.

[in]aHandle

The handle of the attribute to be indicated.

[in]aPacket

A pointer to the packet contains value to be indicated.

Note

  • This function shall be used only for GATT Server.


Definition at line 297 of file include/openthread/platform/ble.h

otPlatBleGattServerOnWriteRequest#

void otPlatBleGattServerOnWriteRequest (otInstance * aInstance, uint16_t aHandle, const otBleRadioPacket * aPacket)

The BLE driver calls this method to notify OpenThread that an ATT Write Request packet has been received.

Parameters
[in]aInstance

The OpenThread instance structure.

[in]aHandle

The handle of the attribute to be written.

[in]aPacket

A pointer to the packet contains value to be written to the attribute.

Note

  • This function shall be used only for GATT Server.


Definition at line 309 of file include/openthread/platform/ble.h

otPlatBleGetLinkCapabilities#

void otPlatBleGetLinkCapabilities (otInstance * aInstance, otBleLinkCapabilities * aBleLinkCapabilities)

Function to retrieve from platform BLE link capabilities.

Parameters
[in]aInstance

The OpenThread instance structure.

[out]aBleLinkCapabilities

The pointer to retrieve the BLE ling capabilities.


Definition at line 317 of file include/openthread/platform/ble.h

otPlatBleSupportsMultiRadio#

bool otPlatBleSupportsMultiRadio (otInstance * aInstance)

Function to retrieve from platform multiradio support of BLE and IEEE.

Parameters
[in]aInstance

The OpenThread instance structure.


Definition at line 324 of file include/openthread/platform/ble.h

Macro Definition Documentation#

OT_BLE_TIMESLOT_UNIT#

#define OT_BLE_TIMESLOT_UNIT
Value:
625

Time slot duration on PHY layer in microseconds (0.625ms).


Definition at line 61 of file include/openthread/platform/ble.h

OT_BLE_ADV_INTERVAL_MIN#

#define OT_BLE_ADV_INTERVAL_MIN
Value:
0x0020

Minimum allowed interval for advertising packet in OT_BLE_ADV_INTERVAL_UNIT units (20ms).


Definition at line 67 of file include/openthread/platform/ble.h

OT_BLE_ADV_INTERVAL_MAX#

#define OT_BLE_ADV_INTERVAL_MAX
Value:
0x4000

Maximum allowed interval for advertising packet in OT_BLE_ADV_INTERVAL_UNIT units (10.24s).


Definition at line 73 of file include/openthread/platform/ble.h

OT_BLE_ADV_INTERVAL_DEFAULT#

#define OT_BLE_ADV_INTERVAL_DEFAULT
Value:
100

Default interval for advertising packet (ms).


Definition at line 79 of file include/openthread/platform/ble.h

OT_BLE_ADV_INTERVAL_UNIT#

#define OT_BLE_ADV_INTERVAL_UNIT
Value:
OT_BLE_TIMESLOT_UNIT

Unit used to calculate interval duration (0.625ms).


Definition at line 85 of file include/openthread/platform/ble.h

OT_BLE_ATT_MTU_MAX#

#define OT_BLE_ATT_MTU_MAX
Value:
67

Maximum allowed ATT MTU size (must be >= 23).


Definition at line 91 of file include/openthread/platform/ble.h

OT_BLE_DEFAULT_POWER#

#define OT_BLE_DEFAULT_POWER
Value:
0

Default power value for BLE.


Definition at line 97 of file include/openthread/platform/ble.h

OT_TOBLE_SERVICE_UUID#

#define OT_TOBLE_SERVICE_UUID
Value:
0xfffb

TOBLE service UUID.


Definition at line 103 of file include/openthread/platform/ble.h