BLE Host

This module includes the platform abstraction for BLE Host communication.

Summary

The platform needs to implement Bluetooth LE 4.2 or higher.

Enumerations

anonymous enum{
  OT_BLE_ADDRESS_LENGTH = 6,
  OT_BLE_TIMESLOT_UNIT = 625,
  OT_BLE_CONN_INTERVAL_UNIT = 2 * OT_BLE_TIMESLOT_UNIT,
  OT_BLE_CONN_INTERVAL_MIN = 0x0006,
  OT_BLE_CONN_INTERVAL_MAX = 0x0C80,
  OT_BLE_CONN_SLAVE_LATENCY_MAX = 0x01F3,
  OT_BLE_CONN_SUPERVISOR_TIMEOUT_MIN = 0x000A,
  OT_BLE_CONN_SUPERVISOR_TIMEOUT_MAX = 0x0C80,
  OT_BLE_CONN_SUPERVISOR_UNIT = 16 * OT_BLE_TIMESLOT_UNIT,
  OT_BLE_DEV_NAME_MAX_LENGTH = 248,
  OT_BLE_ADV_DATA_MAX_LENGTH = 31,
  OT_BLE_SCAN_RESPONSE_MAX_LENGTH = 31,
  OT_BLE_ADV_INTERVAL_MIN = 0x0020,
  OT_BLE_ADV_INTERVAL_MAX = 0x4000,
  OT_BLE_ADV_INTERVAL_UNIT = OT_BLE_TIMESLOT_UNIT,
  OT_BLE_SCAN_INTERVAL_MIN = 0x0004,
  OT_BLE_SCAN_INTERVAL_MAX = 0x4000,
  OT_BLE_SCAN_INTERVAL_UNIT = OT_BLE_TIMESLOT_UNIT,
  OT_BLE_SCAN_WINDOW_MIN = 0x0004,
  OT_BLE_SCAN_WINDOW_MAX = 0x4000,
  OT_BLE_SCAN_WINDOW_UNIT = OT_BLE_TIMESLOT_UNIT,
  OT_BLE_HCI_REMOTE_USER_TERMINATED = 0x13,
  OT_BLE_INVALID_HANDLE = 0x0000,
  OT_BLE_CHARACTERISTIC_MAX_LENGTH = 512,
  OT_BLE_ATT_MTU_MAX = 511,
  OT_BLE_UUID_LENGTH = 16,
  OT_BLE_UUID_CCCD = 0x2902
}
enum
otPlatBleAddressType{
  OT_BLE_ADDRESS_TYPE_PUBLIC = 0,
  OT_BLE_ADDRESS_TYPE_RANDOM_STATIC = 1,
  OT_BLE_ADDRESS_TYPE_RANDOM_PRIVATE_RESOLVABLE = 2,
  OT_BLE_ADDRESS_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE = 3
}
enum
This enum represents BLE Device Address types.
otPlatBleAdvMode{
  OT_BLE_ADV_MODE_CONNECTABLE = (1 << 0),
  OT_BLE_ADV_MODE_SCANNABLE = (1 << 1)
}
enum
This enumeration defines flags for BLE advertisement mode.
otPlatBleCccdFlags{
  OT_BLE_CHAR_PROP_BROADCAST = (1 << 0),
  OT_BLE_CHAR_PROP_READ = (1 << 1),
  OT_BLE_CHAR_PROP_WRITE_NO_RESPONSE = (1 << 2),
  OT_BLE_CHAR_PROP_WRITE = (1 << 3),
  OT_BLE_CHAR_PROP_NOTIFY = (1 << 4),
  OT_BLE_CHAR_PROP_INDICATE = (1 << 5),
  OT_BLE_CHAR_PROP_AUTH_SIGNED_WRITE = (1 << 6),
  OT_BLE_CHAR_PROP_EXTENDED = (1 << 7)
}
enum
This enumeration defines the characterstic properties flags for a Client Characteristic Configuration Descriptor (CCCD).
otPlatBleL2capError{
  OT_BLE_L2C_ERROR_NONE = 0x00,
  OT_BLE_L2C_ERROR_INVALID_PSM = 0x02,
  OT_BLE_L2C_ERROR_NO_MEM = 0x04,
  OT_BLE_L2C_ERROR_INVALID_PARAMS = 0x0b
}
enum
The enum indicates the outcome of the L2CAP connection request procedure.
otPlatBleUuidType{
  OT_BLE_UUID_TYPE_NONE = 0,
  OT_BLE_UUID_TYPE_16 = 1,
  OT_BLE_UUID_TYPE_32 = 2,
  OT_BLE_UUID_TYPE_128 = 3
}
enum
This enumeration represents BLE UUID value.

Typedefs

otBleRadioPacket typedef
This structure represents an BLE packet.
otPlatBleAddressType typedef
This enum represents BLE Device Address types.
otPlatBleAdvMode typedef
This enumeration defines flags for BLE advertisement mode.
otPlatBleCccdFlags typedef
This enumeration defines the characterstic properties flags for a Client Characteristic Configuration Descriptor (CCCD).
otPlatBleDeviceAddr typedef
This structure represents BLE Device Address.
otPlatBleGapConnParams typedef
This structure represents BLE connection parameters.
otPlatBleGattCharacteristic typedef
This structure represents GATT Characteristic.
otPlatBleGattDescriptor typedef
This structure represents GATT Descriptor.
otPlatBleGattService typedef
Registration descriptor for a GATT service.
otPlatBleL2capError typedef
The enum indicates the outcome of the L2CAP connection request procedure.
otPlatBleUuid typedef
struct otPlatBleUuid
This structure represents BLE UUID.
otPlatBleUuidType typedef
This enumeration represents BLE UUID value.
otPlatBleUuidValue typedef
This structure represents BLE UUID value.

Functions

