diff options
author | Sven Gothel <[email protected]> | 2020-09-18 02:30:53 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-09-18 02:30:53 +0200 |
commit | 55282d659427f3167d141062eb5b03ae3e2ba2b7 (patch) | |
tree | 36255581da8c08b1f69b15f9918c731a1a235ae9 /examples/direct_bt_scanner00 | |
parent | 2ae1ba72a8d0e5dd06d075fd06dae287b44f8bf6 (diff) |
Open [& Connect] @ ctor (RAII): HCIComm, L2CAPComm, GATTHandler, simplifying 'connect' lifecycle
Further:
- L2CAPComm
-- disconnect(): Only lock mtw_write if connected and mark noexcept
-- Added '~L2CAPComm() noexcept' for RAII
-- Removed unsued accessors
- GATTHandler
-- Similar treatment as L2CAPComm
- DBTDevice
-- Remove mtx_gatt and its locks, they were not consistent.
Rely on mtx_connect (connectGATT/getGATTServices/disconnect)
and atomic local GATTHandler copy when using.
-- disconnect GATTHandler directly in disconnect, remove explicit method.
-- pingGATT uses local gattHandler copy to avoid parallel disconnect nullptr,
however, it will fail immediately due to disconnection.
Diffstat (limited to 'examples/direct_bt_scanner00')
-rw-r--r-- | examples/direct_bt_scanner00/dbt_scanner00.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/direct_bt_scanner00/dbt_scanner00.cpp b/examples/direct_bt_scanner00/dbt_scanner00.cpp index 63eb61c4..5cf9f996 100644 --- a/examples/direct_bt_scanner00/dbt_scanner00.cpp +++ b/examples/direct_bt_scanner00/dbt_scanner00.cpp @@ -267,7 +267,7 @@ int main(int argc, char *argv[]) } { std::shared_ptr<GATTHandler> gatt = device->getGATTHandler(); - if( nullptr != gatt && gatt->isOpen() ) { + if( nullptr != gatt && gatt->getIsConnected() ) { std::shared_ptr<DeviceInformation> di = gatt->getDeviceInformation(primServices); if( nullptr != di ) { fprintf(stderr, " DeviceInformation: %s\n\n", di->toString().c_str()); |