|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
Functions | |
| bool | findManufacturerData (const uint8_t *advData, uint8_t len, uint16_t *companyId, const uint8_t **data, uint8_t *dataLen) |
| Extracts manufacturer-specific AD payload and company identifier. | |
| bool | findServiceUuid128 (const uint8_t *advData, uint8_t len, const uint8_t uuid128[16]) |
| Checks whether a specific 128-bit service UUID is present in AD structures. | |
| bool | findName (const uint8_t *advData, uint8_t len, char *name, uint8_t nameMaxLen) |
| Extracts local device name from advertising data. | |
| template<typename Callback> | |
| static bool | walkAdStructures (const uint8_t *advData, uint8_t len, Callback callback) |
| Iterates over AD structures and invokes a callback for each structure. | |
Variables | |
| static constexpr uint8_t | AD_TYPE_SHORTENED_NAME = 0x08 |
| AD type constants from BLE Core Spec Supplement, Part A. | |
| static constexpr uint8_t | AD_TYPE_COMPLETE_NAME = 0x09 |
| static constexpr uint8_t | AD_TYPE_INCOMPLETE_UUID128 = 0x06 |
| static constexpr uint8_t | AD_TYPE_COMPLETE_UUID128 = 0x07 |
| static constexpr uint8_t | AD_TYPE_MANUFACTURER_SPECIFIC = 0xFF |
| static constexpr uint8_t | UUID128_SIZE = 16 |
| static constexpr uint8_t | COMPANY_ID_SIZE = 2 |
Stack-independent BLE advertising data parser. Parses raw AD structures per BLE Core Spec Vol 3, Part C, Section 11.
BLE Advertising Data Parser
Parses raw AD structures per BLE Core Spec Vol 3, Part C, Section 11. Each AD structure: [length][type][data...]
| bool cdc::hal::BleAdvParser::findManufacturerData | ( | const uint8_t * | advData, |
| uint8_t | len, | ||
| uint16_t * | companyId, | ||
| const uint8_t ** | data, | ||
| uint8_t * | dataLen ) |
Extracts manufacturer-specific AD payload and company identifier.
Find manufacturer-specific data in advertising data
| advData | Raw advertising data buffer. |
| len | Buffer length. |
| companyId | Output company identifier. |
| data | Output pointer to manufacturer payload bytes (after company ID). |
| dataLen | Output payload length. |
Definition at line 81 of file BleAdvParser.cpp.
References AD_TYPE_MANUFACTURER_SPECIFIC, COMPANY_ID_SIZE, and walkAdStructures().
| bool cdc::hal::BleAdvParser::findName | ( | const uint8_t * | advData, |
| uint8_t | len, | ||
| char * | name, | ||
| uint8_t | nameMaxLen ) |
Extracts local device name from advertising data.
Extract device name from advertising data
| advData | Raw advertising data buffer. |
| len | Buffer length. |
| name | Output buffer for the parsed name. |
| nameMaxLen | Size of name. |
Definition at line 150 of file BleAdvParser.cpp.
References AD_TYPE_COMPLETE_NAME, AD_TYPE_SHORTENED_NAME, name, and walkAdStructures().
| bool cdc::hal::BleAdvParser::findServiceUuid128 | ( | const uint8_t * | advData, |
| uint8_t | len, | ||
| const uint8_t | uuid128[16] ) |
Checks whether a specific 128-bit service UUID is present in AD structures.
Check if a 128-bit service UUID is advertised
| advData | Raw advertising data buffer. |
| len | Buffer length. |
| uuid128 | Target 128-bit UUID bytes. |
Definition at line 115 of file BleAdvParser.cpp.
References AD_TYPE_COMPLETE_UUID128, AD_TYPE_INCOMPLETE_UUID128, UUID128_SIZE, and walkAdStructures().
|
static |
Iterates over AD structures and invokes a callback for each structure.
Stops early when the callback reports a match.
| advData | Raw advertising data buffer. |
| len | Total length of advData. |
| callback | Callback receiving (adType, adPayload, adPayloadLen). |
Definition at line 38 of file BleAdvParser.cpp.
Referenced by findManufacturerData(), findName(), and findServiceUuid128().
|
staticconstexpr |
Definition at line 20 of file BleAdvParser.cpp.
Referenced by findName().
|
staticconstexpr |
Definition at line 22 of file BleAdvParser.cpp.
Referenced by findServiceUuid128().
|
staticconstexpr |
Definition at line 21 of file BleAdvParser.cpp.
Referenced by findServiceUuid128().
|
staticconstexpr |
Definition at line 23 of file BleAdvParser.cpp.
Referenced by findManufacturerData().
|
staticconstexpr |
AD type constants from BLE Core Spec Supplement, Part A.
Definition at line 19 of file BleAdvParser.cpp.
Referenced by findName().
|
staticconstexpr |
Definition at line 26 of file BleAdvParser.cpp.
Referenced by findManufacturerData().
|
staticconstexpr |
Definition at line 25 of file BleAdvParser.cpp.
Referenced by findServiceUuid128().