PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations
types.h File Reference
#include <pbl/kernel/compiler.h>
#include <pbl/util/uuid.h>
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>

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

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.
 

Enumerations

enum  pbl_bt_errno {
  PBL_BT_ERRNO_OK = 0 , PBL_BT_ERRNO_CONNECTED = PBL_BT_ERRNO_OK , PBL_BT_ERRNO_INVALID_PARAMETER = 1 , PBL_BT_ERRNO_CONNECTION_TIMEOUT = 2 ,
  PBL_BT_ERRNO_REMOTELY_TERMINATED = 3 , PBL_BT_ERRNO_LOCALLY_TERMINATED_BY_SYSTEM = 4 , PBL_BT_ERRNO_LOCALLY_TERMINATED_BY_APP = 5 , PBL_BT_ERRNO_NOT_ENOUGH_RESOURCES = 6 ,
  PBL_BT_ERRNO_PAIRING_NOT_SUPPORTED = 7 , PBL_BT_ERRNO_PAIRING_CONFIRMATION_FAILED = 8 , PBL_BT_ERRNO_PAIRING_TIME_OUT = 9 , PBL_BT_ERRNO_PAIRING_OOB_NOT_AVAILABLE = 10 ,
  PBL_BT_ERRNO_INVALID_STATE = 11 , PBL_BT_ERRNO_SERVICE_DISCOVERY_TIMEOUT = 12 , PBL_BT_ERRNO_SERVICE_DISCOVERY_DISCONNECTED = 13 , PBL_BT_ERRNO_SERVICE_DISCOVERY_DATABASE_CHANGED = 14 ,
  PBL_BT_ERRNO_INTERNAL_ERROR_BEGIN = 9000 , PBL_BT_ERRNO_HCI_ERROR_BEGIN = 10000 , PBL_BT_ERRNO_OTHER = 0x3fff
}
 Bluetooth error codes. More...
 
enum  pbl_bt_gatt_error {
  PBL_BT_GATT_ERROR_SUCCESS = 0x00 , PBL_BT_GATT_ERROR_INVALID_HANDLE = 0x01 , PBL_BT_GATT_ERROR_READ_NOT_PERMITTED = 0x02 , PBL_BT_GATT_ERROR_WRITE_NOT_PERMITTED = 0x03 ,
  PBL_BT_GATT_ERROR_INVALID_PDU = 0x04 , PBL_BT_GATT_ERROR_INSUFFICIENT_AUTHENTICATION = 0x05 , PBL_BT_GATT_ERROR_REQUEST_NOT_SUPPORTED = 0x06 , PBL_BT_GATT_ERROR_INVALID_OFFSET = 0x07 ,
  PBL_BT_GATT_ERROR_INSUFFICIENT_AUTHORIZATION = 0x08 , PBL_BT_GATT_ERROR_PREPARE_QUEUE_FULL = 0x09 , PBL_BT_GATT_ERROR_ATTRIBUTE_NOT_FOUND = 0x0A , PBL_BT_GATT_ERROR_ATTRIBUTE_NOT_LONG = 0x0B ,
  PBL_BT_GATT_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE = 0x0C , PBL_BT_GATT_ERROR_INVALID_ATTRIBUTE_VALUE_LENGTH = 0x0D , PBL_BT_GATT_ERROR_UNLIKELY_ERROR = 0x0E , PBL_BT_GATT_ERROR_INSUFFICIENT_ENCRYPTION = 0x0F ,
  PBL_BT_GATT_ERROR_UNSUPPORTED_GROUP_TYPE = 0x10 , PBL_BT_GATT_ERROR_INSUFFICIENT_RESOURCES = 0x11 , PBL_BT_GATT_ERROR_APPLICATION_SPECIFIC_ERROR_START = 0x80 , PBL_BT_GATT_ERROR_APPLICATION_SPECIFIC_ERROR_END = 0xFC ,
  PBL_BT_GATT_ERROR_CCCD_IMPROPERLY_CONFIGURED = 0xFD , PBL_BT_GATT_ERROR_PROCEDURE_ALREADY_IN_PROGRESS = 0xFE , PBL_BT_GATT_ERROR_OUT_OF_RANGE = 0xFF , PBL_BT_GATT_ERROR_REQUEST_TIME_OUT = 0x100 ,
  PBL_BT_GATT_ERROR_REQUEST_PREPARE_WRITE_DATA_MISMATCH = 0x101 , PBL_BT_GATT_ERROR_LOCAL_INSUFFICIENT_RESOURCES = 0x102
}
 ATT error codes returned by a GATT server for read, write and subscribe operations. More...
 
enum  pbl_bt_attribute_property {
  PBL_BT_ATTRIBUTE_PROPERTY_NONE = 0 , PBL_BT_ATTRIBUTE_PROPERTY_BROADCAST = (1 << 0) , PBL_BT_ATTRIBUTE_PROPERTY_READ = (1 << 1) , PBL_BT_ATTRIBUTE_PROPERTY_WRITE_WITHOUT_RESPONSE = (1 << 2) ,
  PBL_BT_ATTRIBUTE_PROPERTY_WRITE = (1 << 3) , PBL_BT_ATTRIBUTE_PROPERTY_NOTIFY = (1 << 4) , PBL_BT_ATTRIBUTE_PROPERTY_INDICATE = (1 << 5) , PBL_BT_ATTRIBUTE_PROPERTY_AUTHENTICATED_SIGNED_WRITES = (1 << 6) ,
  PBL_BT_ATTRIBUTE_PROPERTY_EXTENDED_PROPERTIES = (1 << 7) , PBL_BT_ATTRIBUTE_PROPERTY_READING_REQUIRES_ENCRYPTION = (1 << 8) , PBL_BT_ATTRIBUTE_PROPERTY_WRITING_REQUIRES_ENCRYPTION = (1 << 9)
}
 Property bits of a characteristic. More...