diff options
author | Sven Gothel <[email protected]> | 2020-05-28 19:07:20 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-05-28 19:07:20 +0200 |
commit | fafc8db2ed2f2975148665e7224412b72ac03df2 (patch) | |
tree | dd6ac35e6db3617fee632003cc2a005a6d99c516 /examples/direct_bt_scanner00 | |
parent | 7af0d9dee655f67b8531f3e42cb318b54259e135 (diff) |
AdapterStatusListener (C++): Add toString() for error handling purposes; DBTDevice::toString(..) defaults to not incl. services
Diffstat (limited to 'examples/direct_bt_scanner00')
-rw-r--r-- | examples/direct_bt_scanner00/dbt_scanner00.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/direct_bt_scanner00/dbt_scanner00.cpp b/examples/direct_bt_scanner00/dbt_scanner00.cpp index 57d3d41a..09bb83e6 100644 --- a/examples/direct_bt_scanner00/dbt_scanner00.cpp +++ b/examples/direct_bt_scanner00/dbt_scanner00.cpp @@ -62,7 +62,7 @@ class MyAdapterStatusListener : public AdapterStatusListener { } void deviceFound(std::shared_ptr<DBTDevice> device, const uint64_t timestamp) override { - fprintf(stderr, "****** FOUND__: %s\n", device->toString().c_str()); + fprintf(stderr, "****** FOUND__: %s\n", device->toString(true).c_str()); fprintf(stderr, "Status Adapter:\n"); fprintf(stderr, "%s\n", device->getAdapter().toString().c_str()); { @@ -73,17 +73,21 @@ class MyAdapterStatusListener : public AdapterStatusListener { (void)timestamp; } void deviceUpdated(std::shared_ptr<DBTDevice> device, const uint64_t timestamp, const EIRDataType updateMask) override { - fprintf(stderr, "****** UPDATED: %s of %s\n", eirDataMaskToString(updateMask).c_str(), device->toString().c_str()); + fprintf(stderr, "****** UPDATED: %s of %s\n", eirDataMaskToString(updateMask).c_str(), device->toString(true).c_str()); fprintf(stderr, "Status Adapter:\n"); fprintf(stderr, "%s\n", device->getAdapter().toString().c_str()); (void)timestamp; } void deviceConnectionChanged(std::shared_ptr<DBTDevice> device, const bool connected, const uint64_t timestamp) override { - fprintf(stderr, "****** CONNECTION: connected %d: %s\n", connected, device->toString().c_str()); + fprintf(stderr, "****** CONNECTION: connected %d: %s\n", connected, device->toString(true).c_str()); fprintf(stderr, "Status Adapter:\n"); fprintf(stderr, "%s\n", device->getAdapter().toString().c_str()); (void)timestamp; } + + std::string toString() const override { + return "MyAdapterStatusListener[this "+aptrHexString(this)+"]"; + } }; static const uuid16_t _TEMPERATURE_MEASUREMENT(GattCharacteristicType::TEMPERATURE_MEASUREMENT); |