otPlatBleDisable(otInstance *aInstance)
Disable the Bluetooth Low Energy radio.
otPlatBleEnable(otInstance *aInstance)
Enable the Bluetooth Low Energy radio.
otPlatBleGapAddressGet(otInstance *aInstance, otPlatBleDeviceAddr *aAddress)
Gets Bluetooth Device Address.
otPlatBleGapAddressSet(otInstance *aInstance, const otPlatBleDeviceAddr *aAddress)
Sets Bluetooth Device Address.
otPlatBleGapAdvDataSet(otInstance *aInstance, const uint8_t *aAdvData, uint8_t aAdvDataLength)
Sets BLE Advertising packet content.
otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval, uint8_t aType)
Starts BLE Advertising procedure.
otPlatBleGapAdvStop(otInstance *aInstance)
Stops BLE Advertising procedure.
otPlatBleGapConnParamsSet(otInstance *aInstance, const otPlatBleGapConnParams *aConnParams)
Sets desired BLE Connection Parameters.
otPlatBleGapConnect(otInstance *aInstance, otPlatBleDeviceAddr *aAddress, uint16_t aInterval, uint16_t aWindow)
Starts BLE Connection procedure.
otPlatBleGapDisconnect(otInstance *aInstance)
Disconnects BLE connection.
otPlatBleGapOnAdvReceived(otInstance *aInstance, otPlatBleDeviceAddr *aAddress, otBleRadioPacket *aPacket)
void
The BLE driver calls this method to notify OpenThread that an advertisement packet has been received.
otPlatBleGapOnConnected(otInstance *aInstance, uint16_t aConnectionId)
void
The BLE driver calls this method to notify OpenThread that BLE Device has been connected.
otPlatBleGapOnDisconnected(otInstance *aInstance, uint16_t aConnectionId)
void
The BLE driver calls this method to notify OpenThread that the BLE Device has been disconnected.
otPlatBleGapOnScanRespReceived(otInstance *aInstance, otPlatBleDeviceAddr *aAddress, otBleRadioPacket *aPacket)
void
The BLE driver calls this method to notify OpenThread that a scan response packet has been received.
otPlatBleGapScanResponseSet(otInstance *aInstance, const uint8_t *aScanResponse, uint8_t aScanResponseLength)
Sets BLE Scan Response packet content.
otPlatBleGapScanStart(otInstance *aInstance, uint16_t aInterval, uint16_t aWindow)
Starts BLE Scanning procedure.
otPlatBleGapScanStop(otInstance *aInstance)
Stops BLE Scanning procedure.
otPlatBleGapServiceSet(otInstance *aInstance, const char *aDeviceName, uint16_t aAppearance)
Sets BLE device name and appearance that is visible as GATT Based service.
otPlatBleGattClientCharacteristicsDiscover(otInstance *aInstance, uint16_t aStartHandle, uint16_t aEndHandle)
Performs GATT Characteristic Discovery of a service.
otPlatBleGattClientDescriptorsDiscover(otInstance *aInstance, uint16_t aStartHandle, uint16_t aEndHandle)
Performs GATT Descriptor Discovery.
otPlatBleGattClientMtuExchangeRequest(otInstance *aInstance, uint16_t aMtu)
Sends Exchange MTU Request.
otPlatBleGattClientOnCharacteristicsDiscoverDone(otInstance *aInstance, otPlatBleGattCharacteristic *aChars, uint16_t aCount, otError aError)
void
The BLE driver calls this method to notify OpenThread that GATT Characteristic Discovery of a service has been done.
otPlatBleGattClientOnDescriptorsDiscoverDone(otInstance *aInstance, otPlatBleGattDescriptor *aDescs, uint16_t aCount, otError aError)
void
The BLE driver calls this method to notify OpenThread that GATT Descriptor Discovery has been done.
otPlatBleGattClientOnIndication(otInstance *aInstance, uint16_t aHandle, otBleRadioPacket *aPacket)
void
The BLE driver calls this method to notify OpenThread that an ATT Handle Value Indication has been received.
otPlatBleGattClientOnMtuExchangeResponse(otInstance *aInstance, uint16_t aMtu, otError aError)
void
The BLE driver calls this method to notify OpenThread that Exchange MTU Response has been received.
otPlatBleGattClientOnReadResponse(otInstance *aInstance, otBleRadioPacket *aPacket)
void
The BLE driver calls this method to notify OpenThread that ATT Read Response packet has been received.
otPlatBleGattClientOnServiceDiscovered(otInstance *aInstance, uint16_t aStartHandle, uint16_t aEndHandle, uint16_t aServiceUuid, otError aError)
void
The BLE driver calls this method to notify OpenThread that the next entry from GATT Primary Service Discovery has been found.
otPlatBleGattClientOnSubscribeResponse(otInstance *aInstance, uint16_t aHandle)
void
The BLE driver calls this method to notify OpenThread that subscribe response has been received.
otPlatBleGattClientOnWriteResponse(otInstance *aInstance, uint16_t aHandle)
void
The BLE driver calls this method to notify OpenThread that ATT Write Response packet has been received.
otPlatBleGattClientRead(otInstance *aInstance, uint16_t aHandle)
Sends ATT Read Request.
otPlatBleGattClientServiceDiscover(otInstance *aInstance, const otPlatBleUuid *aUuid)
Performs GATT Primary Service Discovery by UUID procedure of specific service.
otPlatBleGattClientServicesDiscover(otInstance *aInstance)
Performs GATT Primary Service Discovery of all services available.
otPlatBleGattClientSubscribeRequest(otInstance *aInstance, uint16_t aHandle, bool aSubscribing)
Subscribes for characteristic indications.
otPlatBleGattClientWrite(otInstance *aInstance, uint16_t aHandle, otBleRadioPacket *aPacket)
Sends ATT Write Request.
otPlatBleGattMtuGet(otInstance *aInstance, uint16_t *aMtu)
Reads currently use value of ATT_MTU.
otPlatBleGattServerIndicate(otInstance *aInstance, uint16_t aHandle, otBleRadioPacket *aPacket)
Sends ATT Handle Value Indication.
otPlatBleGattServerOnIndicationConfirmation(otInstance *aInstance, uint16_t aHandle)
void
The BLE driver calls this method to notify OpenThread that an ATT Handle Value Confirmation has been received.
otPlatBleGattServerOnReadRequest(otInstance *aInstance, uint16_t aHandle, otBleRadioPacket *aPacket)
void
The BLE driver calls this method to notify OpenThread that an ATT Read Request packet has been received.
otPlatBleGattServerOnSubscribeRequest(otInstance *aInstance, uint16_t aHandle, bool aSubscribing)
void
The BLE driver calls this method to notify OpenThread that an ATT Subscription Request packet has been received.
otPlatBleGattServerOnWriteRequest(otInstance *aInstance, uint16_t aHandle, otBleRadioPacket *aPacket)
void
The BLE driver calls this method to notify OpenThread that an ATT Write Request packet has been received.
otPlatBleGattServerServicesRegister(otInstance *aInstance, otPlatBleGattService *aServices)
Registers a list of GATT Services and their enclosed Characteristics.
otPlatBleGattVendorUuidRegister(otInstance *aInstance, const otPlatBleUuid *aUuid)
Registers vendor specific UUID Base.
otPlatBleIsEnabled(otInstance *aInstance)
bool
Check whether Bluetooth Low Energy radio is enabled or not.
otPlatBleL2capConnectionRequest(otInstance *aInstance, uint16_t aPsm, uint16_t aMtu, uint16_t *aCid)
Sends LE Credit Based Connection Request.
otPlatBleL2capConnectionResponse(otInstance *aInstance, otPlatBleL2capError aError, uint16_t aMtu, uint16_t *aCid)
Sends LE Credit Based Connection Response.
otPlatBleL2capDisconnect(otInstance *aInstance, uint16_t aLocalCid, uint16_t aPeerCid)
Sends an L2CAP Disconnection Request.
otPlatBleL2capOnConnectionRequest(otInstance *aInstance, uint16_t aPsm, uint16_t aMtu, uint16_t aPeerCid)
void
The BLE driver calls this method to notify OpenThread that an LE Credit Based Connection Request packet has been received.
otPlatBleL2capOnConnectionResponse(otInstance *aInstance, otPlatBleL2capError aError, uint16_t aMtu, uint16_t aPeerCid)
void
The BLE driver calls this method to notify OpenThread that an LE Credit Based Connection Response packet has been received.
otPlatBleL2capOnDisconnect(otInstance *aInstance, uint16_t aLocalCid, uint16_t aPeerCid)
void
The BLE driver calls this method to notify OpenThread that an L2CAP Disconnection Request has been received.
otPlatBleL2capOnSduReceived(otInstance *aInstance, uint16_t aLocalCid, uint16_t aPeerCid, otBleRadioPacket *aPacket)
void
The BLE driver calls this method to notify OpenThread that an L2CAP SDU has been received.
otPlatBleL2capOnSduSent(otInstance *aInstance)
void
The BLE driver calls this method to notify OpenThread that an L2CAP SDU has been sent.
otPlatBleL2capSduSend(otInstance *aInstance, uint16_t aLocalCid, uint16_t aPeerCid, otBleRadioPacket *aPacket)
Sends an SDU on an L2CAP channel.
otPlatBleOnEnabled(otInstance *aInstance)
void
Callback sent when Bluetooth Low Energy is ready after being enabled.
otPlatBleReset(otInstance *aInstance)
Reset the Bluetooth Low Energy subsystem.

