Direct-BT
2.3.1
Direct-BT - Direct Bluetooth Programming.
|
Go to the documentation of this file.
199 #define CASE_TO_STRING(V) case V: return #V;
201 #define SERVICE_TYPE_ENUM(X) \
203 X(HEALTH_THERMOMETER) \
204 X(DEVICE_INFORMATION) \
215 #define CHARACTERISTIC_TYPE_ENUM(X) \
218 X(PERIPHERAL_PRIVACY_FLAG) \
219 X(RECONNECTION_ADDRESS) \
220 X(PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS) \
222 X(TEMPERATURE_CELSIUS) \
223 X(TEMPERATURE_FAHRENHEIT) \
224 X(TEMPERATURE_MEASUREMENT) \
225 X(TEMPERATURE_TYPE) \
226 X(INTERMEDIATE_TEMPERATURE) \
227 X(MEASUREMENT_INTERVAL) \
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) \
247 #define CHARACTERISTIC_PROP_ENUM(X) \
256 X(ReliableWriteExt) \
267 #define REQUIREMENT_SPEC_ENUM(X) \
272 X(if_characteristic_supported) \
273 X(if_notify_or_indicate_supported) \
319 if( uuid16 == serviceChar.
service ) {
352 return std::string();
355 memcpy(s.
get_wptr(), v.get_ptr(), str_len);
357 return std::string((
const char*)s.
get_ptr());
361 : minConnectionInterval(source.get_uint16(0)), maxConnectionInterval(source.get_uint16(2)),
362 slaveLatency(source.get_uint16(4)), connectionSupervisionTimeoutMultiplier(source.get_uint16(6))
368 if( source.getSize() < reqSize ) {
369 ERR_PRINT(
"GattPeriphalPreferredConnectionParameters: Insufficient data, less than %d bytes in %s", reqSize, source.toString().c_str());
372 return std::make_shared<GattPeriphalPreferredConnectionParameters>(source);
376 return "PrefConnectionParam[interval["+
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)) {}
393 if( source.getSize() < reqSize ) {
394 ERR_PRINT(
"GattPnP_ID: Insufficient data, less than %d bytes in %s", reqSize, source.toString().c_str());
397 return std::make_shared<GattPnP_ID>(source);
408 std::string pnp(
nullptr !=
pnpID ?
pnpID->toString() :
"");
417 if( reqSize > size ) {
419 ERR_PRINT(
"GattTemperatureMeasurement: Insufficient data, less than %d bytes in %s", reqSize, source.toString().c_str());
423 uint8_t flags = source.get_uint8(0);
424 bool hasTimestamp = 0 != ( flags & Bits::HAS_TIMESTAMP );
428 bool hasTemperatureType = 0 != ( flags & Bits::HAS_TEMP_TYPE );
429 if( hasTemperatureType ) {
432 if( reqSize > size ) {
436 uint32_t raw_temp_value = source.get_uint32(1);
441 if( hasTemperatureType ) {
446 uint8_t temperature_type=0;
447 if( hasTemperatureType ) {
448 temperature_type = source.get_uint8(1+4+7);
450 return std::make_shared<GattTemperatureMeasurement>(flags, temperatureValue, timestamp, temperature_type);
std::string toString() const noexcept
const_reference at(size_type i) const
Like std::vector::at(size_type), immutable reference.
std::string toString() const noexcept
std::string toString() const noexcept
GattServiceType
GATT Service Type, each encapsulating a set of Characteristics.
@ FIRMWARE_REVISION_STRING
std::string toString() const noexcept
std::string GattCharacteristicPropertyToString(const GattCharacteristicProperty v) noexcept
static std::shared_ptr< GattTemperatureMeasurement > get(const TROOctets &source) noexcept
std::string toString() const noexcept
@ MANUFACTURER_NAME_STRING
@ PERIPHERAL_PRIVACY_FLAG
uint8_t * get_wptr() noexcept
@ SOFTWARE_REVISION_STRING
std::string toString() const
const uint16_t slaveLatency
mandatory [1..1000]
const float temperatureValue
In Celsius if IS_TEMP_FAHRENHEIT is set, otherwise Fahrenheit.
const AppearanceCat appearance
Characteristic: Mandatory [Read: Mandatory; Write: Excluded; ...].
@ if_notify_or_indicate_supported
const GattCharacteristicPropertySpec writeWithAck
@ SYSTEM_ID
Mandatory: uint40.
const GattCharacteristicSpec * findGattCharSpec(const uint16_t uuid16) noexcept
Find the GattCharacteristicSpec entry by given uuid16, denominating either a GattCharacteristicType.
const uint16_t connectionSupervisionTimeoutMultiplier
mandatory [10..3200]
std::string GattCharacteristicTypeToString(const GattCharacteristicType v) noexcept
#define SERVICE_TYPE_ENUM(X)
const std::string deviceName
Characteristic: Mandatory [Read: Mandatory; Write: Optional; ...].
constexpr uint8_t const * get_ptr() const noexcept
const GattRequirementSpec requirement
const uint8_t vendor_id_source
bool hasTemperatureType() const noexcept
GattCharacteristicType
GATT Assigned Characteristic Attribute Type for single logical value.
GattCharacteristicProperty
PRAGMA_DISABLE_WARNING_POP constexpr_cxx20 std::string to_string(const endian &v) noexcept
Return std::string representation of the given jau::endian.
std::string toString() const noexcept
GattPeriphalPreferredConnectionParameters(const TROOctets &source) noexcept
#define CHARACTERISTIC_PROP_ENUM(X)
const uint16_t product_id
Implementation of a dynamic linear array storage, aka vector.
std::string toString() const noexcept
const GattServiceType service
const GattCharacteristicType characteristic
@ INTERMEDIATE_TEMPERATURE
@ PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS
const uint16_t product_version
#define REQUIREMENT_SPEC_ENUM(X)
constexpr void put_uint8_nc(const jau::nsize_t i, const uint8_t v) noexcept
std::string toString() const noexcept
const ieee11073::AbsoluteTime timestamp
Timestamp, if HAS_TIMESTAMP is set.
@ GENERIC_ACCESS
This service contains generic information about the device.
const GattRequirementSpec requirement
@ REGULATORY_CERT_DATA_LIST
const GattServiceCharacteristic * findGattServiceChar(const uint16_t uuid16) noexcept
Find the GattServiceCharacteristic entry by given uuid16, denominating either a GattServiceType or Ga...
@ DEVICE_INFORMATION
This service exposes manufacturer and/or vendor information about a device.
constexpr size_type size() const noexcept
Like std::vector::size().
const uint8_t temperature_type
Temperature Type, if HAS_TEMP_TYPE is set: Format ????.
@ if_characteristic_supported
const jau::darray< GattCharacteristicPropertySpec > propertySpec
Aggregated in PropertySpecIdx order.
bool isFahrenheit() const noexcept
@ TEMPERATURE_MEASUREMENT
const std::shared_ptr< GattPeriphalPreferredConnectionParameters > prefConnParam
Characteristic: Optional [Read: Mandatory; Write: Excluded; ...].
const GattServiceCharacteristic GATT_HEALTH_THERMOMETER_SRVC
https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Services/org....
Transient read only octet data, i.e.
@ HARDWARE_REVISION_STRING
const uint16_t maxConnectionInterval
mandatory [6..3200] x 1.25ms and >= minConnectionInterval
std::string to_string(const BDAddressType type) noexcept
const uint16_t minConnectionInterval
mandatory [6..3200] x 1.25ms
const jau::darray< const GattServiceCharacteristic * > GATT_SERVICES
const GattRequirementSpec requirement
const jau::darray< GattCharacteristicSpec > characteristics
std::string to_hexstring(value_type const &v) noexcept
Produce a lower-case hexadecimal string representation of the given pointer.
uint_fast32_t nsize_t
Natural 'size_t' alternative using uint_fast32_t as its natural sized type.
std::string GattNameToString(const TROOctets &v) noexcept
Converts a GATT Name (not null-terminated) UTF8 to a null-terminated C++ string.
const GattServiceCharacteristic GATT_DEVICE_INFORMATION_SRVC
#define ERR_PRINT(...)
Use for unconditional error messages, prefix '[elapsed_time] Error @ FILE:LINE: '.
std::string toString() const
std::string GattRequirementSpecToString(const GattRequirementSpec v) noexcept
std::string GattServiceTypeToString(const GattServiceType v) noexcept
static std::shared_ptr< GattPnP_ID > get(const TROOctets &source) noexcept
Persistent octet data, i.e.
const GattClientCharacteristicConfigSpec clientConfig
@ TEMPERATURE_TYPE
Mandatory: 8bit: 1 armpit, 2 body (general), 3(ear), 4 (finger), ...
@ ReliableWriteExt
FIXME: extension?
@ AuxWriteExt
FIXME: extension?
@ HEALTH_THERMOMETER
This service exposes temperature and other data from a thermometer intended for healthcare and fitnes...
static std::shared_ptr< GattPeriphalPreferredConnectionParameters > get(const TROOctets &source) noexcept
std::string toString() const noexcept
#define CHARACTERISTIC_TYPE_ENUM(X)
const GattCharacteristicPropertySpec read
static float float32_IEEE11073_to_IEEE754(const uint32_t raw_bt_float32_le)
Converts a 'IEEE-11073 32-bit FLOAT' to std IEEE754 float.
std::string toString() const noexcept
const GattCharacteristicProperty property
const GattServiceCharacteristic GATT_GENERIC_ACCESS_SRVC
Intentionally ease compile and linker burden by using 'extern' instead of 'inline',...
bool hasTimestamp() const noexcept
#define CASE_TO_STRING(V)