Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
ble::Defs Class Reference

Miscellaneous BLE definitions. More...

#include <Defs.hxx>

Public Types

enum class  GATTPerm : uint8_t {
  READ = 0x01 , WRITE = 0x02 , AUTHEN_READ = 0x04 , AUTHEN_WRITE = 0x08 ,
  AUTHOR_READ = 0x10 , AUTHOR_WRITE = 0x20 , ENCRYPT_READ = 0x40 , ENCRYPT_WRITE = 0x80
}
 GATT Permisions. More...
 
enum  { UUID_LEN_16 = 2 , UUID_LEN_32 = 4 , UUID_LEN_128 = 16 }
 UUID Sizes. More...
 
enum class  AdvType : uint8_t { FLAGS = 0x01 , NAME_SHORT = 0x08 , NAME_COMPLETE = 0x09 , SERVICE_DATA_128 = 0x21 }
 Advertising types. More...
 
typedef uint8_t Addr[ADDR_LEN]
 BLE address.
 
typedef uint8_t AddrType
 Address Type.
 
typedef uint16_t ConnHandle
 Connection handle.
 
typedef uint16_t AttHandle
 

Static Public Member Functions

static ssize_t adv_find_data (std::basic_string< uint8_t > &adv, AdvType type, uint8_t *size, unsigned instance=1)
 Find an advertisment data within an advertisement set.
 
static std::string adv_find_name_short (std::basic_string< uint8_t > &adv, unsigned instance=1)
 Find an advertisment name short type within an advertisement set.
 
static std::string adv_find_name_complete (std::basic_string< uint8_t > &adv, unsigned instance=1)
 Find an advertisment name complete type within an advertisement set.
 
static std::basic_string< uint8_t > adv_find_service_data_128 (std::basic_string< uint8_t > &adv, const uint8_t service_uuid[16], unsigned instance=1)
 Find an advertisment service data 128 type within an advertisement set.
 

Static Public Attributes

static constexpr uint16_t ATTR_HANDLE_INVALID = 0
 The value of an invalid or unitialized attribute handle.
 
static constexpr uint16_t CONN_HANDLE_INVALID = 0xFFFF
 The value of an invalid or unitialized connection handle.
 
static constexpr uint8_t ADDR_LEN = 6
 The length of an address.
 
static const uint8_t PRIMARY_SERVICE_UUID [2] = {0x00, 0x28}
 Primary service UUID.
 
static const uint8_t SECONDARY_SERVICE_UUID [2] = {0x01, 0x28}
 Secondary service UUID.
 
static const uint8_t CHAR_DECLARATOIN_UUID [2] = {0x03, 0x28}
 Characteristic UUID.
 
static const uint8_t CHAR_CLIENT_CONFIG_UUID [2] = {0x02, 0x29}
 Characterisitic Client Config Descriptor (CCCD) UUID.
 
static const uint8_t CHAR_PROP_READ_WRITE_NOTIFY [1]
 Characteristic read/write/notify property.
 
static const uint8_t CHAR_PROP_READ_NOTIFY_ACK [1]
 Characteristic read/write/notify property.
 
static const uint8_t CHAR_PROP_WRITE [1]
 Characteristic read/write/notify property.
 

Detailed Description

Miscellaneous BLE definitions.

Definition at line 39 of file ble/Defs.hxx.

Member Typedef Documentation

◆ Addr

typedef uint8_t ble::Defs::Addr[ADDR_LEN]

BLE address.

Definition at line 73 of file ble/Defs.hxx.

◆ AddrType

typedef uint8_t ble::Defs::AddrType

Address Type.

Definition at line 76 of file ble/Defs.hxx.

◆ AttHandle

typedef uint16_t ble::Defs::AttHandle

Definition at line 81 of file ble/Defs.hxx.

◆ ConnHandle

typedef uint16_t ble::Defs::ConnHandle

Connection handle.

Definition at line 79 of file ble/Defs.hxx.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

UUID Sizes.

Enumerator
UUID_LEN_16 

length in bytes of a 16-bit UUID

UUID_LEN_32 

length in bytes of a 32-bit UUID

UUID_LEN_128 

length in bytes of a 128-bit UUID

Definition at line 97 of file ble/Defs.hxx.

◆ AdvType

enum class ble::Defs::AdvType : uint8_t
strong

Advertising types.

Enumerator
FLAGS 

GAP discovery modes.

NAME_SHORT 

shortened local name

NAME_COMPLETE 

complete local name

SERVICE_DATA_128 

128-bit service UUID folloed by data

Definition at line 105 of file ble/Defs.hxx.

◆ GATTPerm

enum class ble::Defs::GATTPerm : uint8_t
strong

GATT Permisions.

Enumerator
READ 

attribute is readable

WRITE 

attribute is writable

AUTHEN_READ 

read requires authentication

AUTHEN_WRITE 

