diff options
Diffstat (limited to 'src/direct_bt/BTGattService.cpp')
-rw-r--r-- | src/direct_bt/BTGattService.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/direct_bt/BTGattService.cpp b/src/direct_bt/BTGattService.cpp index 01000854..a54e429d 100644 --- a/src/direct_bt/BTGattService.cpp +++ b/src/direct_bt/BTGattService.cpp @@ -43,7 +43,7 @@ using namespace direct_bt; using namespace jau; -std::shared_ptr<BTGattHandler> BTGattService::getGattHandlerChecked() const { +BTGattHandlerRef BTGattService::getGattHandlerChecked() const { std::shared_ptr<BTGattHandler> ref = wbr_handler.lock(); if( nullptr == ref ) { throw IllegalStateException("GATTService's GATTHandler already destructed: "+toShortString(), E_FILE_LINE); @@ -51,7 +51,7 @@ std::shared_ptr<BTGattHandler> BTGattService::getGattHandlerChecked() const { return ref; } -std::shared_ptr<BTDevice> BTGattService::getDeviceUnchecked() const noexcept { +BTDeviceRef BTGattService::getDeviceUnchecked() const noexcept { std::shared_ptr<BTGattHandler> h = getGattHandlerUnchecked(); if( nullptr != h ) { return h->getDeviceUnchecked(); @@ -59,11 +59,11 @@ std::shared_ptr<BTDevice> BTGattService::getDeviceUnchecked() const noexcept { return nullptr; } -std::shared_ptr<BTDevice> BTGattService::getDeviceChecked() const { +BTDeviceRef BTGattService::getDeviceChecked() const { return getGattHandlerChecked()->getDeviceChecked(); } -std::shared_ptr<BTGattChar> BTGattService::findGattChar(const jau::uuid_t& char_uuid) noexcept { +BTGattCharRef BTGattService::findGattChar(const jau::uuid_t& char_uuid) noexcept { for(BTGattCharRef& c : characteristicList) { if( nullptr != c && char_uuid.equivalent( *(c->value_type) ) ) { return c; @@ -72,6 +72,15 @@ std::shared_ptr<BTGattChar> BTGattService::findGattChar(const jau::uuid_t& char_ return nullptr; } +BTGattCharRef BTGattService::findGattChar(const BTGattChar& characteristic) noexcept { + for(BTGattCharRef& c : characteristicList) { + if( nullptr != c && characteristic == *c ) { + return c; + } + } + return nullptr; +} + std::string BTGattService::toString() const noexcept { std::string name = ""; if( uuid_t::TypeSize::UUID16_SZ == type->getTypeSize() ) { |