43const std::shared_ptr<jau::uuid_t> BTGattDesc::TYPE_EXT_PROP( std::make_shared<jau::uuid16_t>(Type::CHARACTERISTIC_EXTENDED_PROPERTIES) );
44const std::shared_ptr<jau::uuid_t> BTGattDesc::TYPE_USER_DESC( std::make_shared<jau::uuid16_t>(Type::CHARACTERISTIC_USER_DESCRIPTION) );
45const std::shared_ptr<jau::uuid_t> BTGattDesc::TYPE_CCC_DESC( std::make_shared<jau::uuid16_t>(Type::CLIENT_CHARACTERISTIC_CONFIGURATION) );
47std::shared_ptr<BTGattChar> BTGattDesc::getGattCharChecked()
const {
48 std::shared_ptr<BTGattChar> ref = wbr_char.lock();
49 if(
nullptr == ref ) {
58 return c->getGattHandlerUnchecked();
66 return c->getDeviceUnchecked();
72 std::shared_ptr<BTDevice> device = getDeviceUnchecked();
73 if(
nullptr == device ) {
74 ERR_PRINT(
"Descriptor's device null: %s", toShortString().c_str());
77 std::shared_ptr<BTGattHandler> gatt = device->getGattHandler();
78 if(
nullptr == gatt ) {
79 ERR_PRINT(
"Descriptor's device GATTHandle not connected: %s", toShortString().c_str());
82 return gatt->readDescriptorValue(*
this, expectedLength);
87 if(
nullptr == device ) {
88 ERR_PRINT(
"Descriptor's device null: %s", toShortString().c_str());
91 std::shared_ptr<BTGattHandler> gatt = device->getGattHandler();
92 if(
nullptr == gatt ) {
93 ERR_PRINT(
"Descriptor's device GATTHandle not connected: %s", toShortString().c_str());
96 return gatt->writeDescriptorValue(*
this);
106std::string BTGattDesc::toShortString() const noexcept {
bool writeValue() noexcept
BT Core Spec v5.2: Vol 3, Part G GATT: 4.12.3 Write Characteristic Descriptors.
const uint16_t handle
Characteristic Descriptor Handle.
std::shared_ptr< BTGattChar > getGattCharUnchecked() const noexcept
std::unique_ptr< const jau::uuid_t > type
Type of descriptor.
bool readValue(int expectedLength=-1) noexcept
BT Core Spec v5.2: Vol 3, Part G GATT: 4.12.1 Read Characteristic Descriptor.
std::string toString() const noexcept override
std::shared_ptr< BTGattHandler > getGattHandlerUnchecked() const noexcept
std::shared_ptr< BTDevice > getDeviceUnchecked() const noexcept
std::string toString() const
constexpr nsize_t size() const noexcept
Returns the used memory size for read and write operations, may be zero.
constexpr uint8_t const * get_ptr() const noexcept
#define ERR_PRINT(...)
Use for unconditional error messages, prefix '[elapsed_time] Error @ FILE:LINE FUNC: '.
uint32_t dfa_utf8_decode(uint32_t &state, uint32_t &codep, const uint32_t byte_value)
std::string to_hexstring(value_type const &v) noexcept
Produce a lower-case hexadecimal string representation of the given pointer.