pabigot
0.1.1
C++ support classes
|
Go to the documentation of this file. 8 #ifndef PABIGOT_BLE_GAP_HPP 9 #define PABIGOT_BLE_GAP_HPP 38 PT_ADV_DIRECT_IND = 0x01,
39 PT_ADV_NONCONN_IND = 0x02,
42 PT_CONNECT_IND = 0x05,
43 PT_ADV_SCAN_IND = 0x06,
44 PT_ADV_EXT_IND = 0x07,
45 PT_AUX_CONNECT_RSP = 0x08,
54 ET_ADV_DIRECT_IND = 0x01,
55 ET_ADV_SCAN_IND = 0x02,
56 ET_ADV_NONCONN_IND = 0x03,
73 FDT_LE_LIMITED = 0x01,
74 FDT_LE_GENERAL = 0x02,
75 FDT_BREDR_NOTSUP = 0x04,
76 FDT_BREDRLE_CTRL = 0x08,
77 FDT_BREDRLE_HOST = 0x10,
115 DT_CLASS_OF_DEVICE = 0x0D,
116 DT_SIMPLE_PAIRING_HASH_C192 = 0x0E,
117 DT_SIMPLE_PAIRING_RANDOMIZER_R192 = 0x0F,
119 DT_SECURITY_MANAGER_OOB_FLAGS = 0x11,
128 DT_PUBLIC_TARGET_ADDRESS = 0x17,
129 DT_RANDOM_TARGET_ADDRESS = 0x18,
130 DT_APPEARANCE = 0x19,
133 DT_LE_BLUETOOTH_DEVICE_ADDR = 0x1B,
135 DT_SIMPLE_PAIRING_HASH_C256 = 0x1D,
136 DT_SIMPLE_PAIRING_RANDOMIZER_R256 = 0x1E,
143 DT_LE_SECURE_CONN_CONFIRM_VALUE = 0x22,
144 DT_LE_SECURE_CONN_RANDOM_VALUE = 0x23,
146 DT_INDOOR_POSITIONING = 0x25,
147 DT_TRANSPORT_DISCOVERY_DATA = 0x26,
148 DT_LE_SUPPORTED_FEATURES = 0x27,
149 DT_CHANNEL_MAP_UPDATE_INDICATION = 0x28,
151 DT_MESH_MESSAGE = 0x2A,
152 DT_MESH_BEACON = 0x2B,
153 DT_3D_INFORMATION_DATA = 0x3D,
197 auto span = count +
sizeof(tag);
198 auto span_octet = static_cast<uint8_t>(span);
201 if ((span_octet == span)
213 explicit operator bool() const noexcept
227 && ((sp + 2U) != owner.bp_)) {
230 auto span = owner.bp_ - sp - 1U;
231 if (static_cast<uint8_t>(span) == span) {
240 template <
typename uu
id_type>
241 void store_uuids (uint8_t dt,
242 const uuid_type*
begin,
243 const uuid_type*
end);
259 template <
size_t count>
261 super{src.begin(), src.end()}
268 const uint8_t*
data () const noexcept
270 return static_cast<const uint8_t *>(
begin());
304 return {*
this, tag, count};
319 ptrdiff_t count = -1);
330 ptrdiff_t count = -1);
343 template <
typename uu
id_type>
357 template <
typename uu
id_type>
359 const uuid_type*
end);
367 template <
typename uu
id_type>
381 template <
typename uu
id_type>
383 const uuid_type*
end);
391 template <
typename uu
id_type>
405 template <
typename uu
id_type>
407 const uuid_type*
end);
421 template <
typename uu
id_type>
423 const uint8_t*
begin,
436 template <
typename uuid_type,
439 const std::array<uint8_t, len>&
data)
456 template <
typename uu
id_type>
461 auto ptr = static_cast<const uint8_t*>(buf);
485 uint16_t connIntervalMax);
537 const uint8_t* begin,
542 const uint8_t* begin,
547 const uint8_t* begin,
adv_data::set_CompleteListServiceUUID()
Definition: gap.hpp:108
void set_CompleteLocalName(const char *name, ptrdiff_t count=-1)
Helper to set the complete local name.
const void * begin() const noexcept
Get a pointer to the start of buffer.
Definition: byteorder.hpp:372
store_helper start_store(uint8_t tag, size_type count)
Reserve space for a data type record.
Definition: gap.hpp:301
adv_data::set_ShortenedLocalName()
Definition: gap.hpp:110
Infrastructure supporting Bluetooth Low Energy.
Infrastructure to fill an octet buffer with data.
Definition: byteorder.hpp:310
adv_data::set_IncompleteListServiceUUID()
Definition: gap.hpp:98
BT-5v3C9.2.2 LE-only not discoverable.
Definition: gap.hpp:80
bool append(const void *sp, size_type span) noexcept
Append a value to the buffer.
Definition: byteorder.hpp:452
Infrastructure to fill in Advertising and Scan Response Data.
Definition: gap.hpp:166
adv_data::set_CompleteListServiceUUID()
Definition: gap.hpp:104
adv_data::set_CompleteListServiceUUID()
Definition: gap.hpp:100
adv_data::set_IncompleteListServiceUUID()
Definition: gap.hpp:106
RAII helper to avoid overruns and to back-fill lengths.
Definition: gap.hpp:182
const void * end() const noexcept
Get a pointer to the end of the filled part of the buffer.
Definition: byteorder.hpp:382
adv_data::set_ListServiceSolicitationUUID()
Definition: gap.hpp:123
adv_data::set_ServiceData()
Definition: gap.hpp:127
Support for byte order manipulation and packed storage.
void set_TXPowerLevel(int8_t txPower)
Helper to set the TX Power Level data value.
adv_data::set_ServiceData()
Definition: gap.hpp:142
void set_ShortenedLocalName(const char *name, ptrdiff_t count=-1)
Helper to set the shortened local name.
void set_IncompleteListServiceUUID(const uuid_type &uuid)
Helper for incomplete listing a single UUID service.
Definition: gap.hpp:368
void set_Flags(unsigned int flags)
Helper to set the Flags data value.
pdu_type_e
Advertising PDU type.
Definition: gap.hpp:35
void set_AdvertisingInterval(uint16_t advInterval)
Helper to set the Advertising Interval data value.
adv_data::set_ServiceData()
Definition: gap.hpp:140
void invalidate() noexcept
Explicitly mark the buffer invalid.
Definition: byteorder.hpp:364
adv_data::set_TXPowerLevel
Definition: gap.hpp:114
adv_data::set_CompleteLocalName()
Definition: gap.hpp:112
const bool valid() const noexcept
Indicates whether advance() caused an error.
Definition: byteorder.hpp:355
BT-5v3C9.2.3 LE-only short-term discoverable.
Definition: gap.hpp:82
~store_helper()
Destructor updates length field if content was added since construction.
Definition: gap.hpp:220
flags_data_type_e
Bits and values for DT_FLAGS.
Definition: gap.hpp:71
BT-5v3C9.2.4 LE-only long-term discoverable.
Definition: gap.hpp:84
uint8_t * set_ServiceData(const uuid_type &uuid, const void *buf, size_t count)
Helper to set service data.
Definition: gap.hpp:457
adv_data::set_ListServiceSolicitationUUID()
Definition: gap.hpp:138
adv_event_type_e
Advertising Event Type.
Definition: gap.hpp:51
adv_data(std::array< uint8_t, count > &src)
Construct from a std::array reference.
Definition: gap.hpp:260
std::size_t size_type
Type used for span values.
Definition: byteorder.hpp:314
adv_data::set_AdvertisingInterval
Definition: gap.hpp:132
void set_CompleteListServiceUUID(const uuid_type &uuid)
Helper for complete listing of a single UUID service.
Definition: gap.hpp:344
Root for all pabigot namespaces.
Definition: gap.hpp:15
void * set_ManufacturerSpecificData(uint16_t companyID, size_t span)
Helper to set Manufacturer Specific Data.
uint8_t * set_ServiceData(const uuid_type &uuid, const uint8_t *begin, const uint8_t *end)
Helper to set service data.
void set_SlaveConnectionIntervalRange(uint16_t connIntervalMin, uint16_t connIntervalMax)
Helper to set the preferred connectional interval range.
adv_data::set_Flags() CSSv7A1.3
Definition: gap.hpp:96
adv_data::set_IncompleteListServiceUUID()
Definition: gap.hpp:102
Indicates an invalid event type flag.
Definition: gap.hpp:65
adv_data::set_SlaveConnectionIntervalRange
Definition: gap.hpp:121
adv_data(uint8_t *begin, uint8_t *end)
Reference an octet sequence into which advertising data will be written.
Definition: gap.hpp:253
32-bit UUID type stored as a little-endian byte sequence.
Definition: ble.hpp:165
adv_data::set_ManufacturerSpecificData
Definition: gap.hpp:155
static constexpr size_t ASR_DATA_SIZE
Number of octets available for a standard advertising or scan response data packet.
Definition: gap.hpp:28
uint8_t * set_ServiceData(const uuid_type &uuid, const std::array< uint8_t, len > &data)
Helper to set service data.
Definition: gap.hpp:438
bool can_advance(size_type s) const noexcept
Indicate whether advance() would succeed for a given span.
Definition: byteorder.hpp:437
const uint8_t * data() const noexcept
Get a typed pointer to the start of the buffer.
Definition: gap.hpp:268
data_type_e
GAP assigned numbers for data type values.
Definition: gap.hpp:93
void set_ListServiceSolicitationUUID(const uuid_type &uuid)
Helper for listing a single service solicitation UUID.
Definition: gap.hpp:392
adv_data::set_ListServiceSolicitationUUID()
Definition: gap.hpp:125
Basic holder for 128-bit UUIDs stored as a little-endian byte sequence.
Definition: ble.hpp:217
16-bit UUID type stored as a little-endian byte sequence.
Definition: ble.hpp:132