diff options
Diffstat (limited to 'src/direct_bt')
-rw-r--r-- | src/direct_bt/DBTAdapter.cpp | 9 | ||||
-rw-r--r-- | src/direct_bt/DBTDevice.cpp | 3 | ||||
-rw-r--r-- | src/direct_bt/DBTManager.cpp | 6 |
3 files changed, 8 insertions, 10 deletions
diff --git a/src/direct_bt/DBTAdapter.cpp b/src/direct_bt/DBTAdapter.cpp index 82e498e3..2edbb4bc 100644 --- a/src/direct_bt/DBTAdapter.cpp +++ b/src/direct_bt/DBTAdapter.cpp @@ -197,7 +197,7 @@ errout0: return false; } -DBTAdapter::DBTAdapter(DBTManager& mgmt_, const AdapterInfo& adapterInfo_) noexcept +DBTAdapter::DBTAdapter(const DBTAdapter::ctor_cookie& cc, DBTManager& mgmt_, const AdapterInfo& adapterInfo_) noexcept : debug_event(jau::environment::getBooleanProperty("direct_bt.debug.adapter.event", false)), debug_lock(jau::environment::getBooleanProperty("direct_bt.debug.adapter.lock", false)), mgmt( mgmt_ ), @@ -205,6 +205,7 @@ DBTAdapter::DBTAdapter(DBTManager& mgmt_, const AdapterInfo& adapterInfo_) noexc dev_id( adapterInfo.dev_id ), hci( dev_id ) { + (void)cc; valid = validateDevInfo(); } @@ -1037,8 +1038,7 @@ bool DBTAdapter::mgmtEvDeviceConnectedHCI(const MgmtEvent& e) noexcept { } if( nullptr == device ) { // a whitelist auto-connect w/o previous discovery - // private ctor: device = std::make_shared<DBTDevice>(*this, ad_report); - device = std::shared_ptr<DBTDevice>(new DBTDevice(*this, ad_report)); + device = DBTDevice::make_shared(*this, ad_report); addDiscoveredDevice(device); addSharedDevice(device); new_connect = 3; @@ -1327,8 +1327,7 @@ bool DBTAdapter::mgmtEvDeviceFoundHCI(const MgmtEvent& e) noexcept { // // new device // - // private ctor: dev = std::make_shared<DBTDevice>(*this, *eir); - dev = std::shared_ptr<DBTDevice>(new DBTDevice(*this, *eir)); + dev = DBTDevice::make_shared(*this, *eir); addDiscoveredDevice(dev); addSharedDevice(dev); COND_PRINT(debug_event, "DBTAdapter:hci:DeviceFound: Use new %s, %s", diff --git a/src/direct_bt/DBTDevice.cpp b/src/direct_bt/DBTDevice.cpp index d37a8318..38824bac 100644 --- a/src/direct_bt/DBTDevice.cpp +++ b/src/direct_bt/DBTDevice.cpp @@ -43,12 +43,13 @@ using namespace direct_bt; -DBTDevice::DBTDevice(DBTAdapter & a, EInfoReport const & r) +DBTDevice::DBTDevice(const ctor_cookie& cc, DBTAdapter & a, EInfoReport const & r) : adapter(a), l2cap_att(adapter.getAddress(), L2CAP_PSM_UNDEF, L2CAP_CID_ATT), ts_creation(r.getTimestamp()), addressAndType{r.getAddress(), r.getAddressType()} { + (void)cc; ts_last_discovery = ts_creation; hciConnHandle = 0; le_features = LEFeatures::NONE; diff --git a/src/direct_bt/DBTManager.cpp b/src/direct_bt/DBTManager.cpp index 0d4136e9..70248d60 100644 --- a/src/direct_bt/DBTManager.cpp +++ b/src/direct_bt/DBTManager.cpp @@ -486,8 +486,7 @@ next1: const uint16_t dev_id = jau::get_uint16(data, 2+i*2, true /* littleEndian */); std::unique_ptr<AdapterInfo> adapterInfo = initAdapter(dev_id, defaultBTMode); if( nullptr != adapterInfo ) { - // private: std::shared_ptr<DBTAdapter> adapter = std::make_shared<DBTAdapter>(*this, *adapterInfo); - std::shared_ptr<DBTAdapter> adapter( new DBTAdapter(*this, *adapterInfo) ); + std::shared_ptr<DBTAdapter> adapter = DBTAdapter::make_shared(*this, *adapterInfo); adapters.push_back( adapter ); adapterIOCapability.push_back(defaultIOCapability); DBG_PRINT("DBTManager::adapters %d/%d: dev_id %d: %s", i, num_adapter, dev_id, adapter->toString().c_str()); @@ -655,8 +654,7 @@ std::shared_ptr<DBTAdapter> DBTManager::addAdapter(const AdapterInfo& ai ) noexc } if( it.is_end() ) { // new entry - // private: std::shared_ptr<DBTAdapter> adapter = std::make_shared<DBTAdapter>(*this, ai); - std::shared_ptr<DBTAdapter> adapter( new DBTAdapter(*this, ai) ); + std::shared_ptr<DBTAdapter> adapter = DBTAdapter::make_shared(*this, ai); it.push_back( adapter ); adapterIOCapability.push_back(defaultIOCapability); DBG_PRINT("DBTManager::addAdapter: Adding new: %s", adapter->toString().c_str()) |