[FL-1061] iButton save and load from sd card (#394)

* SD App: fix queue adresses
* sd-filesystem: fix making path on file select event
* ibutton: add key reading from sd card
* ibutton: save ibutton key to sd card
* ibutton: add deleting keys from sd card
* ibutton: remove KeyStore from application
* ibutton: make directory if necessary on key save

Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2021-03-31 20:47:32 +03:00
committed by GitHub
parent 6375f21cf5
commit 5309bfae41
15 changed files with 132 additions and 256 deletions

View File

@@ -12,7 +12,6 @@
#include "scene/ibutton-scene-readed-key-menu.h"
#include "scene/ibutton-scene-write.h"
#include "scene/ibutton-scene-write-success.h"
#include "scene/ibutton-scene-saved.h"
#include "scene/ibutton-scene-saved-key-menu.h"
#include "scene/ibutton-scene-delete-confirm.h"
#include "scene/ibutton-scene-delete-success.h"
@@ -23,9 +22,11 @@
#include "scene/ibutton-scene-add-type.h"
#include "scene/ibutton-scene-add-value.h"
#include "helpers/key-store.h"
#include "helpers/key-worker.h"
#include <sd-card-api.h>
#include <filesystem-api.h>
#include "one_wire_master.h"
#include "maxim_crc.h"
#include "ibutton-key.h"
@@ -48,7 +49,6 @@ public:
SceneWrite,
SceneWriteSuccess,
SceneEmulate,
SceneSavedList,
SceneSavedKeyMenu,
SceneDeleteConfirm,
SceneDeleteSuccess,
@@ -88,9 +88,10 @@ public:
char* get_text_store();
uint8_t get_text_store_size();
KeyStore* get_key_store();
uint8_t get_stored_key_index();
void set_stored_key_index(uint8_t index);
SdCard_Api* get_sd_ex_api();
FS_Api* get_fs_api();
char* get_file_name();
uint8_t get_file_name_size();
void generate_random_name(char* name, uint8_t max_name_size);
@@ -109,7 +110,6 @@ private:
{Scene::SceneWrite, new iButtonSceneWrite()},
{Scene::SceneWriteSuccess, new iButtonSceneWriteSuccess()},
{Scene::SceneEmulate, new iButtonSceneEmulate()},
{Scene::SceneSavedList, new iButtonSceneSavedList()},
{Scene::SceneSavedKeyMenu, new iButtonSceneSavedKeyMenu()},
{Scene::SceneDeleteConfirm, new iButtonSceneDeleteConfirm()},
{Scene::SceneDeleteSuccess, new iButtonSceneDeleteSuccess()},
@@ -123,12 +123,14 @@ private:
KeyWorker* key_worker;
iButtonKey key;
uint8_t key_index = 0;
SdCard_Api* sd_ex_api;
FS_Api* fs_api;
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];
KeyStore store;
void notify_init();
};