[FL-1849] NFC and iButton gui fixes (#943)
* nfc: fix spaces between lines in delete and info scenes * gui widget: add extern c * ibutton: rework gui in info and delete scenes * Loader, Desktop: fix debug apps and plugins start from cli, fix deadlock in archive Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
		
							parent
							
								
									7e2f0fcc22
								
							
						
					
					
						commit
						c98e54da10
					
				| @ -63,8 +63,6 @@ static void desktop_switch_to_app(Desktop* desktop, const FlipperApplication* fl | ||||
|     furi_thread_set_callback(desktop->scene_thread, flipper_app->app); | ||||
| 
 | ||||
|     furi_thread_start(desktop->scene_thread); | ||||
| 
 | ||||
|     furi_thread_join(desktop->scene_thread); | ||||
| } | ||||
| 
 | ||||
| void desktop_scene_main_callback(DesktopEvent event, void* context) { | ||||
|  | ||||
| @ -7,6 +7,10 @@ | ||||
| 
 | ||||
| #include "widget_elements/widget_element_i.h" | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
| 
 | ||||
| typedef struct Widget Widget; | ||||
| typedef struct WidgetElement WidgetElement; | ||||
| 
 | ||||
| @ -139,3 +143,7 @@ void widget_add_frame_element( | ||||
|     uint8_t width, | ||||
|     uint8_t height, | ||||
|     uint8_t radius); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| #pragma once | ||||
| #include <stdint.h> | ||||
| #include <gui/modules/dialog_ex.h> | ||||
| #include <gui/modules/widget.h> | ||||
| 
 | ||||
| class iButtonApp; | ||||
| 
 | ||||
| @ -14,12 +15,14 @@ public: | ||||
|         EventTypeDialogResult, | ||||
|         EventTypeTextEditResult, | ||||
|         EventTypeByteEditResult, | ||||
|         EventTypeWidgetButtonResult, | ||||
|     }; | ||||
| 
 | ||||
|     // payload
 | ||||
|     union { | ||||
|         uint32_t menu_index; | ||||
|         DialogExResult dialog_result; | ||||
|         GuiButtonType widget_button_result; | ||||
|     } payload; | ||||
| 
 | ||||
|     // event type
 | ||||
|  | ||||
							
								
								
									
										14
									
								
								applications/ibutton/ibutton-view-manager.cpp
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										14
									
								
								applications/ibutton/ibutton-view-manager.cpp
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -38,6 +38,12 @@ iButtonAppViewManager::iButtonAppViewManager() { | ||||
|         static_cast<uint32_t>(iButtonAppViewManager::Type::iButtonAppViewPopup), | ||||
|         popup_get_view(popup)); | ||||
| 
 | ||||
|     widget = widget_alloc(); | ||||
|     view_dispatcher_add_view( | ||||
|         view_dispatcher, | ||||
|         static_cast<uint32_t>(iButtonAppViewManager::Type::iButtonAppViewWidget), | ||||
|         widget_get_view(widget)); | ||||
| 
 | ||||
|     gui = static_cast<Gui*>(furi_record_open("gui")); | ||||
|     view_dispatcher_attach_to_gui(view_dispatcher, gui, ViewDispatcherTypeFullscreen); | ||||
| 
 | ||||
| @ -47,6 +53,7 @@ iButtonAppViewManager::iButtonAppViewManager() { | ||||
|     view_set_previous_callback(text_input_get_view(text_input), callback); | ||||
|     view_set_previous_callback(byte_input_get_view(byte_input), callback); | ||||
|     view_set_previous_callback(popup_get_view(popup), callback); | ||||
|     view_set_previous_callback(widget_get_view(widget), callback); | ||||
| } | ||||
| 
 | ||||
| iButtonAppViewManager::~iButtonAppViewManager() { | ||||
| @ -65,6 +72,8 @@ iButtonAppViewManager::~iButtonAppViewManager() { | ||||
|     view_dispatcher_remove_view( | ||||
|         view_dispatcher, | ||||
|         static_cast<uint32_t>(iButtonAppViewManager::Type::iButtonAppViewByteInput)); | ||||
|     view_dispatcher_remove_view( | ||||
|         view_dispatcher, static_cast<uint32_t>(iButtonAppViewManager::Type::iButtonAppViewWidget)); | ||||
| 
 | ||||
|     // free view modules
 | ||||
|     popup_free(popup); | ||||
| @ -72,6 +81,7 @@ iButtonAppViewManager::~iButtonAppViewManager() { | ||||
|     byte_input_free(byte_input); | ||||
|     submenu_free(submenu); | ||||
|     dialog_ex_free(dialog_ex); | ||||
|     widget_free(widget); | ||||
| 
 | ||||
|     // free dispatcher
 | ||||
|     view_dispatcher_free(view_dispatcher); | ||||
| @ -104,6 +114,10 @@ ByteInput* iButtonAppViewManager::get_byte_input() { | ||||
|     return byte_input; | ||||
| } | ||||
| 
 | ||||
| Widget* iButtonAppViewManager::get_widget() { | ||||
|     return widget; | ||||
| } | ||||
| 
 | ||||
| void iButtonAppViewManager::receive_event(iButtonEvent* event) { | ||||
|     if(osMessageQueueGet(event_queue, event, NULL, 100) != osOK) { | ||||
|         event->type = iButtonEvent::Type::EventTypeTick; | ||||
|  | ||||
| @ -6,6 +6,7 @@ | ||||
| #include <gui/modules/text_input.h> | ||||
| #include <gui/modules/byte_input.h> | ||||
| #include <gui/modules/popup.h> | ||||
| #include <gui/modules/widget.h> | ||||
| #include "ibutton-event.h" | ||||
| 
 | ||||
| class iButtonAppViewManager { | ||||
| @ -16,6 +17,7 @@ public: | ||||
|         iButtonAppViewSubmenu, | ||||
|         iButtonAppViewDialogEx, | ||||
|         iButtonAppViewPopup, | ||||
|         iButtonAppViewWidget, | ||||
|     }; | ||||
| 
 | ||||
|     osMessageQueueId_t event_queue; | ||||
| @ -30,6 +32,7 @@ public: | ||||
|     DialogEx* get_dialog_ex(); | ||||
|     TextInput* get_text_input(); | ||||
|     ByteInput* get_byte_input(); | ||||
|     Widget* get_widget(); | ||||
| 
 | ||||
|     void receive_event(iButtonEvent* event); | ||||
|     void send_event(iButtonEvent* event); | ||||
| @ -41,6 +44,7 @@ private: | ||||
|     TextInput* text_input; | ||||
|     ByteInput* byte_input; | ||||
|     Popup* popup; | ||||
|     Widget* widget; | ||||
|     Gui* gui; | ||||
| 
 | ||||
|     uint32_t previous_view_callback(void* context); | ||||
|  | ||||
							
								
								
									
										56
									
								
								applications/ibutton/scene/ibutton-scene-delete-confirm.cpp
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										56
									
								
								applications/ibutton/scene/ibutton-scene-delete-confirm.cpp
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -6,17 +6,22 @@ | ||||
| 
 | ||||
| void iButtonSceneDeleteConfirm::on_enter(iButtonApp* app) { | ||||
|     iButtonAppViewManager* view_manager = app->get_view_manager(); | ||||
|     DialogEx* dialog_ex = view_manager->get_dialog_ex(); | ||||
|     auto callback = cbc::obtain_connector(this, &iButtonSceneDeleteConfirm::dialog_ex_callback); | ||||
|     Widget* widget = view_manager->get_widget(); | ||||
|     auto callback = cbc::obtain_connector(this, &iButtonSceneDeleteConfirm::widget_callback); | ||||
| 
 | ||||
|     iButtonKey* key = app->get_key(); | ||||
|     uint8_t* key_data = key->get_data(); | ||||
| 
 | ||||
|     app->set_text_store("\e#Delete %s?\e#", key->get_name()); | ||||
|     widget_add_text_box_element( | ||||
|         widget, 0, 0, 128, 23, AlignCenter, AlignCenter, app->get_text_store()); | ||||
|     widget_add_button_element(widget, GuiButtonTypeLeft, "Back", callback, app); | ||||
|     widget_add_button_element(widget, GuiButtonTypeRight, "Delete", callback, app); | ||||
| 
 | ||||
|     switch(key->get_key_type()) { | ||||
|     case iButtonKeyType::KeyDallas: | ||||
|         app->set_text_store( | ||||
|             "Delete %s?\nID: %02X %02X %02X %02X %02X %02X %02X %02X\nType: Dallas", | ||||
|             key->get_name(), | ||||
|             "%02X %02X %02X %02X %02X %02X %02X %02X\nDallas", | ||||
|             key_data[0], | ||||
|             key_data[1], | ||||
|             key_data[2], | ||||
| @ -27,34 +32,24 @@ void iButtonSceneDeleteConfirm::on_enter(iButtonApp* app) { | ||||
|             key_data[7]); | ||||
|         break; | ||||
|     case iButtonKeyType::KeyCyfral: | ||||
|         app->set_text_store( | ||||
|             "Delete %s?\nID: %02X %02X\nType: Cyfral", key->get_name(), key_data[0], key_data[1]); | ||||
|         app->set_text_store("%02X %02X\nCyfral", key_data[0], key_data[1]); | ||||
|         break; | ||||
|     case iButtonKeyType::KeyMetakom: | ||||
|         app->set_text_store( | ||||
|             "Delete %s?\nID: %02X %02X %02X %02X\nType: Metakom", | ||||
|             key->get_name(), | ||||
|             key_data[0], | ||||
|             key_data[1], | ||||
|             key_data[2], | ||||
|             key_data[3]); | ||||
|             "%02X %02X %02X %02X\nMetakom", key_data[0], key_data[1], key_data[2], key_data[3]); | ||||
|         break; | ||||
|     } | ||||
|     widget_add_string_multiline_element( | ||||
|         widget, 64, 23, AlignCenter, AlignTop, FontSecondary, app->get_text_store()); | ||||
| 
 | ||||
|     dialog_ex_set_text(dialog_ex, app->get_text_store(), 64, 20, AlignCenter, AlignCenter); | ||||
|     dialog_ex_set_left_button_text(dialog_ex, "Back"); | ||||
|     dialog_ex_set_right_button_text(dialog_ex, "Delete"); | ||||
|     dialog_ex_set_result_callback(dialog_ex, callback); | ||||
|     dialog_ex_set_context(dialog_ex, app); | ||||
| 
 | ||||
|     view_manager->switch_to(iButtonAppViewManager::Type::iButtonAppViewDialogEx); | ||||
|     view_manager->switch_to(iButtonAppViewManager::Type::iButtonAppViewWidget); | ||||
| } | ||||
| 
 | ||||
| bool iButtonSceneDeleteConfirm::on_event(iButtonApp* app, iButtonEvent* event) { | ||||
|     bool consumed = false; | ||||
| 
 | ||||
|     if(event->type == iButtonEvent::Type::EventTypeDialogResult) { | ||||
|         if(event->payload.dialog_result == DialogExResultRight) { | ||||
|     if(event->type == iButtonEvent::Type::EventTypeWidgetButtonResult) { | ||||
|         if(event->payload.widget_button_result == GuiButtonTypeRight) { | ||||
|             if(app->delete_key()) { | ||||
|                 app->switch_to_next_scene(iButtonApp::Scene::SceneDeleteSuccess); | ||||
|             } | ||||
| @ -70,23 +65,24 @@ bool iButtonSceneDeleteConfirm::on_event(iButtonApp* app, iButtonEvent* event) { | ||||
| 
 | ||||
| void iButtonSceneDeleteConfirm::on_exit(iButtonApp* app) { | ||||
|     iButtonAppViewManager* view_manager = app->get_view_manager(); | ||||
|     DialogEx* dialog_ex = view_manager->get_dialog_ex(); | ||||
|     Widget* widget = view_manager->get_widget(); | ||||
| 
 | ||||
|     app->set_text_store(""); | ||||
| 
 | ||||
|     dialog_ex_set_text(dialog_ex, NULL, 0, 0, AlignCenter, AlignTop); | ||||
|     dialog_ex_set_left_button_text(dialog_ex, NULL); | ||||
|     dialog_ex_set_right_button_text(dialog_ex, NULL); | ||||
|     dialog_ex_set_result_callback(dialog_ex, NULL); | ||||
|     dialog_ex_set_context(dialog_ex, NULL); | ||||
|     widget_clear(widget); | ||||
| } | ||||
| 
 | ||||
| void iButtonSceneDeleteConfirm::dialog_ex_callback(DialogExResult result, void* context) { | ||||
| void iButtonSceneDeleteConfirm::widget_callback( | ||||
|     GuiButtonType result, | ||||
|     InputType type, | ||||
|     void* context) { | ||||
|     iButtonApp* app = static_cast<iButtonApp*>(context); | ||||
|     iButtonEvent event; | ||||
| 
 | ||||
|     event.type = iButtonEvent::Type::EventTypeDialogResult; | ||||
|     event.payload.dialog_result = result; | ||||
|     if(type == InputTypeShort) { | ||||
|         event.type = iButtonEvent::Type::EventTypeWidgetButtonResult; | ||||
|         event.payload.widget_button_result = result; | ||||
|     } | ||||
| 
 | ||||
|     app->get_view_manager()->send_event(&event); | ||||
| } | ||||
| @ -1,6 +1,5 @@ | ||||
| #pragma once | ||||
| #include "ibutton-scene-generic.h" | ||||
| #include <gui/modules/dialog_ex.h> | ||||
| 
 | ||||
| class iButtonSceneDeleteConfirm : public iButtonScene { | ||||
| public: | ||||
| @ -9,5 +8,5 @@ public: | ||||
|     void on_exit(iButtonApp* app) final; | ||||
| 
 | ||||
| private: | ||||
|     void dialog_ex_callback(DialogExResult result, void* context); | ||||
|     void widget_callback(GuiButtonType result, InputType type, void* context); | ||||
| }; | ||||
							
								
								
									
										45
									
								
								applications/ibutton/scene/ibutton-scene-info.cpp
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										45
									
								
								applications/ibutton/scene/ibutton-scene-info.cpp
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -6,17 +6,21 @@ | ||||
| 
 | ||||
| void iButtonSceneInfo::on_enter(iButtonApp* app) { | ||||
|     iButtonAppViewManager* view_manager = app->get_view_manager(); | ||||
|     DialogEx* dialog_ex = view_manager->get_dialog_ex(); | ||||
|     auto callback = cbc::obtain_connector(this, &iButtonSceneInfo::dialog_ex_callback); | ||||
|     Widget* widget = view_manager->get_widget(); | ||||
|     auto callback = cbc::obtain_connector(this, &iButtonSceneInfo::widget_callback); | ||||
| 
 | ||||
|     iButtonKey* key = app->get_key(); | ||||
|     uint8_t* key_data = key->get_data(); | ||||
| 
 | ||||
|     app->set_text_store("%s", key->get_name()); | ||||
|     widget_add_text_box_element( | ||||
|         widget, 0, 0, 128, 23, AlignCenter, AlignCenter, app->get_text_store()); | ||||
|     widget_add_button_element(widget, GuiButtonTypeLeft, "Back", callback, app); | ||||
| 
 | ||||
|     switch(key->get_key_type()) { | ||||
|     case iButtonKeyType::KeyDallas: | ||||
|         app->set_text_store( | ||||
|             "%s\n%02X %02X %02X %02X %02X %02X %02X %02X\nDallas", | ||||
|             key->get_name(), | ||||
|             "\e#%02X %02X %02X %02X %02X %02X %02X %02X\e#\nDallas", | ||||
|             key_data[0], | ||||
|             key_data[1], | ||||
|             key_data[2], | ||||
| @ -28,55 +32,52 @@ void iButtonSceneInfo::on_enter(iButtonApp* app) { | ||||
|         break; | ||||
|     case iButtonKeyType::KeyMetakom: | ||||
|         app->set_text_store( | ||||
|             "%s\n%02X %02X %02X %02X\nMetakom", | ||||
|             key->get_name(), | ||||
|             "\e#%02X %02X %02X %02X\e#\nMetakom", | ||||
|             key_data[0], | ||||
|             key_data[1], | ||||
|             key_data[2], | ||||
|             key_data[3]); | ||||
|         break; | ||||
|     case iButtonKeyType::KeyCyfral: | ||||
|         app->set_text_store("%s\n%02X %02X\nCyfral", key->get_name(), key_data[0], key_data[1]); | ||||
|         app->set_text_store("\e#%02X %02X\e#\nCyfral", key_data[0], key_data[1]); | ||||
|         break; | ||||
|     } | ||||
|     widget_add_text_box_element( | ||||
|         widget, 0, 23, 128, 40, AlignCenter, AlignTop, app->get_text_store()); | ||||
| 
 | ||||
|     dialog_ex_set_text(dialog_ex, app->get_text_store(), 64, 26, AlignCenter, AlignCenter); | ||||
|     dialog_ex_set_left_button_text(dialog_ex, "Back"); | ||||
|     dialog_ex_set_result_callback(dialog_ex, callback); | ||||
|     dialog_ex_set_context(dialog_ex, app); | ||||
| 
 | ||||
|     view_manager->switch_to(iButtonAppViewManager::Type::iButtonAppViewDialogEx); | ||||
|     view_manager->switch_to(iButtonAppViewManager::Type::iButtonAppViewWidget); | ||||
| } | ||||
| 
 | ||||
| bool iButtonSceneInfo::on_event(iButtonApp* app, iButtonEvent* event) { | ||||
|     bool consumed = false; | ||||
| 
 | ||||
|     if(event->type == iButtonEvent::Type::EventTypeDialogResult) { | ||||
|     if(event->type == iButtonEvent::Type::EventTypeWidgetButtonResult) { | ||||
|         if(event->payload.widget_button_result == GuiButtonTypeLeft) { | ||||
|             app->switch_to_previous_scene(); | ||||
|             consumed = true; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     return consumed; | ||||
| } | ||||
| 
 | ||||
| void iButtonSceneInfo::on_exit(iButtonApp* app) { | ||||
|     iButtonAppViewManager* view_manager = app->get_view_manager(); | ||||
|     DialogEx* dialog_ex = view_manager->get_dialog_ex(); | ||||
|     Widget* widget = view_manager->get_widget(); | ||||
| 
 | ||||
|     app->set_text_store(""); | ||||
| 
 | ||||
|     dialog_ex_set_text(dialog_ex, NULL, 0, 0, AlignCenter, AlignTop); | ||||
|     dialog_ex_set_left_button_text(dialog_ex, NULL); | ||||
|     dialog_ex_set_result_callback(dialog_ex, NULL); | ||||
|     dialog_ex_set_context(dialog_ex, NULL); | ||||
|     widget_clear(widget); | ||||
| } | ||||
| 
 | ||||
| void iButtonSceneInfo::dialog_ex_callback(DialogExResult result, void* context) { | ||||
| void iButtonSceneInfo::widget_callback(GuiButtonType result, InputType type, void* context) { | ||||
|     iButtonApp* app = static_cast<iButtonApp*>(context); | ||||
|     iButtonEvent event; | ||||
| 
 | ||||
|     event.type = iButtonEvent::Type::EventTypeDialogResult; | ||||
|     event.payload.dialog_result = result; | ||||
|     if(type == InputTypeShort) { | ||||
|         event.type = iButtonEvent::Type::EventTypeWidgetButtonResult; | ||||
|         event.payload.widget_button_result = result; | ||||
|     } | ||||
| 
 | ||||
|     app->get_view_manager()->send_event(&event); | ||||
| } | ||||
| @ -1,6 +1,5 @@ | ||||
| #pragma once | ||||
| #include "ibutton-scene-generic.h" | ||||
| #include <gui/modules/dialog_ex.h> | ||||
| 
 | ||||
| class iButtonSceneInfo : public iButtonScene { | ||||
| public: | ||||
| @ -9,5 +8,5 @@ public: | ||||
|     void on_exit(iButtonApp* app) final; | ||||
| 
 | ||||
| private: | ||||
|     void dialog_ex_callback(DialogExResult result, void* context); | ||||
|     void widget_callback(GuiButtonType result, InputType type, void* context); | ||||
| }; | ||||
| @ -46,25 +46,25 @@ static void loader_cli_print_usage() { | ||||
|     printf("\topen <Application Name:string>\t - Open application by name\r\n"); | ||||
| } | ||||
| 
 | ||||
| const FlipperApplication* loader_find_application_by_name(string_t name) { | ||||
| const FlipperApplication* loader_find_application_by_name(const char* name) { | ||||
|     const FlipperApplication* application = NULL; | ||||
| 
 | ||||
|     for(size_t i = 0; i < FLIPPER_APPS_COUNT; i++) { | ||||
|         if(string_cmp_str(name, FLIPPER_APPS[i].name) == 0) { | ||||
|         if(strcmp(name, FLIPPER_APPS[i].name) == 0) { | ||||
|             application = &FLIPPER_APPS[i]; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     for(size_t i = 0; i < FLIPPER_PLUGINS_COUNT; i++) { | ||||
|         if(string_cmp_str(name, FLIPPER_APPS[i].name) == 0) { | ||||
|             application = &FLIPPER_APPS[i]; | ||||
|         if(strcmp(name, FLIPPER_PLUGINS[i].name) == 0) { | ||||
|             application = &FLIPPER_PLUGINS[i]; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) { | ||||
|         for(size_t i = 0; i < FLIPPER_DEBUG_APPS_COUNT; i++) { | ||||
|             if(string_cmp_str(name, FLIPPER_APPS[i].name) == 0) { | ||||
|                 application = &FLIPPER_APPS[i]; | ||||
|             if(strcmp(name, FLIPPER_DEBUG_APPS[i].name) == 0) { | ||||
|                 application = &FLIPPER_DEBUG_APPS[i]; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| @ -80,7 +80,7 @@ void loader_cli_open(Cli* cli, string_t args, Loader* instance) { | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     const FlipperApplication* application = loader_find_application_by_name(args); | ||||
|     const FlipperApplication* application = loader_find_application_by_name(string_get_cstr(args)); | ||||
|     if(!application) { | ||||
|         printf("%s doesn't exists\r\n", string_get_cstr(args)); | ||||
|         return; | ||||
| @ -152,23 +152,7 @@ void loader_cli(Cli* cli, string_t args, void* _ctx) { | ||||
| LoaderStatus loader_start(Loader* instance, const char* name, const char* args) { | ||||
|     furi_assert(name); | ||||
| 
 | ||||
|     const FlipperApplication* flipper_app = NULL; | ||||
|     // Search for application
 | ||||
|     for(size_t i = 0; i < FLIPPER_APPS_COUNT; i++) { | ||||
|         if(strcmp(FLIPPER_APPS[i].name, name) == 0) { | ||||
|             flipper_app = &FLIPPER_APPS[i]; | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     if(!flipper_app) { | ||||
|         for(size_t i = 0; i < FLIPPER_DEBUG_APPS_COUNT; i++) { | ||||
|             if(strcmp(FLIPPER_DEBUG_APPS[i].name, name) == 0) { | ||||
|                 flipper_app = &FLIPPER_DEBUG_APPS[i]; | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     const FlipperApplication* flipper_app = loader_find_application_by_name(name); | ||||
| 
 | ||||
|     if(!flipper_app) { | ||||
|         FURI_LOG_E(TAG, "Can't find application with name %s", name); | ||||
|  | ||||
| @ -12,8 +12,8 @@ void nfc_scene_delete_on_enter(void* context) { | ||||
| 
 | ||||
|     // Setup Custom Widget view
 | ||||
|     char delete_str[64]; | ||||
|     snprintf(delete_str, sizeof(delete_str), "\e#Delete %s\e#", nfc->dev->dev_name); | ||||
|     widget_add_text_box_element(nfc->widget, 0, 0, 128, 24, AlignCenter, AlignCenter, delete_str); | ||||
|     snprintf(delete_str, sizeof(delete_str), "\e#Delete %s?\e#", nfc->dev->dev_name); | ||||
|     widget_add_text_box_element(nfc->widget, 0, 0, 128, 23, AlignCenter, AlignCenter, delete_str); | ||||
|     widget_add_button_element( | ||||
|         nfc->widget, GuiButtonTypeLeft, "Back", nfc_scene_delete_widget_callback, nfc); | ||||
|     widget_add_button_element( | ||||
| @ -42,7 +42,7 @@ void nfc_scene_delete_on_enter(void* context) { | ||||
|             data->uid[5], | ||||
|             data->uid[6]); | ||||
|     } | ||||
|     widget_add_string_element(nfc->widget, 64, 21, AlignCenter, AlignTop, FontSecondary, uid_str); | ||||
|     widget_add_string_element(nfc->widget, 64, 23, AlignCenter, AlignTop, FontSecondary, uid_str); | ||||
| 
 | ||||
|     const char* protocol_name = NULL; | ||||
|     if(data->protocol == NfcDeviceProtocolEMV) { | ||||
| @ -52,16 +52,16 @@ void nfc_scene_delete_on_enter(void* context) { | ||||
|     } | ||||
|     if(protocol_name) { | ||||
|         widget_add_string_element( | ||||
|             nfc->widget, 10, 32, AlignLeft, AlignTop, FontSecondary, protocol_name); | ||||
|             nfc->widget, 10, 33, AlignLeft, AlignTop, FontSecondary, protocol_name); | ||||
|     } | ||||
|     // TODO change dinamically
 | ||||
|     widget_add_string_element(nfc->widget, 118, 32, AlignRight, AlignTop, FontSecondary, "NFC-A"); | ||||
|     widget_add_string_element(nfc->widget, 118, 33, AlignRight, AlignTop, FontSecondary, "NFC-A"); | ||||
|     char sak_str[16]; | ||||
|     snprintf(sak_str, sizeof(sak_str), "SAK: %02X", data->sak); | ||||
|     widget_add_string_element(nfc->widget, 10, 42, AlignLeft, AlignTop, FontSecondary, sak_str); | ||||
|     widget_add_string_element(nfc->widget, 10, 43, AlignLeft, AlignTop, FontSecondary, sak_str); | ||||
|     char atqa_str[16]; | ||||
|     snprintf(atqa_str, sizeof(atqa_str), "ATQA: %02X%02X", data->atqa[0], data->atqa[1]); | ||||
|     widget_add_string_element(nfc->widget, 118, 42, AlignRight, AlignTop, FontSecondary, atqa_str); | ||||
|     widget_add_string_element(nfc->widget, 118, 43, AlignRight, AlignTop, FontSecondary, atqa_str); | ||||
| 
 | ||||
|     view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget); | ||||
| } | ||||
|  | ||||
| @ -37,7 +37,7 @@ void nfc_scene_device_info_on_enter(void* context) { | ||||
| 
 | ||||
|     // Setup Custom Widget view
 | ||||
|     widget_add_text_box_element( | ||||
|         nfc->widget, 0, 0, 128, 24, AlignCenter, AlignCenter, nfc->dev->dev_name); | ||||
|         nfc->widget, 0, 0, 128, 22, AlignCenter, AlignCenter, nfc->dev->dev_name); | ||||
|     widget_add_button_element( | ||||
|         nfc->widget, GuiButtonTypeLeft, "Back", nfc_scene_device_info_widget_callback, nfc); | ||||
|     widget_add_button_element( | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 gornekich
						gornekich