Bluetooth LE OOB records
A Bluetooth® LE device that has an NFC interface (a tag or a polling device) can use NFC to send or receive data required for connecting and pairing in the Bluetooth domain. This data should be presented in the form of a Bluetooth LE pairing message.
A Bluetooth LE pairing message that works with Android devices contains one Bluetooth LE OOB record. This record contains the Bluetooth LE advertising data structure with information that is used to establish the connection and pair.
The following Bluetooth LE pairing methods can be used in combination with this module:
- Legacy and LE Secure Connections Just Works pairing
The NDEF record contains basic advertising data such as device name, address, and role. In this case, pairing over NFC does not provide MITM protection - the only advantage is automation of pairing through NFC touch.
- LE Secure Connections pairing with OOB data
The NDEF record contains two additional data types that are used for OOB authentication: Confirmation Value and Random Value. In this case, pairing MITM protection is considered as strong as the MITM protection of NFC.
For more information about NFC Connection Handover pairing methods, refer to Bluetooth Secure Simple Pairing Using NFC and the Bluetooth Core Specification Volume 3 Part H Chapter 2.
The Bluetooth LE OOB record is used in the Bluetooth: Peripheral HIDS keyboard sample.
API documentation
include/nfc/ndef/le_oob_rec.h
subsys/nfc/ndef/le_oob_rec.c
- group nfc_ndef_le_oob_rec
Generation of NFC NDEF LE OOB records for NDEF messages.
Defines
-
NFC_NDEF_LE_OOB_REC_TK_LEN
Temporary Key length.
-
NFC_NDEF_LE_OOB_REC_APPEARANCE(value)
Macro for including Appearance BLE AD Type to the nfc_ndef_le_oob_rec_payload_desc descriptor.
-
NFC_NDEF_LE_OOB_REC_FLAGS(value)
Macro for including Flags BLE AD Type to the nfc_ndef_le_oob_rec_payload_desc descriptor.
-
NFC_NDEF_LE_OOB_REC_LE_ROLE(value)
Macro for including LE Role BLE AD Type to the nfc_ndef_le_oob_rec_payload_desc descriptor.
-
NFC_NDEF_LE_OOB_RECORD_DESC_DEF(name, payload_id, payload_desc)
Generate a description of an NFC NDEF Bluetooth Carrier Configuration LE Record.
This macro declares and initializes an instance of an NFC NDEF record description for a Bluetooth Carrier Configuration LE record.
Note
The record descriptor is declared as automatic variable, which implies that the NDEF message encoding must be done in the same variable scope.
- Parameters
name – Name for accessing the record descriptor.
payload_id – NDEF record header Payload ID field (limited to one byte). If 0, no ID is present in the record description.
payload_desc – Pointer to the description of the payload. This data is used to create the record payload.
-
NFC_NDEF_LE_OOB_RECORD_DESC(NAME)
Macro for accessing the NFC NDEF Bluetooth Carrier Configuration LE record descriptor instance that was created with NFC_NDEF_LE_OOB_RECORD_DESC_DEF.
Enums
-
enum nfc_ndef_le_oob_rec_le_role
LE role options.
Values:
-
enumerator NFC_NDEF_LE_OOB_REC_LE_ROLE_PERIPH_ONLY
Only Peripheral role supported.
-
enumerator NFC_NDEF_LE_OOB_REC_LE_ROLE_CENTRAL_ONLY
Only Central role supported.
-
enumerator NFC_NDEF_LE_OOB_REC_LE_ROLE_PERIPH_PREFFERED
Peripheral and Central roles supported. Peripheral role preferred for connection establishment.
-
enumerator NFC_NDEF_LE_OOB_REC_LE_ROLE_CENTRAL_PREFFERED
Peripheral and Central roles supported. Central role preferred for connection establishment.
-
enumerator NFC_NDEF_LE_OOB_REC_LE_ROLE_OPTIONS_NUM
Total number of options.
-
enumerator NFC_NDEF_LE_OOB_REC_LE_ROLE_PERIPH_ONLY
Functions
-
int nfc_ndef_le_oob_rec_payload_constructor(const struct nfc_ndef_le_oob_rec_payload_desc *payload_desc, uint8_t *buff, uint32_t *len)
Construct the payload for a Bluetooth Carrier Configuration LE Record.
This function encodes the record payload according to the payload descriptor. It implements an API compatible with
payload_constructor_t
.- Parameters
payload_desc – Pointer to the description of the payload.
buff – Pointer to payload destination. If NULL, function will calculate the expected size of the record payload.
len – Size of available memory to write as input. Size of generated payload as output.
- Return values
0 – If the payload was encoded successfully.
-EINVAL – If parameters in the payload descriptor are invalid or missing.
-ENOMEM – If the predicted payload size is bigger than the provided buffer space.
-
struct nfc_ndef_le_oob_rec_payload_desc
- #include <le_oob_rec.h>
LE OOB record payload descriptor.
-
NFC_NDEF_LE_OOB_REC_TK_LEN