Structs

otBleRadioPacket

This structure represents an BLE packet.

otPlatBleDeviceAddr

This structure represents BLE Device Address.

otPlatBleGapConnParams

This structure represents BLE connection parameters.

otPlatBleGattCharacteristic

This structure represents GATT Characteristic.

otPlatBleGattDescriptor

This structure represents GATT Descriptor.

otPlatBleGattService

Registration descriptor for a GATT service.

otPlatBleUuid

This structure represents BLE UUID.

Unions

otPlatBleUuidValue

This structure represents BLE UUID value.

Enumerations

anonymous enum

 anonymous enum
Properties
OT_BLE_ADDRESS_LENGTH

The size of the Bluetooth Device Address [bytes].

OT_BLE_ADV_DATA_MAX_LENGTH

Maximum length of advertising data [bytes].

OT_BLE_ADV_INTERVAL_MAX

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

OT_BLE_ADV_INTERVAL_MIN

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

OT_BLE_ADV_INTERVAL_UNIT

Unit used to calculate interval duration (0.625ms).

OT_BLE_ATT_MTU_MAX

Maximum value of ATT_MTU [bytes].

OT_BLE_CHARACTERISTIC_MAX_LENGTH

Maximum size of BLE Characteristic [bytes].

OT_BLE_CONN_INTERVAL_MAX

Maximum allowed connection interval in OT_BLE_CONN_INTERVAL_UNIT units (4s).

See v4.2 [Vol 2, Part E] page 946

OT_BLE_CONN_INTERVAL_MIN

Minimum allowed connection interval in OT_BLE_CONN_INTERVAL_UNIT units (7.5ms).

See v4.2 [Vol 2, Part E] page 946

OT_BLE_CONN_INTERVAL_UNIT

Unit used to calculate connection interval (1.25ms)

OT_BLE_CONN_SLAVE_LATENCY_MAX

Maximum allowed slave latency in units of connection events.

See v4.2 [Vol 2, Part E] page 946

OT_BLE_CONN_SUPERVISOR_TIMEOUT_MAX

Maximum allowed connection timeout (32s).

See v4.2 [Vol 2, Part E] page 946

OT_BLE_CONN_SUPERVISOR_TIMEOUT_MIN

Minimum allowed connection timeout in units of 10ms (100ms).

See v4.2 [Vol 2, Part E] page 946

OT_BLE_CONN_SUPERVISOR_UNIT

Unit used to calculate connection supervisor timeout (10ms).

OT_BLE_DEV_NAME_MAX_LENGTH

Maximum length of the device name characteristic [bytes].

OT_BLE_HCI_REMOTE_USER_TERMINATED

BLE HCI code for remote user terminated connection.

OT_BLE_INVALID_HANDLE

Value of invalid/unknown handle.

