[FL-1293] iButton key rename (#479)

* ibutton: remove existing key file before saving new
* ibutton: save key name in iButtunKey object
* ibutton: rename IBUTTON_KEY_SIZE -> IBUTTON_KEY_DATA_SIZE
* ibutton: clear key when enter one manually
* ibutton: change strcpy -> strlcpy

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2021-05-21 12:52:47 +03:00
committed by GitHub
parent f1198950e9
commit 1242327e14
6 changed files with 33 additions and 16 deletions

View File

@@ -7,11 +7,12 @@ public:
uint8_t get_size();
void set_data(uint8_t* data, uint8_t data_count);
void clear_data();
uint8_t* get_data();
uint8_t get_type_data_size();
void set_name(const char* name);
const char* get_name();
char* get_name();
void set_type(iButtonKeyType key_type);
iButtonKeyType get_key_type();
@@ -19,8 +20,8 @@ public:
iButtonKey();
private:
uint8_t data[IBUTTON_KEY_SIZE] = {0, 0, 0, 0, 0, 0, 0, 0};
const char* name = {0};
uint8_t data[IBUTTON_KEY_DATA_SIZE] = {0, 0, 0, 0, 0, 0, 0, 0};
char name[IBUTTON_KEY_NAME_SIZE] = {0};
iButtonKeyType type = iButtonKeyType::KeyDallas;
};