|
PebbleOS
|
Error codes, addresses, devices and advertising data shared by the Bluetooth API. More...
Data Structures | |
| struct | pbl_bt_addr |
| Bluetooth device address. More... | |
| struct | pbl_bt_device |
| Remote Bluetooth device, as exposed to applications. More... | |
| struct | pbl_bt_device_internal |
| Remote Bluetooth device: its address and address type. More... | |
| struct | pbl_bt_ad_data |
| Advertising data and scan response data. More... | |
| union | pbl_bt_device.__unnamed7__ |
| union | pbl_bt_device_internal.__unnamed9__ |
| struct | pbl_bt_device_internal.__unnamed9__.__unnamed11__ |
Macros | |
| #define | PBL_BT_ERRNO_WITH_INTERNAL_ERROR(e) ((int)PBL_BT_ERRNO_INTERNAL_ERROR_BEGIN - e) |
| Map a legacy stack error to enum pbl_bt_errno. | |
| #define | PBL_BT_ERRNO_WITH_HCI_ERROR(e) ((int)PBL_BT_ERRNO_HCI_ERROR_BEGIN + e) |
| Map an HCI error to enum pbl_bt_errno. | |
| #define | PBL_BT_SERVICE_INVALID ((pbl_bt_service_t)0) |
| Invalid service reference. | |
| #define | PBL_BT_CHARACTERISTIC_INVALID ((pbl_bt_characteristic_t)0) |
| Invalid characteristic reference. | |
| #define | PBL_BT_DESCRIPTOR_INVALID ((pbl_bt_descriptor_t)0) |
| Invalid descriptor reference. | |
| #define | PBL_BT_BONDING_ID_INVALID (0xFFU) |
| Invalid bonding identifier. | |
| #define | PBL_BT_CCCD_ID_INVALID (0xFFU) |
| Invalid CCCD entry identifier. | |
| #define | PBL_BT_ADDR_SIZE (sizeof(struct pbl_bt_addr)) |
| Size of a struct pbl_bt_addr in bytes. | |
| #define | PBL_BT_ADDR_FMT "%02X:%02X:%02X:%02X:%02X:%02X" |
printf() format of an address, as XX:XX:XX:XX:XX:XX. | |
| #define | PBL_BT_ADDR_FMT_BUFFER_SIZE (18) |
| Buffer size for an address printed with PBL_BT_ADDR_FMT, including the terminator. | |
| #define | PBL_BT_BD_ADDR_FMT "0x%02X%02X%02X%02X%02X%02X" |
printf() format of an address, as 0xXXXXXXXXXXXX. | |
| #define | PBL_BT_BD_ADDR_FMT_BUFFER_SIZE (15) |
| Buffer size for an address printed with PBL_BT_BD_ADDR_FMT, including the terminator. | |
| #define | PBL_BT_DEVICE_NAME_BUFFER_SIZE (20) |
| Buffer size of a device name, including the terminator. | |
| #define | PBL_BT_ADDR_XPLODE(a) (a).octets[5], (a).octets[4], (a).octets[3], (a).octets[2], (a).octets[1], (a).octets[0] |
| Expand an address into the printf() arguments of PBL_BT_ADDR_FMT, most significant octet first. | |
| #define | PBL_BT_ADDR_XPLODE_PTR(a) (a)->octets[5], (a)->octets[4], (a)->octets[3], (a)->octets[2], (a)->octets[1], (a)->octets[0] |
| PBL_BT_ADDR_XPLODE() taking a pointer. | |
| #define | PBL_BT_DEVICE_INVALID ((const struct pbl_bt_device){}) |
| Invalid (all zero) struct pbl_bt_device. | |
| #define | PBL_BT_DEVICE_INTERNAL_INVALID ((const struct pbl_bt_device_internal){}) |
| Invalid (all zero) struct pbl_bt_device_internal. | |
| #define | PBL_BT_AD_REPORT_DATA_MAX_LENGTH (31) |
| Maximum size in bytes of advertising data or scan response data. | |
| #define | PBL_BT_LL_CONN_INTV_MIN_SLOTS (6) |
| Minimum connection interval, in 1.25 ms slots. | |
| #define | PBL_BT_LL_CONN_INTV_MAX_SLOTS (3200) |
| Maximum connection interval, in 1.25 ms slots. | |
| #define | PBL_BT_LL_SUPERVISION_TIMEOUT_MIN_MS (100) |
| Minimum supervision timeout in milliseconds. | |
| #define | PBL_BT_SIG_UUID_EXPAND(u) |
| Compile-time version of bt_uuid_expand_32bit() and bt_uuid_expand_16bit(). | |
Typedefs | |
| typedef uintptr_t | pbl_bt_service_t |
| Opaque reference to a service object. | |
| typedef uintptr_t | pbl_bt_characteristic_t |
| Opaque reference to a characteristic object. | |
| typedef uintptr_t | pbl_bt_descriptor_t |
| Opaque reference to a descriptor object. | |
| typedef uint8_t | pbl_bt_bonding_id_t |
| Identifier of a bonding. | |
| typedef uint16_t | pbl_bt_cccd_id_t |
| Identifier of a stored Client Characteristic Configuration Descriptor entry. | |
Advertising flags | |
Bits of the Flags AD type, see Supplement to the Bluetooth Core Specification, Part A, 1.3. | |
| #define | PBL_BT_AD_FLAGS_LIM_DISCOVERABLE_MASK (1 << 0) |
| LE Limited Discoverable Mode. | |
| #define | PBL_BT_AD_FLAGS_GEN_DISCOVERABLE_MASK (1 << 1) |
| LE General Discoverable Mode. | |
| #define | PBL_BT_AD_FLAGS_BR_EDR_NOT_SUPPORTED_MASK (1 << 2) |
| BR/EDR Not Supported. | |
| #define | PBL_BT_AD_FLAGS_LE_BR_EDR_SIMULT_CONTROLLER_MASK (1 << 3) |
| Simultaneous LE and BR/EDR to Same Device Capable (Controller). | |
| #define | PBL_BT_AD_FLAGS_LE_BR_EDR_SIMULT_HOST_MASK (1 << 4) |
| Simultaneous LE and BR/EDR to Same Device Capable (Host). | |
Error codes, addresses, devices and advertising data shared by the Bluetooth API.
Addresses are stored least significant octet first, as on air. Use PBL_BT_ADDR_FMT with PBL_BT_ADDR_XPLODE() to print them most significant octet first:
| struct pbl_bt_addr |
Bluetooth device address.
| Data Fields | ||
|---|---|---|
| uint8_t | octets[6] | Address octets, least significant first. |
| struct pbl_bt_device |
Remote Bluetooth device, as exposed to applications.
Opaque: the layout is struct pbl_bt_device_internal.
| Data Fields | ||
|---|---|---|
| union pbl_bt_device.__unnamed7__ | __unnamed__ | |
| struct pbl_bt_device_internal |
Remote Bluetooth device: its address and address type.
The layout of struct pbl_bt_device. It is not exported to applications and its size must never change.
| Data Fields | ||
|---|---|---|
| union pbl_bt_device_internal.__unnamed9__ | __unnamed__ | |
| struct pbl_bt_ad_data |
Advertising data and scan response data.
Variable length: allocate it with room for both payloads after the header.
| union pbl_bt_device.__unnamed7__ |
| union pbl_bt_device_internal.__unnamed9__ |
| Data Fields | ||
|---|---|---|
| struct pbl_bt_device_internal.__unnamed9__.__unnamed11__ | __unnamed__ | |
| struct pbl_bt_device | opaque | The same device, as the opaque type. |
| struct pbl_bt_device_internal.__unnamed9__.__unnamed11__ |
| Data Fields | ||
|---|---|---|
| struct pbl_bt_addr | address | Device address. |
| bool | is_classic: 1 | True for a BR/EDR device, false for an LE device. |
| bool | is_random_address: 1 | True if address is a random address, false if it is a public address. |
| uint16_t | zero: 14 |
Unused, zero. When adding flags, also update the |
| #define PBL_BT_AD_FLAGS_BR_EDR_NOT_SUPPORTED_MASK (1 << 2) |
BR/EDR Not Supported.
| #define PBL_BT_AD_FLAGS_GEN_DISCOVERABLE_MASK (1 << 1) |
LE General Discoverable Mode.
| #define PBL_BT_AD_FLAGS_LE_BR_EDR_SIMULT_CONTROLLER_MASK (1 << 3) |
Simultaneous LE and BR/EDR to Same Device Capable (Controller).
| #define PBL_BT_AD_FLAGS_LE_BR_EDR_SIMULT_HOST_MASK (1 << 4) |
Simultaneous LE and BR/EDR to Same Device Capable (Host).
| #define PBL_BT_AD_FLAGS_LIM_DISCOVERABLE_MASK (1 << 0) |
LE Limited Discoverable Mode.
| #define PBL_BT_AD_REPORT_DATA_MAX_LENGTH (31) |
Maximum size in bytes of advertising data or scan response data.
| #define PBL_BT_ADDR_FMT "%02X:%02X:%02X:%02X:%02X:%02X" |
printf() format of an address, as XX:XX:XX:XX:XX:XX.
Use with PBL_BT_ADDR_XPLODE() or PBL_BT_ADDR_XPLODE_PTR().
| #define PBL_BT_ADDR_FMT_BUFFER_SIZE (18) |
Buffer size for an address printed with PBL_BT_ADDR_FMT, including the terminator.
| #define PBL_BT_ADDR_SIZE (sizeof(struct pbl_bt_addr)) |
Size of a struct pbl_bt_addr in bytes.
| #define PBL_BT_ADDR_XPLODE | ( | a | ) | (a).octets[5], (a).octets[4], (a).octets[3], (a).octets[2], (a).octets[1], (a).octets[0] |
Expand an address into the printf() arguments of PBL_BT_ADDR_FMT, most significant octet first.
| a | struct pbl_bt_addr value. |
| #define PBL_BT_ADDR_XPLODE_PTR | ( | a | ) | (a)->octets[5], (a)->octets[4], (a)->octets[3], (a)->octets[2], (a)->octets[1], (a)->octets[0] |
PBL_BT_ADDR_XPLODE() taking a pointer.
| a | Pointer to a struct pbl_bt_addr. |
| #define PBL_BT_BD_ADDR_FMT "0x%02X%02X%02X%02X%02X%02X" |
printf() format of an address, as 0xXXXXXXXXXXXX.
Use with PBL_BT_ADDR_XPLODE() or PBL_BT_ADDR_XPLODE_PTR().
| #define PBL_BT_BD_ADDR_FMT_BUFFER_SIZE (15) |
Buffer size for an address printed with PBL_BT_BD_ADDR_FMT, including the terminator.
| #define PBL_BT_BONDING_ID_INVALID (0xFFU) |
Invalid bonding identifier.
| #define PBL_BT_CCCD_ID_INVALID (0xFFU) |
Invalid CCCD entry identifier.
| #define PBL_BT_CHARACTERISTIC_INVALID ((pbl_bt_characteristic_t)0) |
Invalid characteristic reference.
| #define PBL_BT_DESCRIPTOR_INVALID ((pbl_bt_descriptor_t)0) |
Invalid descriptor reference.
| #define PBL_BT_DEVICE_INTERNAL_INVALID ((const struct pbl_bt_device_internal){}) |
Invalid (all zero) struct pbl_bt_device_internal.
| #define PBL_BT_DEVICE_INVALID ((const struct pbl_bt_device){}) |
Invalid (all zero) struct pbl_bt_device.
| #define PBL_BT_DEVICE_NAME_BUFFER_SIZE (20) |
Buffer size of a device name, including the terminator.
| #define PBL_BT_ERRNO_WITH_HCI_ERROR | ( | e | ) | ((int)PBL_BT_ERRNO_HCI_ERROR_BEGIN + e) |
Map an HCI error to enum pbl_bt_errno.
| e | HCI error code. |
| #define PBL_BT_ERRNO_WITH_INTERNAL_ERROR | ( | e | ) | ((int)PBL_BT_ERRNO_INTERNAL_ERROR_BEGIN - e) |
Map a legacy stack error to enum pbl_bt_errno.
| e | Stack error code. |
| #define PBL_BT_LL_CONN_INTV_MAX_SLOTS (3200) |
Maximum connection interval, in 1.25 ms slots.
| #define PBL_BT_LL_CONN_INTV_MIN_SLOTS (6) |
Minimum connection interval, in 1.25 ms slots.
| #define PBL_BT_LL_SUPERVISION_TIMEOUT_MIN_MS (100) |
Minimum supervision timeout in milliseconds.
| #define PBL_BT_SERVICE_INVALID ((pbl_bt_service_t)0) |
Invalid service reference.
| #define PBL_BT_SIG_UUID_EXPAND | ( | u | ) |
Compile-time version of bt_uuid_expand_32bit() and bt_uuid_expand_16bit().
Expands to the 16 bytes of the UUID, as an initializer list.
| u | 16-bit or 32-bit UUID. |
| typedef uint8_t pbl_bt_bonding_id_t |
Identifier of a bonding.
Stable across reboots, so it can be persisted.
| typedef uint16_t pbl_bt_cccd_id_t |
Identifier of a stored Client Characteristic Configuration Descriptor entry.
| typedef uintptr_t pbl_bt_characteristic_t |
Opaque reference to a characteristic object.
| typedef uintptr_t pbl_bt_descriptor_t |
Opaque reference to a descriptor object.
| typedef uintptr_t pbl_bt_service_t |
Opaque reference to a service object.
Property bits of a characteristic.
The low byte holds the properties of the Bluetooth Core Specification, Vol 3, Part G, 3.3.1.1.
| enum pbl_bt_errno |
Bluetooth error codes.
| enum pbl_bt_gatt_error |
ATT error codes returned by a GATT server for read, write and subscribe operations.
The values up to 0xFF are the codes of the Bluetooth Core Specification, Vol 3, Part F, 3.4.1.1, and the common profile error codes. The values from 0x100 are local errors.