OT_BLE_SCAN_INTERVAL_MAX

Maximum allowed scan interval (10.24s).

OT_BLE_SCAN_INTERVAL_MIN

Minimum allowed scan interval (2.5ms).

OT_BLE_SCAN_INTERVAL_UNIT

Unit used to calculate scan interval duration (0.625ms).

OT_BLE_SCAN_RESPONSE_MAX_LENGTH

Maximum length of scan response data [bytes].

OT_BLE_SCAN_WINDOW_MAX

Maximum allowed scan window in OT_BLE_TIMESLOT_UNIT units (10.24s).

OT_BLE_SCAN_WINDOW_MIN

Minimum allowed scan window in OT_BLE_TIMESLOT_UNIT units (2.5ms).

OT_BLE_SCAN_WINDOW_UNIT

Unit used to calculate scan window duration (0.625ms).

OT_BLE_TIMESLOT_UNIT

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

OT_BLE_UUID_CCCD

Uuid of Client Configuration Characteristic Descriptor.

OT_BLE_UUID_LENGTH

Length of full BLE UUID in bytes.

otPlatBleAddressType

 otPlatBleAddressType

This enum represents BLE Device Address types.

Properties
OT_BLE_ADDRESS_TYPE_PUBLIC

Bluetooth public device address.

OT_BLE_ADDRESS_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE

Bluetooth random private non-resolvable address.

OT_BLE_ADDRESS_TYPE_RANDOM_PRIVATE_RESOLVABLE

Bluetooth random private resolvable address.

OT_BLE_ADDRESS_TYPE_RANDOM_STATIC

Bluetooth random static address.

otPlatBleAdvMode

 otPlatBleAdvMode

This enumeration defines flags for BLE advertisement mode.

Properties
OT_BLE_ADV_MODE_CONNECTABLE

If set, advertising device will allow connections to be initiated.

OT_BLE_ADV_MODE_SCANNABLE

If set, advertising device will respond to scan requests.

otPlatBleCccdFlags

 otPlatBleCccdFlags

This enumeration defines the characterstic properties flags for a Client Characteristic Configuration Descriptor (CCCD).

See v4.2 [Vol 3, Part G] 3.3.1.1 Characteristic Properties - Table 3.5

Properties
OT_BLE_CHAR_PROP_AUTH_SIGNED_WRITE

If set, permits signed writes to the Characteristic Value.

OT_BLE_CHAR_PROP_BROADCAST

If set, permits broadcasts of the Characteristic Value using Characteristic Configuration Descriptor.

OT_BLE_CHAR_PROP_EXTENDED

If set, additional characteristic properties are defined in the Characteristic Extended Properties Descriptor.

OT_BLE_CHAR_PROP_INDICATE

If set, permits indications of a Characteristic Value with acknowledgement.

OT_BLE_CHAR_PROP_NOTIFY

If set, permits notifications of a Characteristic Value without acknowledgement.

OT_BLE_CHAR_PROP_READ

If set, permits reads of the Characteristic Value.

OT_BLE_CHAR_PROP_WRITE

If set, permits writes of the Characteristic Value with response.

OT_BLE_CHAR_PROP_WRITE_NO_RESPONSE

If set, permit writes of the Characteristic Value without response.

otPlatBleL2capError

 otPlatBleL2capError

The enum indicates the outcome of the L2CAP connection request procedure.

See Bluetooth v5.0 | Vol 3, Part A, 4.23, Table 4.20.

Properties
OT_BLE_L2C_ERROR_INVALID_PARAMS

Connection refused – unacceptable parameters.

OT_BLE_L2C_ERROR_INVALID_PSM

Connection refused – LE_PSM not supported.

OT_BLE_L2C_ERROR_NONE

Connection successful.

OT_BLE_L2C_ERROR_NO_MEM

Connection refused – no resources available.

otPlatBleUuidType

 otPlatBleUuidType

This enumeration represents BLE UUID value.

Properties
OT_BLE_UUID_TYPE_128

UUID represented by 128-bit value.

OT_BLE_UUID_TYPE_16

UUID represented by 16-bit value.

OT_BLE_UUID_TYPE_32

UUID represented by 32-bit value.

OT_BLE_UUID_TYPE_NONE

UUID uninitialized value.

Typedefs

otBleRadioPacket

struct otBleRadioPacket otBleRadioPacket

This structure represents an BLE packet.

otPlatBleAddressType

enum otPlatBleAddressType otPlatBleAddressType

This enum represents BLE Device Address types.

otPlatBleAdvMode

enum otPlatBleAdvMode otPlatBleAdvMode

This enumeration defines flags for BLE advertisement mode.

otPlatBleCccdFlags

enum otPlatBleCccdFlags otPlatBleCccdFlags

This enumeration defines the characterstic properties flags for a Client Characteristic Configuration Descriptor (CCCD).

See v4.2 [Vol 3, Part G] 3.3.1.1 Characteristic Properties - Table 3.5

otPlatBleDeviceAddr

struct otPlatBleDeviceAddr otPlatBleDeviceAddr

This structure represents BLE Device Address.

otPlatBleGapConnParams

struct otPlatBleGapConnParams otPlatBleGapConnParams

This structure represents BLE connection parameters.

otPlatBleGattCharacteristic

struct otPlatBleGattCharacteristic otPlatBleGattCharacteristic

This structure represents GATT Characteristic.

otPlatBleGattDescriptor

struct otPlatBleGattDescriptor otPlatBleGattDescriptor

This structure represents GATT Descriptor.

otPlatBleGattService

struct otPlatBleGattService otPlatBleGattService

Registration descriptor for a GATT service.

otPlatBleL2capError

enum otPlatBleL2capError otPlatBleL2capError

The enum indicates the outcome of the L2CAP connection request procedure.

See Bluetooth v5.0 | Vol 3, Part A, 4.23, Table 4.20.

otPlatBleUuid

struct otPlatBleUuid otPlatBleUuid

This structure represents BLE UUID.

otPlatBleUuidType

enum otPlatBleUuidType otPlatBleUuidType

This enumeration represents BLE UUID value.

