1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 20:49:49 +04:00

[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

@@ -2,7 +2,7 @@
#include <furi.h>
uint8_t iButtonKey::get_size() {
return IBUTTON_KEY_SIZE;
return IBUTTON_KEY_DATA_SIZE;
}
void iButtonKey::set_data(uint8_t* _data, uint8_t _data_count) {
@@ -13,6 +13,10 @@ void iButtonKey::set_data(uint8_t* _data, uint8_t _data_count) {
memcpy(data, _data, _data_count);
}
void iButtonKey::clear_data() {
memset(data, 0, get_size());
}
uint8_t* iButtonKey::get_data() {
return data;
}
@@ -36,10 +40,10 @@ uint8_t iButtonKey::get_type_data_size() {
}
void iButtonKey::set_name(const char* _name) {
name = _name;
strlcpy(name, _name, IBUTTON_KEY_NAME_SIZE);
}
const char* iButtonKey::get_name() {
char* iButtonKey::get_name() {
return name;
}