BLE List improvements (#1595)

* WIP on add to save list

* Added rewriting existing lines and appending new to same file.

* format

* not looking on new file.

* Added temp list due to some issue of recent being updated during save

I was receiving a system halt and this seems to fix it. Needs more testing though.

* clang format

* Stored entries backward. Fix.

* Update file working, need to replace temp file though.
This commit is contained in:
Netro 2023-11-19 20:53:53 -05:00 committed by GitHub
parent 309f2fbd2c
commit 5a1676a0b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 163 additions and 58 deletions

View file

@ -85,6 +85,7 @@ struct BleRecentEntry {
uint16_t numHits;
ADV_PDU_TYPE pduType;
uint8_t channelNumber;
bool entryFound;
BleRecentEntry()
: BleRecentEntry{0} {
@ -101,7 +102,8 @@ struct BleRecentEntry {
include_name{},
numHits{},
pduType{},
channelNumber{} {
channelNumber{},
entryFound{} {
}
Key key() const {
@ -188,6 +190,7 @@ class BLERxView : public View {
std::string title() const override { return "BLE RX"; };
private:
std::string build_line_str(BleRecentEntry entry);
void on_save_file(const std::string value);
bool saveFile(const std::filesystem::path& path);
void on_data(BlePacketData* packetData);
@ -212,6 +215,8 @@ class BLERxView : public View {
std::string filterBuffer{};
std::string filter{};
std::string listFileBuffer{};
std::string headerStr = "Timestamp, MAC Address, Name, Packet Type, Data, Hits, dB, Channel";
uint16_t maxLineLength = 140;
static constexpr auto header_height = 3 * 16;
static constexpr auto switch_button_height = 3 * 16;
@ -292,6 +297,7 @@ class BLERxView : public View {
std::unique_ptr<BLELogger> logger{};
BleRecentEntries recent{};
BleRecentEntries tempList{};
const RecentEntriesColumns columns{{
{"Mac Address", 17},