otPlatBleUuidValue

union otPlatBleUuidValue otPlatBleUuidValue

This structure represents BLE UUID value.

Functions

otPlatBleDisable

otError otPlatBleDisable(
  otInstance *aInstance
)

Disable the Bluetooth Low Energy radio.

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.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
OT_ERROR_NONE
Successfully transitioned to disabled.
OT_ERROR_FAILED
The BLE radio could not be disabled.

otPlatBleEnable

otError otPlatBleEnable(
  otInstance *aInstance
)

Enable the Bluetooth Low Energy radio.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
OT_ERROR_NONE
Successfully enabled.
OT_ERROR_FAILED
The BLE radio could not be enabled.

otPlatBleGapAddressGet

otError otPlatBleGapAddressGet(
  otInstance *aInstance,
  otPlatBleDeviceAddr *aAddress
)

Gets Bluetooth Device Address.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[out] aAddress
The pointer to Bluetooth Device Address.
Return Values
OT_ERROR_NONE
Request has been successfully done.
OT_ERROR_INVALID_ARGS
Invalid parameters has been supplied.

otPlatBleGapAddressSet

otError otPlatBleGapAddressSet(
  otInstance *aInstance,
  const otPlatBleDeviceAddr *aAddress
)

Sets Bluetooth Device Address.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aAddress
The pointer to Bluetooth Device Address.
Return Values
OT_ERROR_NONE
Request has been successfully done.
OT_ERROR_INVALID_ARGS
Invalid parameters has been supplied.

otPlatBleGapAdvDataSet

otError otPlatBleGapAdvDataSet(
  otInstance *aInstance,
  const uint8_t *aAdvData,
  uint8_t aAdvDataLength
)

Sets BLE Advertising packet content.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aAdvData
A pointer to advertising data content in raw format.
[in] aAdvDataLength
The size of advertising data. Shall not exceed OT_BLE_ADV_DATA_MAX_LENGTH.
Return Values
OT_ERROR_NONE
Advertising data has been successfully set.
OT_ERROR_INVALID_ARGS
Invalid advertising data has been supplied.

otPlatBleGapAdvStart

otError otPlatBleGapAdvStart(
  otInstance *aInstance,
  uint16_t aInterval,
  uint8_t aType
)

Starts BLE Advertising procedure.

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).

Details
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.
[in] aType
The advertisement properties as a bitmask: whether it is connectable | scannable.
Return Values
OT_ERROR_NONE
Advertising procedure has been started.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.
OT_ERROR_INVALID_ARGS
Invalid interval value has been supplied.

otPlatBleGapAdvStop

otError otPlatBleGapAdvStop(
  otInstance *aInstance
)

Stops BLE Advertising procedure.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
OT_ERROR_NONE
Advertising procedure has been stopped.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.

otPlatBleGapConnParamsSet

otError otPlatBleGapConnParamsSet(
  otInstance *aInstance,
  const otPlatBleGapConnParams *aConnParams
)

Sets desired BLE Connection Parameters.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aConnParams
A pointer to connection parameters structure.
Return Values
OT_ERROR_NONE
Connection parameters have been successfully set.
OT_ERROR_INVALID_ARGS
Invalid connection parameters have been supplied.

otPlatBleGapConnect

otError otPlatBleGapConnect(
  otInstance *aInstance,
  otPlatBleDeviceAddr *aAddress,
  uint16_t aInterval,
  uint16_t aWindow
)

Starts BLE Connection procedure.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aAddress
An address of the advertising device.
[in] aInterval
The scanning interval in OT_BLE_SCAN_INTERVAL_UNIT units. Shall be in OT_BLE_SCAN_INTERVAL_MIN and OT_BLE_SCAN_INTERVAL_MAX range.
[in] aWindow
The scanning window in OT_BLE_SCAN_WINDOW_UNIT units. Shall be in OT_BLE_SCAN_WINDOW_MIN and OT_BLE_SCAN_WINDOW_MAX range.
Return Values
OT_ERROR_NONE
Connection procedure has been started.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.
OT_ERROR_INVALID_ARGS
Invalid address, interval or window value has been supplied.

otPlatBleGapDisconnect

otError otPlatBleGapDisconnect(
  otInstance *aInstance
)

Disconnects BLE connection.

The BLE device shall indicate the OT_BLE_HCI_REMOTE_USER_TERMINATED HCI code reason.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
OT_ERROR_NONE
Disconnection procedure has been started.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.

otPlatBleGapOnAdvReceived

void otPlatBleGapOnAdvReceived(
  otInstance *aInstance,
  otPlatBleDeviceAddr *aAddress,
  otBleRadioPacket *aPacket
)

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

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aAddress
An address of the advertising device.
[in] aPacket
A pointer to the received packet.

otPlatBleGapOnConnected

void otPlatBleGapOnConnected(
  otInstance *aInstance,
  uint16_t aConnectionId
)

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

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aConnectionId
The identifier of the open connection.

otPlatBleGapOnDisconnected

void otPlatBleGapOnDisconnected(
  otInstance *aInstance,
  uint16_t aConnectionId
)

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

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aConnectionId
The identifier of the closed connection.

otPlatBleGapOnScanRespReceived

void otPlatBleGapOnScanRespReceived(
  otInstance *aInstance,
  otPlatBleDeviceAddr *aAddress,
  otBleRadioPacket *aPacket
)

The BLE driver calls this method to notify OpenThread that a scan response packet has been received.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aAddress
An address of the advertising device.
[in] aPacket
A pointer to the received packet.

otPlatBleGapScanResponseSet

otError otPlatBleGapScanResponseSet(
  otInstance *aInstance,
  const uint8_t *aScanResponse,
  uint8_t aScanResponseLength
)

Sets BLE Scan Response packet content.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aScanResponse
A pointer to scan response data in raw format.
[in] aScanResponseLength
The size of scan response data. Shall not exceed OT_BLE_SCAN_RESPONSE_MAX_LENGTH.
Return Values
OT_ERROR_NONE
Scan response data has been successfully set.
OT_ERROR_INVALID_ARGS
Invalid scan response data has been supplied.

