diff --git a/applications/main/nfc/helpers/protocol_support/felica/felica.c b/applications/main/nfc/helpers/protocol_support/felica/felica.c index 7717396a3..7f12064a4 100644 --- a/applications/main/nfc/helpers/protocol_support/felica/felica.c +++ b/applications/main/nfc/helpers/protocol_support/felica/felica.c @@ -133,15 +133,6 @@ static void nfc_scene_read_success_on_enter_felica(NfcApp* instance) { furi_string_free(temp_str); } -static bool nfc_scene_saved_menu_on_event_felica(NfcApp* instance, SceneManagerEvent event) { - if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEdit) { - scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid); - return true; - } - - return false; -} - static void nfc_scene_emulate_on_enter_felica(NfcApp* instance) { const FelicaData* data = nfc_device_get_data(instance->nfc_device, NfcProtocolFelica); instance->listener = nfc_listener_alloc(instance->nfc, NfcProtocolFelica, data); @@ -201,7 +192,7 @@ const NfcProtocolSupportBase nfc_protocol_support_felica = { .scene_saved_menu = { .on_enter = nfc_protocol_support_common_on_enter_empty, - .on_event = nfc_scene_saved_menu_on_event_felica, + .on_event = nfc_protocol_support_common_on_event_empty, }, .scene_save_name = { diff --git a/applications/main/nfc/helpers/protocol_support/iso14443_3a/iso14443_3a.c b/applications/main/nfc/helpers/protocol_support/iso14443_3a/iso14443_3a.c index 9d6dba5a7..068c6a1d7 100644 --- a/applications/main/nfc/helpers/protocol_support/iso14443_3a/iso14443_3a.c +++ b/applications/main/nfc/helpers/protocol_support/iso14443_3a/iso14443_3a.c @@ -67,21 +67,22 @@ static NfcCommand furi_assert(event.protocol == NfcProtocolIso14443_3a); furi_assert(event.event_data); - NfcApp* nfc = context; + NfcApp* instance = context; Iso14443_3aListenerEvent* iso14443_3a_event = event.event_data; if(iso14443_3a_event->type == Iso14443_3aListenerEventTypeReceivedStandardFrame) { - if(furi_string_size(nfc->text_box_store) < NFC_LOG_SIZE_MAX) { - furi_string_cat_printf(nfc->text_box_store, "R:"); + if(furi_string_size(instance->text_box_store) < NFC_LOG_SIZE_MAX) { + furi_string_cat_printf(instance->text_box_store, "R:"); for(size_t i = 0; i < bit_buffer_get_size_bytes(iso14443_3a_event->data->buffer); i++) { furi_string_cat_printf( - nfc->text_box_store, + instance->text_box_store, " %02X", bit_buffer_get_byte(iso14443_3a_event->data->buffer, i)); } - furi_string_push_back(nfc->text_box_store, '\n'); - view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventListenerUpdate); + furi_string_push_back(instance->text_box_store, '\n'); + view_dispatcher_send_custom_event( + instance->view_dispatcher, NfcCustomEventListenerUpdate); } } @@ -97,15 +98,6 @@ static void nfc_scene_emulate_on_enter_iso14443_3a(NfcApp* instance) { instance->listener, nfc_scene_emulate_listener_callback_iso14443_3a, instance); } -static bool nfc_scene_read_menu_on_event_iso14443_3a(NfcApp* instance, SceneManagerEvent event) { - if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEmulate) { - scene_manager_next_scene(instance->scene_manager, NfcSceneEmulate); - return true; - } - - return false; -} - const NfcProtocolSupportBase nfc_protocol_support_iso14443_3a = { .features = NfcProtocolFeatureEmulateUid | NfcProtocolFeatureEditUid, @@ -122,7 +114,7 @@ const NfcProtocolSupportBase nfc_protocol_support_iso14443_3a = { .scene_read_menu = { .on_enter = nfc_protocol_support_common_on_enter_empty, - .on_event = nfc_scene_read_menu_on_event_iso14443_3a, + .on_event = nfc_protocol_support_common_on_event_empty, }, .scene_read_success = { diff --git a/applications/main/nfc/helpers/protocol_support/iso14443_3b/iso14443_3b.c b/applications/main/nfc/helpers/protocol_support/iso14443_3b/iso14443_3b.c index 49da93d7b..ccafc1c9d 100644 --- a/applications/main/nfc/helpers/protocol_support/iso14443_3b/iso14443_3b.c +++ b/applications/main/nfc/helpers/protocol_support/iso14443_3b/iso14443_3b.c @@ -60,19 +60,6 @@ static void nfc_scene_read_success_on_enter_iso14443_3b(NfcApp* instance) { furi_string_free(temp_str); } -bool nfc_scene_saved_menu_on_event_iso14443_3b_common(NfcApp* instance, SceneManagerEvent event) { - if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEdit) { - scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid); - return true; - } - - return false; -} - -static bool nfc_scene_saved_menu_on_event_iso14443_3b(NfcApp* instance, SceneManagerEvent event) { - return nfc_scene_saved_menu_on_event_iso14443_3b_common(instance, event); -} - const NfcProtocolSupportBase nfc_protocol_support_iso14443_3b = { .features = NfcProtocolFeatureNone, @@ -99,7 +86,7 @@ const NfcProtocolSupportBase nfc_protocol_support_iso14443_3b = { .scene_saved_menu = { .on_enter = nfc_protocol_support_common_on_enter_empty, - .on_event = nfc_scene_saved_menu_on_event_iso14443_3b, + .on_event = nfc_protocol_support_common_on_event_empty, }, .scene_save_name = { diff --git a/applications/main/nfc/helpers/protocol_support/iso14443_3b/iso14443_3b_i.h b/applications/main/nfc/helpers/protocol_support/iso14443_3b/iso14443_3b_i.h deleted file mode 100644 index 6c7c2a0bc..000000000 --- a/applications/main/nfc/helpers/protocol_support/iso14443_3b/iso14443_3b_i.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#include - -#include "iso14443_3b.h" - -bool nfc_scene_saved_menu_on_event_iso14443_3b_common(NfcApp* instance, SceneManagerEvent event); diff --git a/applications/main/nfc/helpers/protocol_support/iso14443_4a/iso14443_4a.c b/applications/main/nfc/helpers/protocol_support/iso14443_4a/iso14443_4a.c index 190c26e87..5eec0a1ad 100644 --- a/applications/main/nfc/helpers/protocol_support/iso14443_4a/iso14443_4a.c +++ b/applications/main/nfc/helpers/protocol_support/iso14443_4a/iso14443_4a.c @@ -70,21 +70,22 @@ NfcCommand nfc_scene_emulate_listener_callback_iso14443_4a(NfcGenericEvent event furi_assert(event.protocol == NfcProtocolIso14443_4a); furi_assert(event.event_data); - NfcApp* nfc = context; + NfcApp* instance = context; Iso14443_4aListenerEvent* iso14443_4a_event = event.event_data; if(iso14443_4a_event->type == Iso14443_4aListenerEventTypeReceivedData) { - if(furi_string_size(nfc->text_box_store) < NFC_LOG_SIZE_MAX) { - furi_string_cat_printf(nfc->text_box_store, "R:"); + if(furi_string_size(instance->text_box_store) < NFC_LOG_SIZE_MAX) { + furi_string_cat_printf(instance->text_box_store, "R:"); for(size_t i = 0; i < bit_buffer_get_size_bytes(iso14443_4a_event->data->buffer); i++) { furi_string_cat_printf( - nfc->text_box_store, + instance->text_box_store, " %02X", bit_buffer_get_byte(iso14443_4a_event->data->buffer, i)); } - furi_string_push_back(nfc->text_box_store, '\n'); - view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventListenerUpdate); + furi_string_push_back(instance->text_box_store, '\n'); + view_dispatcher_send_custom_event( + instance->view_dispatcher, NfcCustomEventListenerUpdate); } } @@ -100,15 +101,6 @@ static void nfc_scene_emulate_on_enter_iso14443_4a(NfcApp* instance) { instance->listener, nfc_scene_emulate_listener_callback_iso14443_4a, instance); } -static bool nfc_scene_read_menu_on_event_iso14443_4a(NfcApp* instance, SceneManagerEvent event) { - if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEmulate) { - scene_manager_next_scene(instance->scene_manager, NfcSceneEmulate); - return true; - } - - return false; -} - const NfcProtocolSupportBase nfc_protocol_support_iso14443_4a = { .features = NfcProtocolFeatureEmulateUid | NfcProtocolFeatureEditUid, @@ -125,7 +117,7 @@ const NfcProtocolSupportBase nfc_protocol_support_iso14443_4a = { .scene_read_menu = { .on_enter = nfc_protocol_support_common_on_enter_empty, - .on_event = nfc_scene_read_menu_on_event_iso14443_4a, + .on_event = nfc_protocol_support_common_on_event_empty, }, .scene_read_success = { diff --git a/applications/main/nfc/helpers/protocol_support/iso14443_4b/iso14443_4b.c b/applications/main/nfc/helpers/protocol_support/iso14443_4b/iso14443_4b.c index 8fd823f21..7bfea69fa 100644 --- a/applications/main/nfc/helpers/protocol_support/iso14443_4b/iso14443_4b.c +++ b/applications/main/nfc/helpers/protocol_support/iso14443_4b/iso14443_4b.c @@ -7,7 +7,6 @@ #include "../nfc_protocol_support_common.h" #include "../nfc_protocol_support_gui_common.h" -#include "../iso14443_3b/iso14443_3b_i.h" static void nfc_scene_info_on_enter_iso14443_4b(NfcApp* instance) { const NfcDevice* device = instance->nfc_device; @@ -61,23 +60,6 @@ static void nfc_scene_read_success_on_enter_iso14443_4b(NfcApp* instance) { furi_string_free(temp_str); } -static void nfc_scene_saved_menu_on_enter_iso14443_4b(NfcApp* instance) { - UNUSED(instance); -} - -static bool nfc_scene_read_menu_on_event_iso14443_4b(NfcApp* instance, SceneManagerEvent event) { - if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEmulate) { - scene_manager_next_scene(instance->scene_manager, NfcSceneEmulate); - return true; - } - - return false; -} - -static bool nfc_scene_saved_menu_on_event_iso14443_4b(NfcApp* instance, SceneManagerEvent event) { - return nfc_scene_saved_menu_on_event_iso14443_3b_common(instance, event); -} - const NfcProtocolSupportBase nfc_protocol_support_iso14443_4b = { .features = NfcProtocolFeatureNone, @@ -94,7 +76,7 @@ const NfcProtocolSupportBase nfc_protocol_support_iso14443_4b = { .scene_read_menu = { .on_enter = nfc_protocol_support_common_on_enter_empty, - .on_event = nfc_scene_read_menu_on_event_iso14443_4b, + .on_event = nfc_protocol_support_common_on_event_empty, }, .scene_read_success = { @@ -103,8 +85,8 @@ const NfcProtocolSupportBase nfc_protocol_support_iso14443_4b = { }, .scene_saved_menu = { - .on_enter = nfc_scene_saved_menu_on_enter_iso14443_4b, - .on_event = nfc_scene_saved_menu_on_event_iso14443_4b, + .on_enter = nfc_protocol_support_common_on_enter_empty, + .on_event = nfc_protocol_support_common_on_event_empty, }, .scene_save_name = { diff --git a/applications/main/nfc/helpers/protocol_support/iso15693_3/iso15693_3.c b/applications/main/nfc/helpers/protocol_support/iso15693_3/iso15693_3.c index ffd6971e0..63aff8332 100644 --- a/applications/main/nfc/helpers/protocol_support/iso15693_3/iso15693_3.c +++ b/applications/main/nfc/helpers/protocol_support/iso15693_3/iso15693_3.c @@ -80,20 +80,21 @@ static NfcCommand furi_assert(event.protocol == NfcProtocolIso15693_3); furi_assert(event.event_data); - NfcApp* nfc = context; + NfcApp* instance = context; Iso15693_3ListenerEvent* iso15693_3_event = event.event_data; if(iso15693_3_event->type == Iso15693_3ListenerEventTypeCustomCommand) { - if(furi_string_size(nfc->text_box_store) < NFC_LOG_SIZE_MAX) { - furi_string_cat_printf(nfc->text_box_store, "R:"); + if(furi_string_size(instance->text_box_store) < NFC_LOG_SIZE_MAX) { + furi_string_cat_printf(instance->text_box_store, "R:"); for(size_t i = 0; i < bit_buffer_get_size_bytes(iso15693_3_event->data->buffer); i++) { furi_string_cat_printf( - nfc->text_box_store, + instance->text_box_store, " %02X", bit_buffer_get_byte(iso15693_3_event->data->buffer, i)); } - furi_string_push_back(nfc->text_box_store, '\n'); - view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventListenerUpdate); + furi_string_push_back(instance->text_box_store, '\n'); + view_dispatcher_send_custom_event( + instance->view_dispatcher, NfcCustomEventListenerUpdate); } } @@ -108,15 +109,6 @@ static void nfc_scene_emulate_on_enter_iso15693_3(NfcApp* instance) { instance->listener, nfc_scene_emulate_listener_callback_iso15693_3, instance); } -static bool nfc_scene_saved_menu_on_event_iso15693_3(NfcApp* instance, SceneManagerEvent event) { - if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEdit) { - scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid); - return true; - } - - return false; -} - const NfcProtocolSupportBase nfc_protocol_support_iso15693_3 = { .features = NfcProtocolFeatureEmulateFull | NfcProtocolFeatureEditUid | NfcProtocolFeatureMoreInfo, @@ -149,7 +141,7 @@ const NfcProtocolSupportBase nfc_protocol_support_iso15693_3 = { .scene_saved_menu = { .on_enter = nfc_protocol_support_common_on_enter_empty, - .on_event = nfc_scene_saved_menu_on_event_iso15693_3, + .on_event = nfc_protocol_support_common_on_event_empty, }, .scene_save_name = { diff --git a/applications/main/nfc/helpers/protocol_support/mf_classic/mf_classic.c b/applications/main/nfc/helpers/protocol_support/mf_classic/mf_classic.c index acc641c34..4b639f981 100644 --- a/applications/main/nfc/helpers/protocol_support/mf_classic/mf_classic.c +++ b/applications/main/nfc/helpers/protocol_support/mf_classic/mf_classic.c @@ -200,9 +200,6 @@ static bool nfc_scene_read_menu_on_event_mf_classic(NfcApp* instance, SceneManag scene_manager_next_scene(instance->scene_manager, NfcSceneMfClassicDictAttack); } consumed = true; - } else if(event.event == SubmenuIndexCommonEdit) { - scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid); - consumed = true; } } diff --git a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c index 34354741d..0875f77b3 100644 --- a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c +++ b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c @@ -249,9 +249,6 @@ static bool nfc_scene_read_and_saved_menu_on_event_mf_ultralight( NfcSceneMfUltralightUnlockMenu; scene_manager_next_scene(instance->scene_manager, next_scene); consumed = true; - } else if(event.event == SubmenuIndexCommonEdit) { - scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid); - consumed = true; } } return consumed; diff --git a/applications/main/nfc/helpers/protocol_support/nfc_protocol_support.c b/applications/main/nfc/helpers/protocol_support/nfc_protocol_support.c index 8711af476..5c4352342 100644 --- a/applications/main/nfc/helpers/protocol_support/nfc_protocol_support.c +++ b/applications/main/nfc/helpers/protocol_support/nfc_protocol_support.c @@ -304,6 +304,9 @@ static bool dolphin_deed(DolphinDeedNfcEmulate); scene_manager_next_scene(instance->scene_manager, NfcSceneWrite); consumed = true; + } else if(event.event == SubmenuIndexCommonEdit) { + scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid); + consumed = true; } else { const NfcProtocol protocol = nfc_device_get_protocol(instance->nfc_device); consumed = nfc_protocol_support[protocol]->scene_read_menu.on_event(instance, event); diff --git a/applications/main/nfc/helpers/protocol_support/nfc_protocol_support_gui_common.c b/applications/main/nfc/helpers/protocol_support/nfc_protocol_support_gui_common.c index 8c38f8475..ba309244a 100644 --- a/applications/main/nfc/helpers/protocol_support/nfc_protocol_support_gui_common.c +++ b/applications/main/nfc/helpers/protocol_support/nfc_protocol_support_gui_common.c @@ -26,9 +26,9 @@ void nfc_protocol_support_common_byte_input_done_callback(void* context) { } void nfc_protocol_support_common_text_input_done_callback(void* context) { - NfcApp* nfc = context; + NfcApp* instance = context; - view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventTextInputDone); + view_dispatcher_send_custom_event(instance->view_dispatcher, NfcCustomEventTextInputDone); } void nfc_protocol_support_common_on_enter_empty(NfcApp* instance) { diff --git a/applications/main/nfc/helpers/protocol_support/slix/slix.c b/applications/main/nfc/helpers/protocol_support/slix/slix.c index e998d0ad2..4d9a2061c 100644 --- a/applications/main/nfc/helpers/protocol_support/slix/slix.c +++ b/applications/main/nfc/helpers/protocol_support/slix/slix.c @@ -78,20 +78,21 @@ static NfcCommand nfc_scene_emulate_listener_callback_slix(NfcGenericEvent event furi_assert(event.protocol == NfcProtocolSlix); furi_assert(event.event_data); - NfcApp* nfc = context; + NfcApp* instance = context; SlixListenerEvent* slix_event = event.event_data; if(slix_event->type == SlixListenerEventTypeCustomCommand) { - if(furi_string_size(nfc->text_box_store) < NFC_LOG_SIZE_MAX) { - furi_string_cat_printf(nfc->text_box_store, "R:"); + if(furi_string_size(instance->text_box_store) < NFC_LOG_SIZE_MAX) { + furi_string_cat_printf(instance->text_box_store, "R:"); for(size_t i = 0; i < bit_buffer_get_size_bytes(slix_event->data->buffer); i++) { furi_string_cat_printf( - nfc->text_box_store, + instance->text_box_store, " %02X", bit_buffer_get_byte(slix_event->data->buffer, i)); } - furi_string_push_back(nfc->text_box_store, '\n'); - view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventListenerUpdate); + furi_string_push_back(instance->text_box_store, '\n'); + view_dispatcher_send_custom_event( + instance->view_dispatcher, NfcCustomEventListenerUpdate); } } @@ -105,15 +106,6 @@ static void nfc_scene_emulate_on_enter_slix(NfcApp* instance) { nfc_listener_start(instance->listener, nfc_scene_emulate_listener_callback_slix, instance); } -static bool nfc_scene_saved_menu_on_event_slix(NfcApp* instance, SceneManagerEvent event) { - if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEdit) { - scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid); - return true; - } - - return false; -} - const NfcProtocolSupportBase nfc_protocol_support_slix = { .features = NfcProtocolFeatureEmulateFull | NfcProtocolFeatureMoreInfo, @@ -145,7 +137,7 @@ const NfcProtocolSupportBase nfc_protocol_support_slix = { .scene_saved_menu = { .on_enter = nfc_protocol_support_common_on_enter_empty, - .on_event = nfc_scene_saved_menu_on_event_slix, + .on_event = nfc_protocol_support_common_on_event_empty, }, .scene_save_name = { diff --git a/applications/main/nfc/helpers/protocol_support/st25tb/st25tb.c b/applications/main/nfc/helpers/protocol_support/st25tb/st25tb.c index a119f8cd6..42b547fcb 100644 --- a/applications/main/nfc/helpers/protocol_support/st25tb/st25tb.c +++ b/applications/main/nfc/helpers/protocol_support/st25tb/st25tb.c @@ -61,15 +61,6 @@ static void nfc_scene_read_success_on_enter_st25tb(NfcApp* instance) { furi_string_free(temp_str); } -static bool nfc_scene_saved_menu_on_event_st25tb(NfcApp* instance, SceneManagerEvent event) { - if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEdit) { - scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid); - return true; - } - - return false; -} - const NfcProtocolSupportBase nfc_protocol_support_st25tb = { .features = NfcProtocolFeatureNone, @@ -96,7 +87,7 @@ const NfcProtocolSupportBase nfc_protocol_support_st25tb = { .scene_saved_menu = { .on_enter = nfc_protocol_support_common_on_enter_empty, - .on_event = nfc_scene_saved_menu_on_event_st25tb, + .on_event = nfc_protocol_support_common_on_event_empty, }, .scene_save_name = { diff --git a/applications/main/nfc/helpers/protocol_support/type_4_tag/type_4_tag.c b/applications/main/nfc/helpers/protocol_support/type_4_tag/type_4_tag.c index 30c64d962..3e4ab3212 100644 --- a/applications/main/nfc/helpers/protocol_support/type_4_tag/type_4_tag.c +++ b/applications/main/nfc/helpers/protocol_support/type_4_tag/type_4_tag.c @@ -139,24 +139,23 @@ static void nfc_scene_read_success_on_enter_type_4_tag(NfcApp* instance) { static NfcCommand nfc_scene_emulate_listener_callback_type_4_tag(NfcGenericEvent event, void* context) { - furi_assert(context); furi_assert(event.protocol == NfcProtocolType4Tag); - furi_assert(event.event_data); - NfcApp* nfc = context; + NfcApp* instance = context; Type4TagListenerEvent* type_4_tag_event = event.event_data; if(type_4_tag_event->type == Type4TagListenerEventTypeCustomCommand) { - if(furi_string_size(nfc->text_box_store) < NFC_LOG_SIZE_MAX) { - furi_string_cat_printf(nfc->text_box_store, "R:"); + if(furi_string_size(instance->text_box_store) < NFC_LOG_SIZE_MAX) { + furi_string_cat_printf(instance->text_box_store, "R:"); for(size_t i = 0; i < bit_buffer_get_size_bytes(type_4_tag_event->data->buffer); i++) { furi_string_cat_printf( - nfc->text_box_store, + instance->text_box_store, " %02X", bit_buffer_get_byte(type_4_tag_event->data->buffer, i)); } - furi_string_push_back(nfc->text_box_store, '\n'); - view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventListenerUpdate); + furi_string_push_back(instance->text_box_store, '\n'); + view_dispatcher_send_custom_event( + instance->view_dispatcher, NfcCustomEventListenerUpdate); } }