summaryrefslogtreecommitdiffstats
path: root/src/direct_bt/SMPKeyBin.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-06-11 12:11:04 +0200
committerSven Gothel <[email protected]>2021-06-11 12:11:04 +0200
commitca5da49571242292a0be8ab404c878027ddbbb6a (patch)
tree835acf352cc03d7fc28dbd2a57f40db8254209bd /src/direct_bt/SMPKeyBin.cpp
parentc6e1928c4a8f29d86c5766889e906e72d22b872d (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 'src/direct_bt/SMPKeyBin.cpp')
-rw-r--r--src/direct_bt/SMPKeyBin.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/direct_bt/SMPKeyBin.cpp b/src/direct_bt/SMPKeyBin.cpp
index e9fbbac2..252d747e 100644
--- a/src/direct_bt/SMPKeyBin.cpp
+++ b/src/direct_bt/SMPKeyBin.cpp
@@ -138,6 +138,17 @@ std::string SMPKeyBin::toString() const noexcept {
return res;
}
+std::string SMPKeyBin::getFileBasename() const noexcept {
+ std::string r("bd_"+addrAndType.address.toString()+":"+std::to_string(number(addrAndType.type))+"-smpkey.bin");
+ std::replace( r.begin(), r.end(), ':', '_');
+ return r;
+}
+std::string SMPKeyBin::getFileBasename(const BDAddressAndType& addrAndType_) {
+ std::string r("bd_"+addrAndType_.address.toString()+":"+std::to_string(number(addrAndType_.type))+"-smpkey.bin");
+ std::replace( r.begin(), r.end(), ':', '_');
+ return r;
+}
+
bool SMPKeyBin::remove_impl(const std::string& fname) {
#if USE_CXX17lib_FS
const fs::path fname2 = fname;