diff options
author | SG <who.just.the.doctor@gmail.com> | 2021-06-18 11:04:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-18 11:04:53 +0300 |
commit | 2084f83eb5a84e5ae46a241b8f46d43eb4cff9af (patch) | |
tree | 0461f689ec8d941e73a2d1e6837187dc20fcc0b8 /applications/ibutton | |
parent | 57bde875ebb432389d8ab6f0163a0b038e0d6510 (diff) |
App iButton: fix cli delete command bug, use RAII records (#523)
Co-authored-by: あく <alleteam@gmail.com>
Diffstat (limited to 'applications/ibutton')
-rw-r--r-- | applications/ibutton/ibutton-app.cpp | 15 | ||||
-rw-r--r-- | applications/ibutton/ibutton-app.h | 11 |
2 files changed, 10 insertions, 16 deletions
diff --git a/applications/ibutton/ibutton-app.cpp b/applications/ibutton/ibutton-app.cpp index 0eed0905..2cebb8b5 100644 --- a/applications/ibutton/ibutton-app.cpp +++ b/applications/ibutton/ibutton-app.cpp @@ -28,25 +28,18 @@ void iButtonApp::run(void) { scenes[current_scene]->on_exit(this); } -iButtonApp::iButtonApp() { +iButtonApp::iButtonApp() + : fs_api{"sdcard"} + , sd_ex_api{"sdcard-ex"} + , notification{"notification"} { api_hal_power_insomnia_enter(); - key_worker = new KeyWorker(&ibutton_gpio); - sd_ex_api = static_cast<SdCard_Api*>(furi_record_open("sdcard-ex")); - fs_api = static_cast<FS_Api*>(furi_record_open("sdcard")); - notification = static_cast<NotificationApp*>(furi_record_open("notification")); // we need random srand(DWT->CYCCNT); } iButtonApp::~iButtonApp() { - cli_delete_command(cli, "tm"); - - furi_record_close("sdcard-ex"); - furi_record_close("sdcard"); - furi_record_close("notification"); - for(std::map<Scene, iButtonScene*>::iterator it = scenes.begin(); it != scenes.end(); ++it) { delete it->second; scenes.erase(it); diff --git a/applications/ibutton/ibutton-app.h b/applications/ibutton/ibutton-app.h index 197fd622..40d3f0fa 100644 --- a/applications/ibutton/ibutton-app.h +++ b/applications/ibutton/ibutton-app.h @@ -35,6 +35,8 @@ #include <notification/notification-messages.h> +#include <record-controller.hpp> + class iButtonApp { public: void run(void); @@ -130,17 +132,16 @@ private: iButtonKey key; - SdCard_Api* sd_ex_api; - FS_Api* fs_api; - Cli* cli; + RecordController<FS_Api> fs_api; + RecordController<SdCard_Api> sd_ex_api; + RecordController<NotificationApp> notification; + static const uint8_t file_name_size = 100; char file_name[file_name_size]; static const uint8_t text_store_size = 128; char text_store[text_store_size + 1]; - NotificationApp* notification; - static const char* app_folder; static const char* app_extension; |