otPlatBleGapScanStart

otError otPlatBleGapScanStart(
  otInstance *aInstance,
  uint16_t aInterval,
  uint16_t aWindow
)

Starts BLE Scanning procedure.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aInterval
The scanning interval in OT_BLE_SCAN_INTERVAL_UNIT units. Shall be in OT_BLE_SCAN_INTERVAL_MIN and OT_BLE_SCAN_INTERVAL_MAX range.
[in] aWindow
The scanning window in OT_BLE_SCAN_WINDOW_UNIT units. Shall be in OT_BLE_SCAN_WINDOW_MIN and OT_BLE_SCAN_WINDOW_MAX range.
Return Values
OT_ERROR_NONE
Scanning procedure has been started.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.
OT_ERROR_INVALID_ARGS
Invalid interval or window value has been supplied.

otPlatBleGapScanStop

otError otPlatBleGapScanStop(
  otInstance *aInstance
)

Stops BLE Scanning procedure.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
OT_ERROR_NONE
Scanning procedure has been stopped.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.

otPlatBleGapServiceSet

otError otPlatBleGapServiceSet(
  otInstance *aInstance,
  const char *aDeviceName,
  uint16_t aAppearance
)

Sets BLE device name and appearance that is visible as GATT Based service.

The BLE Host stack should set the security mode 1, level 1 (no security) for those characteristics.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aDeviceName
A pointer to device name string (null terminated). Shall not exceed OT_BLE_DEV_NAME_MAX_LENGTH.
[in] aAppearance
The value of appearance characteristic.
Return Values
OT_ERROR_NONE
Connection parameters have been successfully set.
OT_ERROR_INVALID_ARGS
Invalid parameters has been supplied.

otPlatBleGattClientCharacteristicsDiscover

otError otPlatBleGattClientCharacteristicsDiscover(
  otInstance *aInstance,
  uint16_t aStartHandle,
  uint16_t aEndHandle
)

Performs GATT Characteristic Discovery of a service.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aStartHandle
The start handle of a service.
[in] aEndHandle
The end handle of a service.
Return Values
OT_ERROR_NONE
Characteristic Discovery procedure has been started.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.
OT_ERROR_INVALID_ARGS
Invalid start or end handle has been provided.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleGattClientDescriptorsDiscover

otError otPlatBleGattClientDescriptorsDiscover(
  otInstance *aInstance,
  uint16_t aStartHandle,
  uint16_t aEndHandle
)

Performs GATT Descriptor Discovery.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aStartHandle
The start handle.
[in] aEndHandle
The end handle.
Return Values
OT_ERROR_NONE
Descriptor Discovery procedure has been started.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.
OT_ERROR_INVALID_ARGS
Invalid start or end handle has been provided.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleGattClientMtuExchangeRequest

otError otPlatBleGattClientMtuExchangeRequest(
  otInstance *aInstance,
  uint16_t aMtu
)

Sends Exchange MTU Request.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aMtu
A value of GATT Client receive MTU size.
Return Values
OT_ERROR_NONE
Exchange MTU Request has been sent.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.
OT_ERROR_INVALID_ARGS
Invalid aMtu has been provided.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleGattClientOnCharacteristicsDiscoverDone

void otPlatBleGattClientOnCharacteristicsDiscoverDone(
  otInstance *aInstance,
  otPlatBleGattCharacteristic *aChars,
  uint16_t aCount,
  otError aError
)

The BLE driver calls this method to notify OpenThread that GATT Characteristic Discovery of a service has been done.

In case of success, all elements inside aChars should have a valid mHandleValue value.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aChars
A pointer to discovered characteristic list.
[in] aCount
Number of characteristics in aChar list.
[in] aError
The value of OT_ERROR_NONE indicates that at least one characteristic has been found and the total number of them is stored in aCount. OT_ERROR_NOT_FOUND error should be set if no charactertistics are found. Otherwise error indicates the reason of failure is used.

otPlatBleGattClientOnDescriptorsDiscoverDone

void otPlatBleGattClientOnDescriptorsDiscoverDone(
  otInstance *aInstance,
  otPlatBleGattDescriptor *aDescs,
  uint16_t aCount,
  otError aError
)

The BLE driver calls this method to notify OpenThread that GATT Descriptor Discovery has been done.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aDescs
A pointer to discovered descriptor list.
[in] aCount
Number of descriptors in aDescs list.
[in] aError
The value of OT_ERROR_NONE indicates that at least one descriptor has been found and the total number of them is stored in aCount. OT_ERROR_NOT_FOUND error should be set if no descriptors are found. Otherwise error indicates the reason of failure is used.

otPlatBleGattClientOnIndication

void otPlatBleGattClientOnIndication(
  otInstance *aInstance,
  uint16_t aHandle,
  otBleRadioPacket *aPacket
)

The BLE driver calls this method to notify OpenThread that an ATT Handle Value Indication has been received.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aHandle
The handle on which ATT Handle Value Indication has been sent.
[in] aPacket
A pointer to the packet contains indicated value.

otPlatBleGattClientOnMtuExchangeResponse

void otPlatBleGattClientOnMtuExchangeResponse(
  otInstance *aInstance,
  uint16_t aMtu,
  otError aError
)

The BLE driver calls this method to notify OpenThread that Exchange MTU Response has been received.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aMtu
Attribute server receive MTU size.
[in] aError
The value of OT_ERROR_NONE indicates that valid Exchange MTU Response has been received. Otherwise error indicates the reason of failure is used.

otPlatBleGattClientOnReadResponse

void otPlatBleGattClientOnReadResponse(
  otInstance *aInstance,
  otBleRadioPacket *aPacket
)

The BLE driver calls this method to notify OpenThread that ATT Read Response packet has been received.

This method is called only if otPlatBleGattClientRead was previously requested.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aPacket
A pointer to the packet contains read value.

otPlatBleGattClientOnServiceDiscovered

void otPlatBleGattClientOnServiceDiscovered(
  otInstance *aInstance,
  uint16_t aStartHandle,
  uint16_t aEndHandle,
  uint16_t aServiceUuid,
  otError aError
)

