diff options
author | Sven Gothel <[email protected]> | 2020-12-09 11:32:57 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-12-09 11:32:57 +0100 |
commit | ba7ab284bb3b4bbbbef75b54dfbc87478079a72a (patch) | |
tree | d88065e65fca07492d2e14fc062853ae50f3d519 /src/direct_bt | |
parent | a83392f65f8ce725de14d7bf5bd3cd336e4d5d17 (diff) |
DBTDevice: Add get/set methods for SMPLongTermKeyInfo (tested); TODO: Java
Diffstat (limited to 'src/direct_bt')
-rw-r--r-- | src/direct_bt/DBTDevice.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/direct_bt/DBTDevice.cpp b/src/direct_bt/DBTDevice.cpp index 314b9f9b..cda1d3bf 100644 --- a/src/direct_bt/DBTDevice.cpp +++ b/src/direct_bt/DBTDevice.cpp @@ -867,6 +867,18 @@ void DBTDevice::hciSMPMsgCallback(std::shared_ptr<DBTDevice> sthis, std::shared_ } } +SMPLongTermKeyInfo DBTDevice::getLongTermKeyInfo(const bool responder) const noexcept { + jau::sc_atomic_critical sync(const_cast<DBTDevice*>(this)->sync_pairing); + return responder ? pairing_data.ltk_resp : pairing_data.ltk_init; +} + +HCIStatusCode DBTDevice::setLongTermKeyInfo(const SMPLongTermKeyInfo& ltk, const bool responder) noexcept { + jau::sc_atomic_critical sync(sync_pairing); + DBTManager & mngr = adapter.getManager(); + HCIStatusCode res = mngr.uploadLongTermKeyInfo(adapter.dev_id, address, addressType, ltk, responder); + return res; +} + HCIStatusCode DBTDevice::pair(const SMPIOCapability io_cap) noexcept { /** * Experimental only. |