diff --git a/applications/lfrfid/helpers/key-info.cpp b/applications/lfrfid/helpers/key-info.cpp index a6da4af2..cd04e1e1 100644 --- a/applications/lfrfid/helpers/key-info.cpp +++ b/applications/lfrfid/helpers/key-info.cpp @@ -17,6 +17,22 @@ const char* lfrfid_key_get_type_string(LfrfidKeyType type) { return "Unknown"; } +const char* lfrfid_key_get_manufacturer_string(LfrfidKeyType type) { + switch(type) { + case LfrfidKeyType::KeyEM4100: + return "Em-Marine"; + break; + case LfrfidKeyType::KeyH10301: + return "HID"; + break; + case LfrfidKeyType::KeyI40134: + return "Indala"; + break; + } + + return "Unknown"; +} + bool lfrfid_key_get_string_type(const char* string, LfrfidKeyType* type) { bool result = true; diff --git a/applications/lfrfid/helpers/key-info.h b/applications/lfrfid/helpers/key-info.h index b069f98c..277ede08 100644 --- a/applications/lfrfid/helpers/key-info.h +++ b/applications/lfrfid/helpers/key-info.h @@ -11,5 +11,6 @@ enum class LfrfidKeyType : uint8_t { }; const char* lfrfid_key_get_type_string(LfrfidKeyType type); +const char* lfrfid_key_get_manufacturer_string(LfrfidKeyType type); bool lfrfid_key_get_string_type(const char* string, LfrfidKeyType* type); uint8_t lfrfid_key_get_type_data_count(LfrfidKeyType type); \ No newline at end of file diff --git a/applications/lfrfid/scene/lfrfid-app-scene-save-type.cpp b/applications/lfrfid/scene/lfrfid-app-scene-save-type.cpp index bba5e94f..1821019f 100644 --- a/applications/lfrfid/scene/lfrfid-app-scene-save-type.cpp +++ b/applications/lfrfid/scene/lfrfid-app-scene-save-type.cpp @@ -3,9 +3,13 @@ void LfRfidAppSceneSaveType::on_enter(LfRfidApp* app, bool need_restore) { auto submenu = app->view_controller.get(); - for(uint8_t i = 0; i <= static_cast(LfrfidKeyType::KeyI40134); i++) { - submenu->add_item( - lfrfid_key_get_type_string(static_cast(i)), i, submenu_callback, app); + for(uint8_t i = 0; i <= keys_count; i++) { + string_init_printf( + submenu_name[i], + "%s %s", + lfrfid_key_get_manufacturer_string(static_cast(i)), + lfrfid_key_get_type_string(static_cast(i))); + submenu->add_item(string_get_cstr(submenu_name[i]), i, submenu_callback, app); } if(need_restore) { @@ -33,6 +37,9 @@ bool LfRfidAppSceneSaveType::on_event(LfRfidApp* app, LfRfidApp::Event* event) { void LfRfidAppSceneSaveType::on_exit(LfRfidApp* app) { app->view_controller.get()->clean(); + for(uint8_t i = 0; i <= keys_count; i++) { + string_clear(submenu_name[i]); + } } void LfRfidAppSceneSaveType::submenu_callback(void* context, uint32_t index) { diff --git a/applications/lfrfid/scene/lfrfid-app-scene-save-type.h b/applications/lfrfid/scene/lfrfid-app-scene-save-type.h index 0fbf5239..e23da491 100644 --- a/applications/lfrfid/scene/lfrfid-app-scene-save-type.h +++ b/applications/lfrfid/scene/lfrfid-app-scene-save-type.h @@ -10,4 +10,6 @@ public: private: static void submenu_callback(void* context, uint32_t index); uint32_t submenu_item_selected = 0; + static const uint8_t keys_count = static_cast(LfrfidKeyType::KeyI40134); + string_t submenu_name[keys_count + 1]; }; \ No newline at end of file