The BLE driver calls this method to notify OpenThread that the next entry from GATT Primary Service Discovery has been found.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aStartHandle
The start handle of a service.
[in] aEndHandle
The end handle of a service.
[in] aServiceUuid
The Uuid16 for the service entry.
[in] aError
The value of OT_ERROR_NONE indicates that service has been found and structure aStartHandle and aEndHandle contain valid handles. OT_ERROR_NOT_FOUND error should be set if service has not been found. Otherwise error indicates the reason of failure is used.

otPlatBleGattClientOnSubscribeResponse

void otPlatBleGattClientOnSubscribeResponse(
  otInstance *aInstance,
  uint16_t aHandle
)

The BLE driver calls this method to notify OpenThread that subscribe response has been received.

This method is called only if otPlatBleGattClienSubscribe was previously requested.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aHandle
The handle on which ATT Write Response has been sent.

otPlatBleGattClientOnWriteResponse

void otPlatBleGattClientOnWriteResponse(
  otInstance *aInstance,
  uint16_t aHandle
)

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

This method is called only if otPlatBleGattClientWrite was previously requested.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aHandle
The handle on which ATT Write Response has been sent.

otPlatBleGattClientRead

otError otPlatBleGattClientRead(
  otInstance *aInstance,
  uint16_t aHandle
)

Sends ATT Read Request.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aHandle
The handle of the attribute to be read.
Return Values
OT_ERROR_NONE
ATT Write Request has been sent.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.
OT_ERROR_INVALID_ARGS
Invalid handle value has been supplied.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleGattClientServiceDiscover

otError otPlatBleGattClientServiceDiscover(
  otInstance *aInstance,
  const otPlatBleUuid *aUuid
)

Performs GATT Primary Service Discovery by UUID procedure of specific service.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aUuid
The UUID of a service to be registered.
Return Values
OT_ERROR_NONE
Service Discovery procedure has been started.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.
OT_ERROR_INVALID_ARGS
Invalid service UUID has been provided.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleGattClientServicesDiscover

otError otPlatBleGattClientServicesDiscover(
  otInstance *aInstance
)

Performs GATT Primary Service Discovery of all services available.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
OT_ERROR_NONE
Service Discovery procedure has been started.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.
OT_ERROR_INVALID_ARGS
Invalid service UUID has been provided.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleGattClientSubscribeRequest

otError otPlatBleGattClientSubscribeRequest(
  otInstance *aInstance,
  uint16_t aHandle,
  bool aSubscribing
)

Subscribes for characteristic indications.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aHandle
The handle of the attribute to be written.
[in] aSubscribing
True if subscribing, otherwise unsubscribing.
Return Values
OT_ERROR_NONE
Subscription has been sent.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.
OT_ERROR_INVALID_ARGS
Invalid handle value, data or data length has been supplied.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleGattClientWrite

otError otPlatBleGattClientWrite(
  otInstance *aInstance,
  uint16_t aHandle,
  otBleRadioPacket *aPacket
)

Sends ATT Write Request.

Details
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.
Return Values
OT_ERROR_NONE
ATT Write Request has been sent.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.
OT_ERROR_INVALID_ARGS
Invalid handle value, data or data length has been supplied.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleGattMtuGet

otError otPlatBleGattMtuGet(
  otInstance *aInstance,
  uint16_t *aMtu
)

Reads currently use value of ATT_MTU.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[out] aMtu
A pointer contains current ATT_MTU value.
Return Values
OT_ERROR_NONE
ATT_MTU value has been placed in aMtu.
OT_ERROR_FAILED
BLE Device cannot determine its ATT_MTU.

otPlatBleGattServerIndicate

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

Sends ATT Handle Value Indication.

Details
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.
Return Values
OT_ERROR_NONE
ATT Handle Value Indication has been sent.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.
OT_ERROR_INVALID_ARGS
Invalid handle value, data or data length has been supplied.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleGattServerOnIndicationConfirmation

void otPlatBleGattServerOnIndicationConfirmation(
  otInstance *aInstance,
  uint16_t aHandle
)

The BLE driver calls this method to notify OpenThread that an ATT Handle Value Confirmation has been received.

This method is called only if otPlatBleGattServerIndicate was previously requested.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aHandle
The handle on which ATT Handle Value Confirmation has been sent.

otPlatBleGattServerOnReadRequest

void otPlatBleGattServerOnReadRequest(
  otInstance *aInstance,
  uint16_t aHandle,
  otBleRadioPacket *aPacket
)

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

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aHandle
The handle of the attribute to be read.
[out] aPacket
A pointer to the packet to be filled with pointers to attribute data to be read.

otPlatBleGattServerOnSubscribeRequest

void otPlatBleGattServerOnSubscribeRequest(
  otInstance *aInstance,
  uint16_t aHandle,
  bool aSubscribing
)

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

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aHandle
The handle of the attribute to be written.
[in] aSubscribing
True if subscribing, otherwise unsubscribing.

otPlatBleGattServerOnWriteRequest

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

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

Details
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.

otPlatBleGattServerServicesRegister

otError otPlatBleGattServerServicesRegister(
  otInstance *aInstance,
  otPlatBleGattService *aServices
)

Registers a list of GATT Services and their enclosed Characteristics.

The generated handles will be written back into this structure when the BLE stack is enabled.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aServices
Null terminated array of service structures to register.
Return Values
OT_ERROR_NONE
Service has been successfully registered.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state.
OT_ERROR_INVALID_ARGS
Invalid service UUID has been provided.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleGattVendorUuidRegister

otError otPlatBleGattVendorUuidRegister(
  otInstance *aInstance,
  const otPlatBleUuid *aUuid
)

Registers vendor specific UUID Base.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aUuid
A pointer to vendor specific 128-bit UUID Base.

otPlatBleIsEnabled

bool otPlatBleIsEnabled(
  otInstance *aInstance
)

Check whether Bluetooth Low Energy radio is enabled or not.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
::true
Bluetooth Low Energy radio is enabled.
::false
Bluetooth Low Energy radio is disabled.

