41#if defined(DIRECTBT_BUILDIN_GATT_SERVICE_CHARACTERISTIC_SPEC)
46struct Lala0 {
int a;
int b; };
232 if( uuid16 == serviceChar.
service ) {
260#define CASE_TO_STRING(V) case V: return #V;
262#define SERVICE_TYPE_ENUM(X) \
264 X(HEALTH_THERMOMETER) \
265 X(DEVICE_INFORMATION) \
276#define CHARACTERISTIC_TYPE_ENUM(X) \
279 X(PERIPHERAL_PRIVACY_FLAG) \
280 X(RECONNECTION_ADDRESS) \
281 X(PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS) \
283 X(TEMPERATURE_CELSIUS) \
284 X(TEMPERATURE_FAHRENHEIT) \
285 X(TEMPERATURE_MEASUREMENT) \
286 X(TEMPERATURE_TYPE) \
287 X(INTERMEDIATE_TEMPERATURE) \
288 X(MEASUREMENT_INTERVAL) \
290 X(MODEL_NUMBER_STRING) \
291 X(SERIAL_NUMBER_STRING) \
292 X(FIRMWARE_REVISION_STRING) \
293 X(HARDWARE_REVISION_STRING) \
294 X(SOFTWARE_REVISION_STRING) \
295 X(MANUFACTURER_NAME_STRING) \
296 X(REGULATORY_CERT_DATA_LIST) \
308#define CHARACTERISTIC_PROP_ENUM(X) \
317 X(ReliableWriteExt) \
328#define REQUIREMENT_SPEC_ENUM(X) \
333 X(if_characteristic_supported) \
334 X(if_notify_or_indicate_supported) \
384 return std::string();
389 uint8_t
const *
const v_p = v.get_ptr();
390 if(
nullptr == v_p ) {
391 return std::string();
394 if(
nullptr == s_p ) {
395 return std::string();
397 memcpy(s_p, v_p, str_len);
400 return std::string((
const char*)s.
get_ptr());
404: minConnectionInterval(source.get_uint16(0)), maxConnectionInterval(source.get_uint16(2)),
405 slaveLatency(source.get_uint16(4)), connectionSupervisionTimeoutMultiplier(source.get_uint16(6))
411 if( source.size() < reqSize ) {
412 ERR_PRINT(
"GattPeriphalPreferredConnectionParameters: Insufficient data, less than %d bytes in %s", reqSize, source.toString().c_str());
415 return std::make_shared<GattPeriphalPreferredConnectionParameters>(source);
419 return "PrefConnectionParam[interval["+
431: vendor_id_source(source.get_uint8(0)), vendor_id(source.get_uint16(1)),
432 product_id(source.get_uint16(3)), product_version(source.get_uint16(5)) {}
436 if( source.size() < reqSize ) {
437 ERR_PRINT(
"GattPnP_ID: Insufficient data, less than %d bytes in %s", reqSize, source.toString().c_str());
440 return std::make_shared<GattPnP_ID>(source);
451 std::string pnp(
nullptr !=
pnpID ?
pnpID->toString() :
"");
460 if( reqSize > size ) {
462 ERR_PRINT(
"GattTemperatureMeasurement: Insufficient data, less than %d bytes in %s", reqSize, source.toString().c_str());
466 uint8_t flags = source.get_uint8(0);
467 bool hasTimestamp = 0 != ( flags & Bits::HAS_TIMESTAMP );
471 bool hasTemperatureType = 0 != ( flags & Bits::HAS_TEMP_TYPE );
472 if( hasTemperatureType ) {
475 if( reqSize > size ) {
479 uint32_t raw_temp_value = source.get_uint32(1);
484 if( hasTemperatureType ) {
489 uint8_t temperature_type=0;
490 if( hasTemperatureType ) {
491 temperature_type = source.get_uint8(1+4+7);
493 return std::make_shared<GattTemperatureMeasurement>(flags, temperatureValue, timestamp, temperature_type);
#define CASE_TO_STRING(V)
#define CHARACTERISTIC_TYPE_ENUM(X)
#define CHARACTERISTIC_PROP_ENUM(X)
#define SERVICE_TYPE_ENUM(X)
#define REQUIREMENT_SPEC_ENUM(X)
const AppearanceCat appearance
Characteristic: Mandatory [Read: Mandatory; Write: Excluded; ...].
const std::string deviceName
Characteristic: Mandatory [Read: Mandatory; Write: Optional; ...].
const std::shared_ptr< GattPeriphalPreferredConnectionParameters > prefConnParam
Characteristic: Optional [Read: Mandatory; Write: Excluded; ...].
std::string toString() const noexcept
static std::shared_ptr< GattTemperatureMeasurement > get(const jau::TROOctets &source) noexcept
const ieee11073::AbsoluteTime timestamp
Timestamp, if HAS_TIMESTAMP is set.
std::string toString() const noexcept
const uint8_t temperature_type
Temperature Type, if HAS_TEMP_TYPE is set: Format ????.
bool isFahrenheit() const noexcept
bool hasTimestamp() const noexcept
bool hasTemperatureType() const noexcept
const float temperatureValue
In Celsius if IS_TEMP_FAHRENHEIT is set, otherwise Fahrenheit.
std::string toString() const
static float float32_IEEE11073_to_IEEE754(const uint32_t raw_bt_float32_le)
Converts a 'IEEE-11073 32-bit FLOAT' to std IEEE754 float.
Persistent endian aware octet data, i.e.
std::string toString() const
constexpr void put_uint8_nc(const nsize_t i, const uint8_t v) noexcept
uint8_t * get_wptr() noexcept
Transient read only and endian aware octet data, i.e.
constexpr uint8_t const * get_ptr() const noexcept
constexpr size_type size() const noexcept
Like std::vector::size().
const_reference at(size_type i) const
Like std::vector::at(size_type), immutable reference.
#define ERR_PRINT(...)
Use for unconditional error messages, prefix '[elapsed_time] Error @ FILE:LINE FUNC: '.
@ little
Identifier for little endian, equivalent to endian::little.
std::string to_string(const alphabet &v) noexcept
std::string GattRequirementSpecToString(const GattRequirementSpec v) noexcept
std::string GattNameToString(const jau::TROOctets &v) noexcept
Converts a GATT Name (not null-terminated) UTF8 to a null-terminated C++ string.
std::string to_string(const DiscoveryPolicy v) noexcept
GattCharacteristicProperty
std::string GattCharacteristicTypeToString(const GattCharacteristicType v) noexcept
std::string GattCharacteristicPropertyToString(const GattCharacteristicProperty v) noexcept
std::string GattServiceTypeToString(const GattServiceType v) noexcept
GattServiceType
GATT Service Type, each encapsulating a set of Characteristics.
GattCharacteristicType
GATT Assigned Characteristic Attribute Type for single logical value.
constexpr darray< First > make_darray(First &&arg1, Next &&... argsN)
Construct a darray<T> instance, initialized by move semantics from the variadic (template pack) argum...
uint_fast32_t nsize_t
Natural 'size_t' alternative using uint_fast32_t as its natural sized type.
std::string to_hexstring(value_type const &v) noexcept
Produce a lower-case hexadecimal string representation of the given pointer.
std::string toString() const noexcept
std::string toString() const noexcept
GattCharacteristicProperty property
std::string toString() const noexcept
GattRequirementSpec requirement
jau::darray< GattCharacteristicPropertySpec > propertySpec
Aggregated in PropertySpecIdx order.
GattClientCharacteristicConfigSpec clientConfig
GattCharacteristicType characteristic
GattRequirementSpec requirement
std::string toString() const noexcept
GattCharacteristicPropertySpec writeWithAck
GattCharacteristicPropertySpec read
GattRequirementSpec requirement
std::string toString() const noexcept
std::string toString() const noexcept
GattPeriphalPreferredConnectionParameters(const jau::TROOctets &source) noexcept
const uint16_t connectionSupervisionTimeoutMultiplier
mandatory [10..3200]
const uint16_t minConnectionInterval
mandatory [6..3200] x 1.25ms
static std::shared_ptr< GattPeriphalPreferredConnectionParameters > get(const jau::TROOctets &source) noexcept
const uint16_t maxConnectionInterval
mandatory [6..3200] x 1.25ms and >= minConnectionInterval
const uint16_t slaveLatency
mandatory [1..1000]
static std::shared_ptr< GattPnP_ID > get(const jau::TROOctets &source) noexcept
const uint16_t product_version
const uint8_t vendor_id_source
const uint16_t product_id
std::string toString() const noexcept
std::string toString() const noexcept
jau::darray< GattCharacteristicSpec > characteristics
@ GENERIC_ACCESS
This service contains generic information about the device.
@ HEALTH_THERMOMETER
This service exposes temperature and other data from a thermometer intended for healthcare and fitnes...
@ DEVICE_INFORMATION
This service exposes manufacturer and/or vendor information about a device.
const jau::darray< const GattServiceCharacteristic * > GATT_SERVICES
@ ReliableWriteExt
FIXME: extension?
@ AuxWriteExt
FIXME: extension?
@ if_characteristic_supported
@ if_notify_or_indicate_supported
const GattServiceCharacteristic GATT_HEALTH_THERMOMETER_SRVC
https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Services/org....
const GattServiceCharacteristic GATT_DEVICE_INFORMATION_SRVC
const GattServiceCharacteristic GATT_GENERIC_ACCESS_SRVC
@ SOFTWARE_REVISION_STRING
@ REGULATORY_CERT_DATA_LIST
@ MANUFACTURER_NAME_STRING
@ PERIPHERAL_PRIVACY_FLAG
@ PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS
@ TEMPERATURE_MEASUREMENT
@ FIRMWARE_REVISION_STRING
@ TEMPERATURE_TYPE
Mandatory: 8bit: 1 armpit, 2 body (general), 3(ear), 4 (finger), ...
@ SYSTEM_ID
Mandatory: uint40.
@ INTERMEDIATE_TEMPERATURE
@ HARDWARE_REVISION_STRING