Direct-BT  2.3.1
Direct-BT - Direct Bluetooth Programming.
GATTNumbers.cpp
Go to the documentation of this file.
1 /*
2  * Author: Sven Gothel <sgothel@jausoft.com>
3  * Copyright (c) 2020 Gothel Software e.K.
4  * Copyright (c) 2020 ZAFENA AB
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sublicense, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be
15  * included in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
26 #include <cstring>
27 #include <string>
28 #include <memory>
29 #include <cstdint>
30 #include <cstdio>
31 
32 #include <algorithm>
33 
34 #include <jau/darray.hpp>
35 #include <jau/debug.hpp>
36 
37 #include "GattNumbers.hpp"
38 
39 using namespace direct_bt;
40 
41 /** https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Services/org.bluetooth.service.generic_access.xml */
44  // GattCharacteristicPropertySpec[9]:
45  { { Read, Mandatory },
48  // GattClientCharacteristicConfigSpec:
50  },
52  // GattCharacteristicPropertySpec[9]:
53  { { Read, Mandatory },
56  // GattClientCharacteristicConfigSpec:
58  },
60  // GattCharacteristicPropertySpec[9]:
61  { { Read, Mandatory },
64  // GattClientCharacteristicConfigSpec:
66  },
68  // GattCharacteristicPropertySpec[9]:
69  { { Read, Excluded },
72  // GattClientCharacteristicConfigSpec:
74  },
76  // GattCharacteristicPropertySpec[9]:
77  { { Read, Mandatory },
80  // GattClientCharacteristicConfigSpec:
82  },
83  } };
84 
85 /** https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Services/org.bluetooth.service.health_thermometer.xml */
88  // GattCharacteristicPropertySpec[9]:
89  { { Read, Excluded },
92  // GattClientCharacteristicConfigSpec:
94  },
96  // GattCharacteristicPropertySpec[9]:
97  { { Read, Mandatory },
100  // GattClientCharacteristicConfigSpec:
102  },
104  // GattCharacteristicPropertySpec[9]:
105  { { Read, Excluded },
108  // GattClientCharacteristicConfigSpec:
110  },
112  // GattCharacteristicPropertySpec[9]:
113  { { Read, Mandatory },
116  // GattClientCharacteristicConfigSpec:
118  },
119  } };
120 
123  // GattCharacteristicPropertySpec[9]:
124  { { Read, Mandatory },
127  // GattClientCharacteristicConfigSpec:
129  },
131  // GattCharacteristicPropertySpec[9]:
132  { { Read, Mandatory },
135  // GattClientCharacteristicConfigSpec:
137  },
139  // GattCharacteristicPropertySpec[9]:
140  { { Read, Mandatory },
143  // GattClientCharacteristicConfigSpec:
145  },
147  // GattCharacteristicPropertySpec[9]:
148  { { Read, Mandatory },
151  // GattClientCharacteristicConfigSpec:
153  },
155  // GattCharacteristicPropertySpec[9]:
156  { { Read, Mandatory },
159  // GattClientCharacteristicConfigSpec:
161  },
163  // GattCharacteristicPropertySpec[9]:
164  { { Read, Mandatory },
167  // GattClientCharacteristicConfigSpec:
169  },
170  { SYSTEM_ID, Optional,
171  // GattCharacteristicPropertySpec[9]:
172  { { Read, Mandatory },
175  // GattClientCharacteristicConfigSpec:
177  },
179  // GattCharacteristicPropertySpec[9]:
180  { { Read, Mandatory },
183  // GattClientCharacteristicConfigSpec:
185  },
186  { PNP_ID, Optional,
187  // GattCharacteristicPropertySpec[9]:
188  { { Read, Mandatory },
191  // GattClientCharacteristicConfigSpec:
193  }
194  } };
195 
198 
199 #define CASE_TO_STRING(V) case V: return #V;
200 
201 #define SERVICE_TYPE_ENUM(X) \
202  X(GENERIC_ACCESS) \
203  X(HEALTH_THERMOMETER) \
204  X(DEVICE_INFORMATION) \
205  X(BATTERY_SERVICE)
206 
208  switch(v) {
210  default: ; // fall through intended
211  }
212  return "Unknown";
213 }
214 
215 #define CHARACTERISTIC_TYPE_ENUM(X) \
216  X(DEVICE_NAME) \
217  X(APPEARANCE) \
218  X(PERIPHERAL_PRIVACY_FLAG) \
219  X(RECONNECTION_ADDRESS) \
220  X(PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS) \
221  X(TEMPERATURE) \
222  X(TEMPERATURE_CELSIUS) \
223  X(TEMPERATURE_FAHRENHEIT) \
224  X(TEMPERATURE_MEASUREMENT) \
225  X(TEMPERATURE_TYPE) \
226  X(INTERMEDIATE_TEMPERATURE) \
227  X(MEASUREMENT_INTERVAL) \
228  X(SYSTEM_ID) \
229  X(MODEL_NUMBER_STRING) \
230  X(SERIAL_NUMBER_STRING) \
231  X(FIRMWARE_REVISION_STRING) \
232  X(HARDWARE_REVISION_STRING) \
233  X(SOFTWARE_REVISION_STRING) \
234  X(MANUFACTURER_NAME_STRING) \
235  X(REGULATORY_CERT_DATA_LIST) \
236  X(PNP_ID)
237 
238 
240  switch(v) {
242  default: ; // fall through intended
243  }
244  return "Unknown";
245 }
246 
247 #define CHARACTERISTIC_PROP_ENUM(X) \
248  X(Broadcast) \
249  X(Read) \
250  X(WriteNoAck) \
251  X(WriteWithAck) \
252  X(Notify) \
253  X(Indicate) \
254  X(AuthSignedWrite) \
255  X(ExtProps) \
256  X(ReliableWriteExt) \
257  X(AuxWriteExt)
258 
260  switch(v) {
262  default: ; // fall through intended
263  }
264  return "Unknown";
265 }
266 
267 #define REQUIREMENT_SPEC_ENUM(X) \
268  X(Excluded) \
269  X(Mandatory) \
270  X(Optional) \
271  X(Conditional) \
272  X(if_characteristic_supported) \
273  X(if_notify_or_indicate_supported) \
274  X(C1)
275 
277  switch(v) {
279  default: ; // fall through intended
280  }
281  return "Unknown";
282 }
283 
284 std::string GattCharacteristicPropertySpec::toString() const noexcept {
286 }
287 
288 std::string GattClientCharacteristicConfigSpec::toString() const noexcept {
289  return "ClientCharCfg["+GattRequirementSpecToString(requirement)+"["+read.toString()+", "+writeWithAck.toString()+"]]";
290 }
291 
292 std::string GattCharacteristicSpec::toString() const noexcept {
294  for(size_t i=0; i<propertySpec.size(); i++) {
295  if(0<i) {
296  res += ", ";
297  }
298  res += propertySpec.at(i).toString();
299  }
300  res += "], "+clientConfig.toString();
301  return res;
302 }
303 
304 std::string GattServiceCharacteristic::toString() const noexcept {
305  std::string res = GattServiceTypeToString(service)+": [";
306  for(size_t i=0; i<characteristics.size(); i++) {
307  if(0<i) {
308  res += ", ";
309  }
310  res += "["+characteristics.at(i).toString()+"]";
311  }
312  res += "]";
313  return res;
314 }
315 
316 const GattServiceCharacteristic * direct_bt::findGattServiceChar(const uint16_t uuid16) noexcept {
317  for(size_t i=0; i<GATT_SERVICES.size(); i++) {
318  const GattServiceCharacteristic & serviceChar = *GATT_SERVICES.at(i);
319  if( uuid16 == serviceChar.service ) {
320  return &serviceChar;
321  }
322  for(size_t j=0; j<serviceChar.characteristics.size(); j++) {
323  const GattCharacteristicSpec & charSpec = serviceChar.characteristics.at(i);
324  if( uuid16 == charSpec.characteristic ) {
325  return &serviceChar;
326  }
327  }
328  }
329  return nullptr;
330 }
331 
332 const GattCharacteristicSpec * direct_bt::findGattCharSpec(const uint16_t uuid16) noexcept {
333  for(size_t i=0; i<GATT_SERVICES.size(); i++) {
334  const GattServiceCharacteristic & serviceChar = *GATT_SERVICES.at(i);
335  for(size_t j=0; j<serviceChar.characteristics.size(); j++) {
336  const GattCharacteristicSpec & charSpec = serviceChar.characteristics.at(i);
337  if( uuid16 == charSpec.characteristic ) {
338  return &charSpec;
339  }
340  }
341  }
342  return nullptr;
343 }
344 
345 /********************************************************/
346 /********************************************************/
347 /********************************************************/
348 
349 std::string direct_bt::GattNameToString(const TROOctets &v) noexcept {
350  const jau::nsize_t str_len = v.getSize();
351  if( 0 == str_len ) {
352  return std::string(); // empty
353  }
354  POctets s(str_len+1); // dtor releases chunk
355  memcpy(s.get_wptr(), v.get_ptr(), str_len);
356  s.put_uint8_nc(str_len, 0); // EOS
357  return std::string((const char*)s.get_ptr());
358 }
359 
361 : minConnectionInterval(source.get_uint16(0)), maxConnectionInterval(source.get_uint16(2)),
362  slaveLatency(source.get_uint16(4)), connectionSupervisionTimeoutMultiplier(source.get_uint16(6))
363 {
364 }
365 
366 std::shared_ptr<GattPeriphalPreferredConnectionParameters> GattPeriphalPreferredConnectionParameters::get(const TROOctets &source) noexcept {
367  const jau::nsize_t reqSize = 8;
368  if( source.getSize() < reqSize ) {
369  ERR_PRINT("GattPeriphalPreferredConnectionParameters: Insufficient data, less than %d bytes in %s", reqSize, source.toString().c_str());
370  return nullptr;
371  }
372  return std::make_shared<GattPeriphalPreferredConnectionParameters>(source);
373 }
374 
376  return "PrefConnectionParam[interval["+
378  "], slaveLatency "+std::to_string(slaveLatency)+
380 }
381 
382 std::string GattGenericAccessSvc::toString() const noexcept {
383  std::string pcp(nullptr != prefConnParam ? prefConnParam->toString() : "");
384  return "'"+deviceName+"'[appearance "+jau::to_hexstring(static_cast<uint16_t>(appearance))+" ("+to_string(appearance)+"), "+pcp+"]";
385 }
386 
387 GattPnP_ID::GattPnP_ID(const TROOctets &source) noexcept
388 : vendor_id_source(source.get_uint8(0)), vendor_id(source.get_uint16(1)),
389  product_id(source.get_uint16(3)), product_version(source.get_uint16(5)) {}
390 
391 std::shared_ptr<GattPnP_ID> GattPnP_ID::get(const TROOctets &source) noexcept {
392  const jau::nsize_t reqSize = 7;
393  if( source.getSize() < reqSize ) {
394  ERR_PRINT("GattPnP_ID: Insufficient data, less than %d bytes in %s", reqSize, source.toString().c_str());
395  return nullptr;
396  }
397  return std::make_shared<GattPnP_ID>(source);
398 }
399 
400 std::string GattPnP_ID::toString() const noexcept {
401  return "vendor_id[source "+jau::to_hexstring(vendor_id_source)+
402  ", id "+jau::to_hexstring(vendor_id)+
403  "], product_id "+jau::to_hexstring(product_id)+
404  ", product_version "+jau::to_hexstring(product_version);
405 }
406 
407 std::string GattDeviceInformationSvc::toString() const noexcept {
408  std::string pnp(nullptr != pnpID ? pnpID->toString() : "");
409  return "DeviceInfo[manufacturer '"+manufacturer+"', model '"+modelNumber+"', serial '"+serialNumber+"', systemID '"+systemID.toString()+
410  "', revisions[firmware '"+firmwareRevision+"', hardware '"+hardwareRevision+"', software '"+softwareRevision+
411  "'], pnpID["+pnp+"], regCertData '"+regulatoryCertDataList.toString()+"']";
412 }
413 
414 std::shared_ptr<GattTemperatureMeasurement> GattTemperatureMeasurement::get(const TROOctets &source) noexcept {
415  const jau::nsize_t size = source.getSize();
416  jau::nsize_t reqSize = 1 + 4; // max size = 13
417  if( reqSize > size ) {
418  // min size: flags + temperatureValue
419  ERR_PRINT("GattTemperatureMeasurement: Insufficient data, less than %d bytes in %s", reqSize, source.toString().c_str());
420  return nullptr;
421  }
422 
423  uint8_t flags = source.get_uint8(0);
424  bool hasTimestamp = 0 != ( flags & Bits::HAS_TIMESTAMP );
425  if( hasTimestamp ) {
426  reqSize += 7;
427  }
428  bool hasTemperatureType = 0 != ( flags & Bits::HAS_TEMP_TYPE );
429  if( hasTemperatureType ) {
430  reqSize += 1;
431  }
432  if( reqSize > size ) {
433  return nullptr;
434  }
435 
436  uint32_t raw_temp_value = source.get_uint32(1);
437  float temperatureValue = ieee11073::FloatTypes::float32_IEEE11073_to_IEEE754(raw_temp_value);
438 
439  /** Timestamp, if HAS_TIMESTAMP is set. */
440  ieee11073::AbsoluteTime timestamp;
441  if( hasTemperatureType ) {
442  timestamp = ieee11073::AbsoluteTime(source.get_ptr(1+4), 7);
443  }
444 
445  /** Temperature Type, if HAS_TEMP_TYPE is set: Format ???? */
446  uint8_t temperature_type=0;
447  if( hasTemperatureType ) {
448  temperature_type = source.get_uint8(1+4+7);
449  }
450  return std::make_shared<GattTemperatureMeasurement>(flags, temperatureValue, timestamp, temperature_type);
451 }
452 
453 std::string GattTemperatureMeasurement::toString() const noexcept {
454  std::string res = std::to_string(temperatureValue);
455  res += isFahrenheit() ? " F" : " C";
456  if( hasTimestamp() ) {
457  res += ", "+timestamp.toString();
458  }
459  if( hasTemperatureType() ) {
460  res += ", type "+std::to_string(temperature_type);
461  }
462  return res;
463 }
direct_bt::Notify
@ Notify
Definition: GattNumbers.hpp:135
direct_bt::GattCharacteristicPropertySpec::toString
std::string toString() const noexcept
Definition: GATTNumbers.cpp:284
direct_bt::GattDeviceInformationSvc::modelNumber
const std::string modelNumber
Optional.
Definition: GattNumbers.hpp:320
jau::darray::at
const_reference at(size_type i) const
Like std::vector::at(size_type), immutable reference.
Definition: darray.hpp:719
direct_bt::WriteWithAck
@ WriteWithAck
Definition: GattNumbers.hpp:134
direct_bt::GattPeriphalPreferredConnectionParameters::toString
std::string toString() const noexcept
Definition: GATTNumbers.cpp:375
direct_bt::Broadcast
@ Broadcast
Definition: GattNumbers.hpp:131
GattCharacteristicSpec::toString
std::string toString() const noexcept
Definition: test_datatype02.hpp:430
direct_bt::GattDeviceInformationSvc::systemID
const POctets systemID
Optional.
Definition: GattNumbers.hpp:318
direct_bt::GattServiceType
GattServiceType
GATT Service Type, each encapsulating a set of Characteristics.
Definition: GattNumbers.hpp:64
direct_bt::Read
@ Read
Definition: GattNumbers.hpp:132
direct_bt::FIRMWARE_REVISION_STRING
@ FIRMWARE_REVISION_STRING
Definition: GattNumbers.hpp:121
direct_bt::GattGenericAccessSvc::toString
std::string toString() const noexcept
Definition: GATTNumbers.cpp:382
direct_bt::GattPnP_ID::vendor_id
const uint16_t vendor_id
Definition: GattNumbers.hpp:292
direct_bt::GattCharacteristicPropertyToString
std::string GattCharacteristicPropertyToString(const GattCharacteristicProperty v) noexcept
Definition: GATTNumbers.cpp:259
darray.hpp
direct_bt::GattTemperatureMeasurement::get
static std::shared_ptr< GattTemperatureMeasurement > get(const TROOctets &source) noexcept
Definition: GATTNumbers.cpp:414
direct_bt::GattServiceCharacteristic::toString
std::string toString() const noexcept
Definition: GATTNumbers.cpp:304
direct_bt::Optional
@ Optional
Definition: GattNumbers.hpp:149
direct_bt::MANUFACTURER_NAME_STRING
@ MANUFACTURER_NAME_STRING
Definition: GattNumbers.hpp:124
direct_bt::PERIPHERAL_PRIVACY_FLAG
@ PERIPHERAL_PRIVACY_FLAG
Definition: GattNumbers.hpp:94
direct_bt::MODEL_NUMBER_STRING
@ MODEL_NUMBER_STRING
Definition: GattNumbers.hpp:119
direct_bt::RECONNECTION_ADDRESS
@ RECONNECTION_ADDRESS
Definition: GattNumbers.hpp:95
direct_bt::GattDeviceInformationSvc::regulatoryCertDataList
const POctets regulatoryCertDataList
Optional.
Definition: GattNumbers.hpp:332
direct_bt::TOctets::get_wptr
uint8_t * get_wptr() noexcept
Definition: OctetTypes.hpp:383
direct_bt::WriteNoAck
@ WriteNoAck
Definition: GattNumbers.hpp:133
direct_bt::SOFTWARE_REVISION_STRING
@ SOFTWARE_REVISION_STRING
Definition: GattNumbers.hpp:123
ieee11073::AbsoluteTime::toString
std::string toString() const
Definition: DataTypes.cpp:60
direct_bt::GattPeriphalPreferredConnectionParameters::slaveLatency
const uint16_t slaveLatency
mandatory [1..1000]
Definition: GattNumbers.hpp:247
direct_bt::GattTemperatureMeasurement::temperatureValue
const float temperatureValue
In Celsius if IS_TEMP_FAHRENHEIT is set, otherwise Fahrenheit.
Definition: GattNumbers.hpp:366
direct_bt::GattGenericAccessSvc::appearance
const AppearanceCat appearance
Characteristic: Mandatory [Read: Mandatory; Write: Excluded; ...].
Definition: GattNumbers.hpp:269
direct_bt::if_notify_or_indicate_supported
@ if_notify_or_indicate_supported
Definition: GattNumbers.hpp:152
direct_bt::PNP_ID
@ PNP_ID
Definition: GattNumbers.hpp:126
direct_bt::GattClientCharacteristicConfigSpec::writeWithAck
const GattCharacteristicPropertySpec writeWithAck
Definition: GattNumbers.hpp:167
direct_bt::SYSTEM_ID
@ SYSTEM_ID
Mandatory: uint40.
Definition: GattNumbers.hpp:118
direct_bt
Definition: ATTPDUTypes.hpp:171
direct_bt::findGattCharSpec
const GattCharacteristicSpec * findGattCharSpec(const uint16_t uuid16) noexcept
Find the GattCharacteristicSpec entry by given uuid16, denominating either a GattCharacteristicType.
Definition: GATTNumbers.cpp:332
direct_bt::GattPeriphalPreferredConnectionParameters::connectionSupervisionTimeoutMultiplier
const uint16_t connectionSupervisionTimeoutMultiplier
mandatory [10..3200]
Definition: GattNumbers.hpp:249
direct_bt::GattServiceCharacteristic
Definition: GattNumbers.hpp:195
direct_bt::GattCharacteristicTypeToString
std::string GattCharacteristicTypeToString(const GattCharacteristicType v) noexcept
Definition: GATTNumbers.cpp:239
direct_bt::GattRequirementSpec
GattRequirementSpec
Definition: GattNumbers.hpp:146
SERVICE_TYPE_ENUM
#define SERVICE_TYPE_ENUM(X)
Definition: GATTNumbers.cpp:201
direct_bt::GattGenericAccessSvc::deviceName
const std::string deviceName
Characteristic: Mandatory [Read: Mandatory; Write: Optional; ...].
Definition: GattNumbers.hpp:267
direct_bt::TROOctets::get_ptr
constexpr uint8_t const * get_ptr() const noexcept
Definition: OctetTypes.hpp:228
direct_bt::GattClientCharacteristicConfigSpec::requirement
const GattRequirementSpec requirement
Definition: GattNumbers.hpp:165
direct_bt::GattPnP_ID::vendor_id_source
const uint8_t vendor_id_source
Definition: GattNumbers.hpp:291
direct_bt::Indicate
@ Indicate
Definition: GattNumbers.hpp:136
direct_bt::GattTemperatureMeasurement::hasTemperatureType
bool hasTemperatureType() const noexcept
Definition: GattNumbers.hpp:387
direct_bt::GattCharacteristicType
GattCharacteristicType
GATT Assigned Characteristic Attribute Type for single logical value.
Definition: GattNumbers.hpp:88
direct_bt::GattCharacteristicProperty
GattCharacteristicProperty
Definition: GattNumbers.hpp:130
jau::to_string
PRAGMA_DISABLE_WARNING_POP constexpr_cxx20 std::string to_string(const endian &v) noexcept
Return std::string representation of the given jau::endian.
Definition: byte_util.hpp:198
GattCharacteristicPropertySpec::toString
std::string toString() const noexcept
Definition: test_datatype02.hpp:422
direct_bt::GattPeriphalPreferredConnectionParameters::GattPeriphalPreferredConnectionParameters
GattPeriphalPreferredConnectionParameters(const TROOctets &source) noexcept
Definition: GATTNumbers.cpp:360
direct_bt::AuthSignedWrite
@ AuthSignedWrite
Definition: GattNumbers.hpp:137
CHARACTERISTIC_PROP_ENUM
#define CHARACTERISTIC_PROP_ENUM(X)
Definition: GATTNumbers.cpp:247
direct_bt::GattPnP_ID::product_id
const uint16_t product_id
Definition: GattNumbers.hpp:293
jau::darray
Implementation of a dynamic linear array storage, aka vector.
Definition: darray.hpp:102
direct_bt::GattClientCharacteristicConfigSpec::toString
std::string toString() const noexcept
Definition: GATTNumbers.cpp:288
direct_bt::GattServiceCharacteristic::service
const GattServiceType service
Definition: GattNumbers.hpp:196
direct_bt::GattDeviceInformationSvc::hardwareRevision
const std::string hardwareRevision
Optional.
Definition: GattNumbers.hpp:326
direct_bt::GattCharacteristicSpec::characteristic
const GattCharacteristicType characteristic
Definition: GattNumbers.hpp:173
direct_bt::GattCharacteristicSpec
Definition: GattNumbers.hpp:172
direct_bt::INTERMEDIATE_TEMPERATURE
@ INTERMEDIATE_TEMPERATURE
Definition: GattNumbers.hpp:111
direct_bt::DEVICE_NAME
@ DEVICE_NAME
Definition: GattNumbers.hpp:92
direct_bt::MEASUREMENT_INTERVAL
@ MEASUREMENT_INTERVAL
Definition: GattNumbers.hpp:112
direct_bt::PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS
@ PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS
Definition: GattNumbers.hpp:96
direct_bt::GattPnP_ID::product_version
const uint16_t product_version
Definition: GattNumbers.hpp:294
REQUIREMENT_SPEC_ENUM
#define REQUIREMENT_SPEC_ENUM(X)
Definition: GATTNumbers.cpp:267
direct_bt::TOctets::put_uint8_nc
constexpr void put_uint8_nc(const jau::nsize_t i, const uint8_t v) noexcept
Definition: OctetTypes.hpp:281
direct_bt::GattCharacteristicSpec::toString
std::string toString() const noexcept
Definition: GATTNumbers.cpp:292
direct_bt::GattTemperatureMeasurement::timestamp
const ieee11073::AbsoluteTime timestamp
Timestamp, if HAS_TIMESTAMP is set.
Definition: GattNumbers.hpp:369
direct_bt::GENERIC_ACCESS
@ GENERIC_ACCESS
This service contains generic information about the device.
Definition: GattNumbers.hpp:66
direct_bt::GattPnP_ID::GattPnP_ID
GattPnP_ID() noexcept
Definition: GattNumbers.hpp:298
direct_bt::GattCharacteristicSpec::requirement
const GattRequirementSpec requirement
Definition: GattNumbers.hpp:174
direct_bt::REGULATORY_CERT_DATA_LIST
@ REGULATORY_CERT_DATA_LIST
Definition: GattNumbers.hpp:125
direct_bt::findGattServiceChar
const GattServiceCharacteristic * findGattServiceChar(const uint16_t uuid16) noexcept
Find the GattServiceCharacteristic entry by given uuid16, denominating either a GattServiceType or Ga...
Definition: GATTNumbers.cpp:316
direct_bt::GattDeviceInformationSvc::toString
std::string toString() const noexcept
Definition: GATTNumbers.cpp:407
direct_bt::DEVICE_INFORMATION
@ DEVICE_INFORMATION
This service exposes manufacturer and/or vendor information about a device.
Definition: GattNumbers.hpp:76
jau::darray::size
constexpr size_type size() const noexcept
Like std::vector::size().
Definition: darray.hpp:668
direct_bt::GattTemperatureMeasurement::temperature_type
const uint8_t temperature_type
Temperature Type, if HAS_TEMP_TYPE is set: Format ????.
Definition: GattNumbers.hpp:372
direct_bt::if_characteristic_supported
@ if_characteristic_supported
Definition: GattNumbers.hpp:151
direct_bt::SERIAL_NUMBER_STRING
@ SERIAL_NUMBER_STRING
Definition: GattNumbers.hpp:120
direct_bt::GattDeviceInformationSvc::pnpID
const std::shared_ptr< GattPnP_ID > pnpID
Optional.
Definition: GattNumbers.hpp:334
direct_bt::GattCharacteristicSpec::propertySpec
const jau::darray< GattCharacteristicPropertySpec > propertySpec
Aggregated in PropertySpecIdx order.
Definition: GattNumbers.hpp:188
direct_bt::GattDeviceInformationSvc::manufacturer
const std::string manufacturer
Optional.
Definition: GattNumbers.hpp:330
direct_bt::GattTemperatureMeasurement::isFahrenheit
bool isFahrenheit() const noexcept
Definition: GattNumbers.hpp:385
debug.hpp
direct_bt::Excluded
@ Excluded
Definition: GattNumbers.hpp:147
direct_bt::TEMPERATURE_MEASUREMENT
@ TEMPERATURE_MEASUREMENT
Definition: GattNumbers.hpp:108
direct_bt::Conditional
@ Conditional
Definition: GattNumbers.hpp:150
direct_bt::GattGenericAccessSvc::prefConnParam
const std::shared_ptr< GattPeriphalPreferredConnectionParameters > prefConnParam
Characteristic: Optional [Read: Mandatory; Write: Excluded; ...].
Definition: GattNumbers.hpp:275
direct_bt::GattDeviceInformationSvc::serialNumber
const std::string serialNumber
Optional.
Definition: GattNumbers.hpp:322
direct_bt::GATT_HEALTH_THERMOMETER_SRVC
const GattServiceCharacteristic GATT_HEALTH_THERMOMETER_SRVC
https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Services/org....
Definition: GATTNumbers.cpp:86
direct_bt::TROOctets
Transient read only octet data, i.e.
Definition: OctetTypes.hpp:59
direct_bt::HARDWARE_REVISION_STRING
@ HARDWARE_REVISION_STRING
Definition: GattNumbers.hpp:122
direct_bt::GattPeriphalPreferredConnectionParameters::maxConnectionInterval
const uint16_t maxConnectionInterval
mandatory [6..3200] x 1.25ms and >= minConnectionInterval
Definition: GattNumbers.hpp:245
direct_bt::to_string
std::string to_string(const BDAddressType type) noexcept
Definition: BTTypes0.cpp:129
direct_bt::GattPeriphalPreferredConnectionParameters::minConnectionInterval
const uint16_t minConnectionInterval
mandatory [6..3200] x 1.25ms
Definition: GattNumbers.hpp:243
direct_bt::GATT_SERVICES
const jau::darray< const GattServiceCharacteristic * > GATT_SERVICES
Definition: GATTNumbers.cpp:196
direct_bt::GattCharacteristicPropertySpec::requirement
const GattRequirementSpec requirement
Definition: GattNumbers.hpp:159
ieee11073::AbsoluteTime
date / timestamp format
Definition: DataTypes.hpp:73
direct_bt::GattServiceCharacteristic::characteristics
const jau::darray< GattCharacteristicSpec > characteristics
Definition: GattNumbers.hpp:197
jau::to_hexstring
std::string to_hexstring(value_type const &v) noexcept
Produce a lower-case hexadecimal string representation of the given pointer.
Definition: string_util.hpp:104
jau::nsize_t
uint_fast32_t nsize_t
Natural 'size_t' alternative using uint_fast32_t as its natural sized type.
Definition: int_types.hpp:44
direct_bt::GattNameToString
std::string GattNameToString(const TROOctets &v) noexcept
Converts a GATT Name (not null-terminated) UTF8 to a null-terminated C++ string.
Definition: GATTNumbers.cpp:349
direct_bt::GATT_DEVICE_INFORMATION_SRVC
const GattServiceCharacteristic GATT_DEVICE_INFORMATION_SRVC
Definition: GATTNumbers.cpp:121
ERR_PRINT
#define ERR_PRINT(...)
Use for unconditional error messages, prefix '[elapsed_time] Error @ FILE:LINE: '.
Definition: debug.hpp:132
GattNumbers.hpp
direct_bt::GattDeviceInformationSvc::softwareRevision
const std::string softwareRevision
Optional.
Definition: GattNumbers.hpp:328
direct_bt::Mandatory
@ Mandatory
Definition: GattNumbers.hpp:148
direct_bt::POctets::toString
std::string toString() const
Definition: OctetTypes.hpp:666
direct_bt::GattRequirementSpecToString
std::string GattRequirementSpecToString(const GattRequirementSpec v) noexcept
Definition: GATTNumbers.cpp:276
direct_bt::C1
@ C1
Definition: GattNumbers.hpp:153
direct_bt::GattServiceTypeToString
std::string GattServiceTypeToString(const GattServiceType v) noexcept
Definition: GATTNumbers.cpp:207
direct_bt::GattPnP_ID::get
static std::shared_ptr< GattPnP_ID > get(const TROOctets &source) noexcept
Definition: GATTNumbers.cpp:391
direct_bt::POctets
Persistent octet data, i.e.
Definition: OctetTypes.hpp:451
direct_bt::GattCharacteristicSpec::clientConfig
const GattClientCharacteristicConfigSpec clientConfig
Definition: GattNumbers.hpp:190
direct_bt::TEMPERATURE_TYPE
@ TEMPERATURE_TYPE
Mandatory: 8bit: 1 armpit, 2 body (general), 3(ear), 4 (finger), ...
Definition: GattNumbers.hpp:110
direct_bt::ReliableWriteExt
@ ReliableWriteExt
FIXME: extension?
Definition: GattNumbers.hpp:140
direct_bt::AuxWriteExt
@ AuxWriteExt
FIXME: extension?
Definition: GattNumbers.hpp:142
direct_bt::HEALTH_THERMOMETER
@ HEALTH_THERMOMETER
This service exposes temperature and other data from a thermometer intended for healthcare and fitnes...
Definition: GattNumbers.hpp:74
direct_bt::GattDeviceInformationSvc::firmwareRevision
const std::string firmwareRevision
Optional.
Definition: GattNumbers.hpp:324
direct_bt::APPEARANCE
@ APPEARANCE
Definition: GattNumbers.hpp:93
direct_bt::GattPeriphalPreferredConnectionParameters::get
static std::shared_ptr< GattPeriphalPreferredConnectionParameters > get(const TROOctets &source) noexcept
Definition: GATTNumbers.cpp:366
direct_bt::GattPnP_ID::toString
std::string toString() const noexcept
Definition: GATTNumbers.cpp:400
CHARACTERISTIC_TYPE_ENUM
#define CHARACTERISTIC_TYPE_ENUM(X)
Definition: GATTNumbers.cpp:215
direct_bt::GattClientCharacteristicConfigSpec::read
const GattCharacteristicPropertySpec read
Definition: GattNumbers.hpp:166
ieee11073::FloatTypes::float32_IEEE11073_to_IEEE754
static float float32_IEEE11073_to_IEEE754(const uint32_t raw_bt_float32_le)
Converts a 'IEEE-11073 32-bit FLOAT' to std IEEE754 float.
Definition: DataTypes.cpp:97
direct_bt::GattTemperatureMeasurement::toString
std::string toString() const noexcept
Definition: GATTNumbers.cpp:453
direct_bt::GattCharacteristicPropertySpec::property
const GattCharacteristicProperty property
Definition: GattNumbers.hpp:158
direct_bt::GATT_GENERIC_ACCESS_SRVC
const GattServiceCharacteristic GATT_GENERIC_ACCESS_SRVC
Intentionally ease compile and linker burden by using 'extern' instead of 'inline',...
Definition: GATTNumbers.cpp:42
direct_bt::GattTemperatureMeasurement::hasTimestamp
bool hasTimestamp() const noexcept
Definition: GattNumbers.hpp:386
CASE_TO_STRING
#define CASE_TO_STRING(V)
Definition: GATTNumbers.cpp:199