otPlatBleL2capConnectionRequest

otError otPlatBleL2capConnectionRequest(
  otInstance *aInstance,
  uint16_t aPsm,
  uint16_t aMtu,
  uint16_t *aCid
)

Sends LE Credit Based Connection Request.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aPsm
The value of LE Protocol/Service Multiplexer.
[in] aMtu
The value specifies the maximum SDU size (in octets) that the L2CAP layer entity sending the LE Credit Based Connection Request can receive on this channel.
[out] aCid
The source CID represents a channel endpoint on the device.
Return Values
OT_ERROR_NONE
LE Credit Based Connection Request has been sent.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state e.g. not in the GAP connection.
OT_ERROR_INVALID_ARGS
Invalid parameters has been supplied.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleL2capConnectionResponse

otError otPlatBleL2capConnectionResponse(
  otInstance *aInstance,
  otPlatBleL2capError aError,
  uint16_t aMtu,
  uint16_t *aCid
)

Sends LE Credit Based Connection Response.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aError
The error value indicates the outcome of the connection request.
[in] aMtu
The value specifies the maximum SDU size (in octets) that the L2CAP layer entity sending the LE Credit Based Connection Response can receive on this channel.
[out] aCid
The source CID represents a channel endpoint on the device. If aResult value is different from OT_BLE_L2C_ERROR_NONE, this variable is unused and should be set to NULL.
Return Values
OT_ERROR_NONE
LE Credit Based Connection Response has been sent.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state e.g. not in the GAP connection.
OT_ERROR_INVALID_ARGS
Invalid parameters has been supplied.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleL2capDisconnect

otError otPlatBleL2capDisconnect(
  otInstance *aInstance,
  uint16_t aLocalCid,
  uint16_t aPeerCid
)

Sends an L2CAP Disconnection Request.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aLocalCid
The local channel endpoint ID value.
[in] aPeerCid
The peer channel endpoint ID value.
Return Values
OT_ERROR_NONE
L2CAP Disconnection Request has been sent.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state e.g. not in the GAP connection.
OT_ERROR_INVALID_ARGS
Invalid parameters has been supplied.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleL2capOnConnectionRequest

void otPlatBleL2capOnConnectionRequest(
  otInstance *aInstance,
  uint16_t aPsm,
  uint16_t aMtu,
  uint16_t aPeerCid
)

The BLE driver calls this method to notify OpenThread that an LE Credit Based Connection Request packet has been received.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aPsm
The value of LE Protocol/Service Multiplexer.
[in] aMtu
The value specifies the maximum SDU size (in octets) that the L2CAP layer entity sending the LE Credit Based Connection Request can receive on this channel.
[in] aPeerCid
The CID represents a channel endpoint on the peer device.

otPlatBleL2capOnConnectionResponse

void otPlatBleL2capOnConnectionResponse(
  otInstance *aInstance,
  otPlatBleL2capError aError,
  uint16_t aMtu,
  uint16_t aPeerCid
)

The BLE driver calls this method to notify OpenThread that an LE Credit Based Connection Response packet has been received.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aError
The error value indicates the outcome of the connection request.
[in] aMtu
The value specifies the maximum SDU size (in octets) that the L2CAP layer entity sending the LE Credit Based Connection Response can receive on this channel.
[in] aPeerCid
The CID represents a channel endpoint on the peer device.

otPlatBleL2capOnDisconnect

void otPlatBleL2capOnDisconnect(
  otInstance *aInstance,
  uint16_t aLocalCid,
  uint16_t aPeerCid
)

The BLE driver calls this method to notify OpenThread that an L2CAP Disconnection Request has been received.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aLocalCid
The local channel endpoint ID value.
[in] aPeerCid
The peer channel endpoint ID value.

otPlatBleL2capOnSduReceived

void otPlatBleL2capOnSduReceived(
  otInstance *aInstance,
  uint16_t aLocalCid,
  uint16_t aPeerCid,
  otBleRadioPacket *aPacket
)

The BLE driver calls this method to notify OpenThread that an L2CAP SDU has been received.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aLocalCid
The local channel endpoint ID value.
[in] aPeerCid
The peer channel endpoint ID value.
[in] aPacket
A pointer to the packet containing SDU.

otPlatBleL2capOnSduSent

void otPlatBleL2capOnSduSent(
  otInstance *aInstance
)

The BLE driver calls this method to notify OpenThread that an L2CAP SDU has been sent.

Details
Parameters
[in] aInstance
The OpenThread instance structure.

otPlatBleL2capSduSend

otError otPlatBleL2capSduSend(
  otInstance *aInstance,
  uint16_t aLocalCid,
  uint16_t aPeerCid,
  otBleRadioPacket *aPacket
)

Sends an SDU on an L2CAP channel.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aLocalCid
The local channel endpoint ID value.
[in] aPeerCid
The peer channel endpoint ID value.
[in] aPacket
A pointer to the packet containing SDU.
Return Values
OT_ERROR_NONE
LE Credit Based Connection Request has been sent.
OT_ERROR_INVALID_STATE
BLE Device is in invalid state e.g. not in the GAP connection.
OT_ERROR_INVALID_ARGS
Invalid parameters has been supplied.
OT_ERROR_NO_BUFS
No available internal buffer found.

otPlatBleOnEnabled

void otPlatBleOnEnabled(
  otInstance *aInstance
)

Callback sent when Bluetooth Low Energy is ready after being enabled.

Details
Parameters
[in] aInstance
The OpenThread instance structure.

otPlatBleReset

otError otPlatBleReset(
  otInstance *aInstance
)

Reset the Bluetooth Low Energy subsystem.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
OT_ERROR_NONE
Successfully reset.
OT_ERROR_FAILED
The BLE stack could not be reset.

Macros

OT_BLE_MS_TO_TICKS

 OT_BLE_MS_TO_TICKS (((x)*1000) / OT_BLE_ADV_INTERVAL_UNIT)

Convert the advertising interval from [ms] to [ble symbol times].