diff options
author | Sven Gothel <[email protected]> | 2021-11-19 06:53:38 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-11-19 06:53:38 +0100 |
commit | 9fccce137eda7c688429cde82e8735cde069e3fa (patch) | |
tree | 376c534229043b079578ab2839d39e35c59a92d0 /api | |
parent | afd00da021657acbfb8c17c2ee89004e3a9ce537 (diff) |
SMPKeyBin::createAndWrite(..): Drop 'overwrite' argument as we shall set overwrite = PairingMode::PRE_PAIRED != device.getPairingMode()
Only PRE_PAIRED keys shall not be overwrite the existing file, as they don't need to be and hence can preserve their timestamp.
However, another PairingMode indicates a new key and shall overwrite an existing file.
Diffstat (limited to 'api')
-rw-r--r-- | api/direct_bt/SMPKeyBin.hpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/api/direct_bt/SMPKeyBin.hpp b/api/direct_bt/SMPKeyBin.hpp index 066ccb12..2e3d64a9 100644 --- a/api/direct_bt/SMPKeyBin.hpp +++ b/api/direct_bt/SMPKeyBin.hpp @@ -169,13 +169,14 @@ class SMPKeyBin { * BTSecurityLevel, SMPPairingState, PairingMode and LTK keys. * If valid, instance is stored to a file denoted by `path` and `BTDevice::getAddressAndType()`. * - * Method returns `false` if resulting SMPKeyBin is not SMPKeyBin::isValid(). + * If BTDevice::getPairingMode() is PairingMode::PRE_PAIRED, an existing file will not be overwritten. + * Otherwise, a new key is assumed and an existing file shall be overwritten. * + * Method returns `false` if resulting SMPKeyBin is not SMPKeyBin::isValid(). * Otherwise, method returns the SMPKeyBin::write() result. * * @param device the BTDevice from which all required data is derived * @param path the path for the stored SMPKeyBin file. - * @param overwrite if `true` and file already exists, delete file first. If `false` and file exists, return `false` w/o writing. * @param verbose_ set to true to have detailed write processing logged to stderr, otherwise false * @return `true` if file has been successfully written, otherwise `false`. * @see BTDevice @@ -183,7 +184,7 @@ class SMPKeyBin { * @see write() * @see isValid() */ - static bool createAndWrite(const BTDevice& device, const std::string& path, const bool overwrite, const bool verbose_); + static bool createAndWrite(const BTDevice& device, const std::string& path, const bool verbose_); /** * Create a new SMPKeyBin instance based upon stored file denoted by `fname`. |