diff options
author | Sven Gothel <[email protected]> | 2020-12-14 03:11:00 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-12-14 03:11:00 +0100 |
commit | d7f17e9cbd1211d5470e8f42aa35d58a7760f771 (patch) | |
tree | 5943b90f7d3137b6e2a724b4c2fccacbc0056dd5 /api/direct_bt/DBTDevice.hpp | |
parent | d22915932120e4486ad09691ae5fb6c635b8c925 (diff) |
smart_ptr-3: Handle HCIEvent + SMPPDUMsg instances via std::unique_ptr instead of shared_ptr; Callbacks use 'const <T> &' now.
smart_ptr change series, commit #2
This series started with commit cafd8d1f3689135eae36854a9cca4def690045fd,
see for details.
Refined MgmtMsg clone template and added same to HCIPacket and SMPPDUMsg.
Notable: To have this clone template to work, the default copy-constructor
should not be deleted. Hence removing the const qualifier from timestamp
and manual default/deleted directives.
+++
At this point, all high frequent objects (ATT, HCI w/ SMP, Mgmt events)
use std::unique_ptr and therefor reduce a certain overhead.
Further, this constraint also removes a potential 'build in' leaks,
in case a callback method keeps the shared_ptr instance.
Now, callbacks only received the const reference and if so desired,
need to create a copy themselves.
Diffstat (limited to 'api/direct_bt/DBTDevice.hpp')
-rw-r--r-- | api/direct_bt/DBTDevice.hpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/api/direct_bt/DBTDevice.hpp b/api/direct_bt/DBTDevice.hpp index b338e811..f40411c7 100644 --- a/api/direct_bt/DBTDevice.hpp +++ b/api/direct_bt/DBTDevice.hpp @@ -169,7 +169,7 @@ namespace direct_bt { * Will be initiated by processL2CAPSetup()'s security_level setup after connectLE(..), i.e. notifyConnected() and notifyLEFeatures(). * </p> */ - void hciSMPMsgCallback(std::shared_ptr<DBTDevice> sthis, std::shared_ptr<const SMPPDUMsg> msg, const HCIACLData::l2cap_frame& source) noexcept; + void hciSMPMsgCallback(std::shared_ptr<DBTDevice> sthis, const SMPPDUMsg& msg, const HCIACLData::l2cap_frame& source) noexcept; /** * Setup GATT via connectGATT() off-thread. |