diff options
author | Sven Gothel <[email protected]> | 2021-06-11 12:11:04 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-06-11 12:11:04 +0200 |
commit | ca5da49571242292a0be8ab404c878027ddbbb6a (patch) | |
tree | 835acf352cc03d7fc28dbd2a57f40db8254209bd /api | |
parent | c6e1928c4a8f29d86c5766889e906e72d22b872d (diff) |
SMPKeyBin: Make key base filename compatible to FAT32 Long filename (LFN)v2.2.6
Previous scheme : `bd_C0:26:DA:01:DA:B1:1.smpkey.bin'
FAT32 LFN scheme: `bd_C0_26_DA_01_DA_B1_1-smpkey.bin'
Tested interoperability with native and java test application.
Diffstat (limited to 'api')
-rw-r--r-- | api/direct_bt/SMPKeyBin.hpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/api/direct_bt/SMPKeyBin.hpp b/api/direct_bt/SMPKeyBin.hpp index 9844d0e8..7b77444b 100644 --- a/api/direct_bt/SMPKeyBin.hpp +++ b/api/direct_bt/SMPKeyBin.hpp @@ -48,6 +48,16 @@ namespace direct_bt { * implementation supports mixed mode for certain devices. * E.g. LTK responder key only etc. * </p> + * <p> + * Filename as retrieved by SMPKeyBin::getFileBasename() + * has the following form `bd_C0_26_DA_01_DA_B1_1-smpkey.bin`: + * <ul> + * <li>{@code 'bd_'} denotes prefix</li> + * <li>{@code 'C0_26_DA_01_DA_B1'} denotes the {@link EUI48} address</li> + * <li>{@code '_1'} denotes the {@link BDAddressType}</li> + * <li>{@code '-smpkey.bin'} denotes the suffix</li> + * </li> + * </p> */ class SMPKeyBin { public: @@ -276,12 +286,16 @@ class SMPKeyBin { std::string toString() const noexcept; - std::string getFileBasename() const noexcept { - return "bd_"+addrAndType.address.toString()+":"+std::to_string(number(addrAndType.type))+".smpkey.bin"; - } - static std::string getFileBasename(const BDAddressAndType& addrAndType_) { - return "bd_"+addrAndType_.address.toString()+":"+std::to_string(number(addrAndType_.type))+".smpkey.bin"; - } + /** + * Returns the base filename, see SMPKeyBin API doc for naming scheme. + */ + std::string getFileBasename() const noexcept; + + /** + * Returns the base filename, see SMPKeyBin API doc for naming scheme. + */ + static std::string getFileBasename(const BDAddressAndType& addrAndType_); + static std::string getFilename(const std::string& path, const BDAddressAndType& addrAndType_) { return path + "/" + getFileBasename(addrAndType_); } |