diff options
Diffstat (limited to 'examples/direct_bt_scanner10')
-rw-r--r-- | examples/direct_bt_scanner10/dbt_scanner10.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/examples/direct_bt_scanner10/dbt_scanner10.cpp b/examples/direct_bt_scanner10/dbt_scanner10.cpp index bde839d8..4a4e7bd8 100644 --- a/examples/direct_bt_scanner10/dbt_scanner10.cpp +++ b/examples/direct_bt_scanner10/dbt_scanner10.cpp @@ -193,11 +193,11 @@ class MyAdapterStatusListener : public AdapterStatusListener { static const uuid16_t _TEMPERATURE_MEASUREMENT(GattCharacteristicType::TEMPERATURE_MEASUREMENT); -class MyGATTEventListener : public SpecificGATTCharacteristicListener { +class MyGATTEventListener : public AssociatedGATTCharacteristicListener { public: MyGATTEventListener(const GATTCharacteristic * characteristicMatch) - : SpecificGATTCharacteristicListener(characteristicMatch) {} + : AssociatedGATTCharacteristicListener(characteristicMatch) {} void notificationReceived(GATTCharacteristicRef charDecl, std::shared_ptr<TROOctets> charValue, const uint64_t timestamp) override { const std::shared_ptr<DBTDevice> dev = charDecl->getDevice(); @@ -306,12 +306,10 @@ static void processConnectedDevice(std::shared_ptr<DBTDevice> device) { } } bool cccdEnableResult[2]; - bool cccdRet = serviceChar.configIndicationNotification(true /* enableNotification */, true /* enableIndication */, cccdEnableResult); - fprintf(stderr, " [%2.2d.%2.2d] Config Notification(%d), Indication(%d): Result %d\n", + bool cccdRet = serviceChar.addCharacteristicListener( std::shared_ptr<GATTCharacteristicListener>( new MyGATTEventListener(&serviceChar) ), + cccdEnableResult ); + fprintf(stderr, " [%2.2d.%2.2d] addCharacteristicListener Notification(%d), Indication(%d): Result %d\n", (int)i, (int)j, cccdEnableResult[0], cccdEnableResult[1], cccdRet); - if( cccdRet ) { - serviceChar.addCharacteristicListener( std::shared_ptr<GATTCharacteristicListener>( new MyGATTEventListener(&serviceChar) ) ); - } } } // FIXME sleep 1s for potential callbacks .. |