write requires authentication

AUTHOR_READ 

read requires authorization

AUTHOR_WRITE 

write requires authorization

ENCRYPT_READ 

read requires encryption

ENCRYPT_WRITE 

write requires encryption

Definition at line 84 of file ble/Defs.hxx.

Member Function Documentation

◆ adv_find_data()

ssize_t Defs::adv_find_data ( std::basic_string< uint8_t > &  adv,
AdvType  type,
uint8_t *  size,
unsigned  instance = 1 
)
static

Find an advertisment data within an advertisement set.

Parameters
advcontents of the advertisement set
typethe data type to find
sizelocation to place the data size, size excludes type byte
instancewhich instance, starting from the front, to find
Returns
starting position of the length byte, else -1 if not found

Definition at line 59 of file ble/Defs.cxx.

◆ adv_find_name_complete()

std::string Defs::adv_find_name_complete ( std::basic_string< uint8_t > &  adv,
unsigned  instance = 1 
)
static

Find an advertisment name complete type within an advertisement set.

Parameters
advcontents of the advertisement set
instancewhich instance, starting from the front, to find
Returns
string containing the name, empty string if not found.

Definition at line 104 of file ble/Defs.cxx.

◆ adv_find_name_short()

std::string Defs::adv_find_name_short ( std::basic_string< uint8_t > &  adv,
unsigned  instance = 1 
)
static

Find an advertisment name short type within an advertisement set.

Parameters
advcontents of the advertisement set
instancewhich instance, starting from the front, to find
Returns
string containing the name, empty string if not found.

Definition at line 88 of file ble/Defs.cxx.

◆ adv_find_service_data_128()

std::basic_string< uint8_t > Defs::adv_find_service_data_128 ( std::basic_string< uint8_t > &  adv,
const uint8_t  service_uuid[16],
unsigned  instance = 1 
)
static

Find an advertisment service data 128 type within an advertisement set.

Parameters
advcontents of the advertisement set
service_uuid128-bit UUID of the service to extract data from
instancewhich instance, starting from the front, to find
Returns
basic_string containing the data, empty basic_string if not found.

Definition at line 120 of file ble/Defs.cxx.

Member Data Documentation

◆ ADDR_LEN

constexpr uint8_t ble::Defs::ADDR_LEN = 6
staticconstexpr

The length of an address.

Definition at line 49 of file ble/Defs.hxx.

◆ ATTR_HANDLE_INVALID

constexpr uint16_t ble::Defs::ATTR_HANDLE_INVALID = 0
staticconstexpr

The value of an invalid or unitialized attribute handle.

Definition at line 43 of file ble/Defs.hxx.

◆ CHAR_CLIENT_CONFIG_UUID

const uint8_t Defs::CHAR_CLIENT_CONFIG_UUID = {0x02, 0x29}
static

Characterisitic Client Config Descriptor (CCCD) UUID.

Definition at line 61 of file ble/Defs.hxx.

◆ CHAR_DECLARATOIN_UUID

const uint8_t Defs::CHAR_DECLARATOIN_UUID = {0x03, 0x28}
static

Characteristic UUID.

Definition at line 58 of file ble/Defs.hxx.

◆ CHAR_PROP_READ_NOTIFY_ACK

const uint8_t Defs::CHAR_PROP_READ_NOTIFY_ACK
static
Initial value:
=
{
(1 << 1) |
(1 << 5)
}

Characteristic read/write/notify property.

Definition at line 67 of file ble/Defs.hxx.

◆ CHAR_PROP_READ_WRITE_NOTIFY

const uint8_t Defs::CHAR_PROP_READ_WRITE_NOTIFY
static
Initial value:
=
{
(1 << 1) |
(1 << 3) |
(1 << 4)
}

Characteristic read/write/notify property.

Definition at line 64 of file ble/Defs.hxx.

◆ CHAR_PROP_WRITE

const uint8_t Defs::CHAR_PROP_WRITE
static
Initial value:
=
{
(1 << 3)
}

Characteristic read/write/notify property.

Definition at line 70 of file ble/Defs.hxx.

◆ CONN_HANDLE_INVALID

constexpr uint16_t ble::Defs::CONN_HANDLE_INVALID = 0xFFFF
staticconstexpr

The value of an invalid or unitialized connection handle.

Definition at line 46 of file ble/Defs.hxx.

◆ PRIMARY_SERVICE_UUID

const uint8_t Defs::PRIMARY_SERVICE_UUID = {0x00, 0x28}
static

Primary service UUID.

Definition at line 52 of file ble/Defs.hxx.

◆ SECONDARY_SERVICE_UUID

const uint8_t Defs::SECONDARY_SERVICE_UUID = {0x01, 0x28}
static

Secondary service UUID.

Definition at line 55 of file ble/Defs.hxx.


The documentation for this class was generated from the following files: