Changes required due to event signature adjustment

This commit is contained in:
RebornedBrain 2024-01-23 22:39:25 +03:00
parent 9fb14704c3
commit aad9f6be28
12 changed files with 68 additions and 65 deletions

View File

@ -58,8 +58,8 @@ static void nfc_scene_read_success_on_enter_felica(NfcApp* instance) {
furi_string_free(temp_str); furi_string_free(temp_str);
} }
static bool nfc_scene_saved_menu_on_event_felica(NfcApp* instance, uint32_t event) { static bool nfc_scene_saved_menu_on_event_felica(NfcApp* instance, SceneManagerEvent event) {
if(event == SubmenuIndexCommonEdit) { if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEdit) {
scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid); scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid);
return true; return true;
} }

View File

@ -95,8 +95,8 @@ static void nfc_scene_emulate_on_enter_iso14443_3a(NfcApp* instance) {
instance->listener, nfc_scene_emulate_listener_callback_iso14443_3a, instance); instance->listener, nfc_scene_emulate_listener_callback_iso14443_3a, instance);
} }
static bool nfc_scene_read_menu_on_event_iso14443_3a(NfcApp* instance, uint32_t event) { static bool nfc_scene_read_menu_on_event_iso14443_3a(NfcApp* instance, SceneManagerEvent event) {
if(event == SubmenuIndexCommonEmulate) { if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEmulate) {
scene_manager_next_scene(instance->scene_manager, NfcSceneEmulate); scene_manager_next_scene(instance->scene_manager, NfcSceneEmulate);
return true; return true;
} }

View File

@ -59,8 +59,8 @@ static void nfc_scene_read_success_on_enter_iso14443_3b(NfcApp* instance) {
furi_string_free(temp_str); furi_string_free(temp_str);
} }
bool nfc_scene_saved_menu_on_event_iso14443_3b_common(NfcApp* instance, uint32_t event) { bool nfc_scene_saved_menu_on_event_iso14443_3b_common(NfcApp* instance, SceneManagerEvent event) {
if(event == SubmenuIndexCommonEdit) { if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEdit) {
scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid); scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid);
return true; return true;
} }
@ -68,7 +68,7 @@ bool nfc_scene_saved_menu_on_event_iso14443_3b_common(NfcApp* instance, uint32_t
return false; return false;
} }
static bool nfc_scene_saved_menu_on_event_iso14443_3b(NfcApp* instance, uint32_t event) { 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); return nfc_scene_saved_menu_on_event_iso14443_3b_common(instance, event);
} }

View File

@ -4,4 +4,4 @@
#include "iso14443_3b.h" #include "iso14443_3b.h"
bool nfc_scene_saved_menu_on_event_iso14443_3b_common(NfcApp* instance, uint32_t event); bool nfc_scene_saved_menu_on_event_iso14443_3b_common(NfcApp* instance, SceneManagerEvent event);

View File

@ -99,8 +99,8 @@ static void nfc_scene_emulate_on_enter_iso14443_4a(NfcApp* instance) {
instance->listener, nfc_scene_emulate_listener_callback_iso14443_4a, instance); instance->listener, nfc_scene_emulate_listener_callback_iso14443_4a, instance);
} }
static bool nfc_scene_read_menu_on_event_iso14443_4a(NfcApp* instance, uint32_t event) { static bool nfc_scene_read_menu_on_event_iso14443_4a(NfcApp* instance, SceneManagerEvent event) {
if(event == SubmenuIndexCommonEmulate) { if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEmulate) {
scene_manager_next_scene(instance->scene_manager, NfcSceneEmulate); scene_manager_next_scene(instance->scene_manager, NfcSceneEmulate);
return true; return true;
} }

View File

@ -64,8 +64,8 @@ static void nfc_scene_saved_menu_on_enter_iso14443_4b(NfcApp* instance) {
UNUSED(instance); UNUSED(instance);
} }
static bool nfc_scene_read_menu_on_event_iso14443_4b(NfcApp* instance, uint32_t event) { static bool nfc_scene_read_menu_on_event_iso14443_4b(NfcApp* instance, SceneManagerEvent event) {
if(event == SubmenuIndexCommonEmulate) { if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEmulate) {
scene_manager_next_scene(instance->scene_manager, NfcSceneEmulate); scene_manager_next_scene(instance->scene_manager, NfcSceneEmulate);
return true; return true;
} }
@ -73,7 +73,7 @@ static bool nfc_scene_read_menu_on_event_iso14443_4b(NfcApp* instance, uint32_t
return false; return false;
} }
static bool nfc_scene_saved_menu_on_event_iso14443_4b(NfcApp* instance, uint32_t event) { 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); return nfc_scene_saved_menu_on_event_iso14443_3b_common(instance, event);
} }

View File

@ -94,8 +94,8 @@ static void nfc_scene_emulate_on_enter_iso15693_3(NfcApp* instance) {
instance->listener, nfc_scene_emulate_listener_callback_iso15693_3, instance); instance->listener, nfc_scene_emulate_listener_callback_iso15693_3, instance);
} }
static bool nfc_scene_saved_menu_on_event_iso15693_3(NfcApp* instance, uint32_t event) { static bool nfc_scene_saved_menu_on_event_iso15693_3(NfcApp* instance, SceneManagerEvent event) {
if(event == SubmenuIndexCommonEdit) { if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEdit) {
scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid); scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid);
return true; return true;
} }

View File

@ -99,8 +99,9 @@ static void nfc_scene_read_on_enter_mf_classic(NfcApp* instance) {
nfc_poller_start(instance->poller, nfc_scene_read_poller_callback_mf_classic, instance); nfc_poller_start(instance->poller, nfc_scene_read_poller_callback_mf_classic, instance);
} }
static bool nfc_scene_read_on_event_mf_classic(NfcApp* instance, uint32_t event) { static bool nfc_scene_read_on_event_mf_classic(NfcApp* instance, SceneManagerEvent event) {
if(event == NfcCustomEventPollerIncomplete) { if(event.type == SceneManagerEventTypeCustom &&
event.event == NfcCustomEventPollerIncomplete) {
scene_manager_next_scene(instance->scene_manager, NfcSceneMfClassicDictAttack); scene_manager_next_scene(instance->scene_manager, NfcSceneMfClassicDictAttack);
} }
@ -170,8 +171,8 @@ static void nfc_scene_emulate_on_enter_mf_classic(NfcApp* instance) {
nfc_listener_start(instance->listener, NULL, NULL); nfc_listener_start(instance->listener, NULL, NULL);
} }
static bool nfc_scene_read_menu_on_event_mf_classic(NfcApp* instance, uint32_t event) { static bool nfc_scene_read_menu_on_event_mf_classic(NfcApp* instance, SceneManagerEvent event) {
if(event == SubmenuIndexDetectReader) { if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexDetectReader) {
scene_manager_next_scene(instance->scene_manager, NfcSceneSaveConfirm); scene_manager_next_scene(instance->scene_manager, NfcSceneSaveConfirm);
dolphin_deed(DolphinDeedNfcDetectReader); dolphin_deed(DolphinDeedNfcDetectReader);
return true; return true;
@ -180,27 +181,29 @@ static bool nfc_scene_read_menu_on_event_mf_classic(NfcApp* instance, uint32_t e
return false; return false;
} }
static bool nfc_scene_saved_menu_on_event_mf_classic(NfcApp* instance, uint32_t event) { static bool nfc_scene_saved_menu_on_event_mf_classic(NfcApp* instance, SceneManagerEvent event) {
bool consumed = false; bool consumed = false;
if(event == SubmenuIndexDetectReader) { if(event.type == SceneManagerEventTypeCustom) {
scene_manager_next_scene(instance->scene_manager, NfcSceneMfClassicDetectReader); if(event.event == SubmenuIndexDetectReader) {
consumed = true; scene_manager_next_scene(instance->scene_manager, NfcSceneMfClassicDetectReader);
} else if(event == SubmenuIndexWrite) { consumed = true;
scene_manager_next_scene(instance->scene_manager, NfcSceneMfClassicWriteInitial); } else if(event.event == SubmenuIndexWrite) {
consumed = true; scene_manager_next_scene(instance->scene_manager, NfcSceneMfClassicWriteInitial);
} else if(event == SubmenuIndexUpdate) { consumed = true;
scene_manager_next_scene(instance->scene_manager, NfcSceneMfClassicUpdateInitial); } else if(event.event == SubmenuIndexUpdate) {
consumed = true; scene_manager_next_scene(instance->scene_manager, NfcSceneMfClassicUpdateInitial);
consumed = true;
}
} }
return consumed; return consumed;
} }
static bool nfc_scene_save_name_on_event_mf_classic(NfcApp* instance, uint32_t event) { static bool nfc_scene_save_name_on_event_mf_classic(NfcApp* instance, SceneManagerEvent event) {
bool consumed = false; bool consumed = false;
if(event == NfcCustomEventTextInputDone) { if(event.type == SceneManagerEventTypeCustom && event.event == NfcCustomEventTextInputDone) {
mf_classic_key_cache_save( mf_classic_key_cache_save(
instance->mfc_key_cache, instance->mfc_key_cache,
nfc_device_get_data(instance->nfc_device, NfcProtocolMfClassic)); nfc_device_get_data(instance->nfc_device, NfcProtocolMfClassic));

View File

@ -132,15 +132,17 @@ static void nfc_scene_read_on_enter_mf_ultralight(NfcApp* instance) {
nfc_poller_start(instance->poller, nfc_scene_read_poller_callback_mf_ultralight, instance); nfc_poller_start(instance->poller, nfc_scene_read_poller_callback_mf_ultralight, instance);
} }
bool nfc_scene_read_on_event_mf_ultralight(NfcApp* instance, uint32_t event) { bool nfc_scene_read_on_event_mf_ultralight(NfcApp* instance, SceneManagerEvent event) {
if(event == NfcCustomEventCardDetected) { if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state( if(event.event == NfcCustomEventCardDetected) {
instance->scene_manager, NfcSceneRead, NfcSceneMfUltralightReadMenuStateCardFound); scene_manager_set_scene_state(
nfc_scene_read_setup_view(instance); instance->scene_manager, NfcSceneRead, NfcSceneMfUltralightReadMenuStateCardFound);
} else if((event == NfcCustomEventPollerIncomplete)) { nfc_scene_read_setup_view(instance);
notification_message(instance->notifications, &sequence_semi_success); } else if((event.event == NfcCustomEventPollerIncomplete)) {
scene_manager_next_scene(instance->scene_manager, NfcSceneReadSuccess); notification_message(instance->notifications, &sequence_semi_success);
dolphin_deed(DolphinDeedNfcReadSuccess); scene_manager_next_scene(instance->scene_manager, NfcSceneReadSuccess);
dolphin_deed(DolphinDeedNfcReadSuccess);
}
} }
return true; return true;
} }
@ -202,14 +204,17 @@ static void nfc_scene_emulate_on_enter_mf_ultralight(NfcApp* instance) {
nfc_listener_start(instance->listener, NULL, NULL); nfc_listener_start(instance->listener, NULL, NULL);
} }
static bool static bool nfc_scene_read_and_saved_menu_on_event_mf_ultralight(
nfc_scene_read_and_saved_menu_on_event_mf_ultralight(NfcApp* instance, uint32_t event) { NfcApp* instance,
if(event == SubmenuIndexUnlock) { SceneManagerEvent event) {
scene_manager_next_scene(instance->scene_manager, NfcSceneMfUltralightUnlockMenu); if(event.type == SceneManagerEventTypeCustom) {
return true; if(event.event == SubmenuIndexUnlock) {
} else if(event == SubmenuIndexWrite) { scene_manager_next_scene(instance->scene_manager, NfcSceneMfUltralightUnlockMenu);
scene_manager_next_scene(instance->scene_manager, NfcSceneMfUltralightWrite); return true;
return true; } else if(event.event == SubmenuIndexWrite) {
scene_manager_next_scene(instance->scene_manager, NfcSceneMfUltralightWrite);
return true;
}
} }
return false; return false;
} }

View File

@ -131,10 +131,8 @@ static bool
nfc_protocol_support_scene_more_info_on_event(NfcApp* instance, SceneManagerEvent event) { nfc_protocol_support_scene_more_info_on_event(NfcApp* instance, SceneManagerEvent event) {
bool consumed = false; bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) { const NfcProtocol protocol = nfc_device_get_protocol(instance->nfc_device);
const NfcProtocol protocol = nfc_device_get_protocol(instance->nfc_device); consumed = nfc_protocol_support[protocol]->scene_more_info.on_event(instance, event);
consumed = nfc_protocol_support[protocol]->scene_more_info.on_event(instance, event.event);
}
return consumed; return consumed;
} }
@ -188,8 +186,7 @@ static bool nfc_protocol_support_scene_read_on_event(NfcApp* instance, SceneMana
} else { } else {
const NfcProtocol protocol = const NfcProtocol protocol =
instance->protocols_detected[instance->protocols_detected_selected_idx]; instance->protocols_detected[instance->protocols_detected_selected_idx];
consumed = consumed = nfc_protocol_support[protocol]->scene_read.on_event(instance, event);
nfc_protocol_support[protocol]->scene_read.on_event(instance, event.event);
} }
} else if(event.event == NfcCustomEventPollerFailure) { } else if(event.event == NfcCustomEventPollerFailure) {
nfc_poller_stop(instance->poller); nfc_poller_stop(instance->poller);
@ -202,7 +199,7 @@ static bool nfc_protocol_support_scene_read_on_event(NfcApp* instance, SceneMana
} else if(event.event == NfcCustomEventCardDetected) { } else if(event.event == NfcCustomEventCardDetected) {
const NfcProtocol protocol = const NfcProtocol protocol =
instance->protocols_detected[instance->protocols_detected_selected_idx]; instance->protocols_detected[instance->protocols_detected_selected_idx];
consumed = nfc_protocol_support[protocol]->scene_read.on_event(instance, event.event); consumed = nfc_protocol_support[protocol]->scene_read.on_event(instance, event);
} }
} else if(event.type == SceneManagerEventTypeBack) { } else if(event.type == SceneManagerEventTypeBack) {
nfc_poller_stop(instance->poller); nfc_poller_stop(instance->poller);
@ -287,8 +284,7 @@ static bool
consumed = true; consumed = true;
} else { } else {
const NfcProtocol protocol = nfc_device_get_protocol(instance->nfc_device); const NfcProtocol protocol = nfc_device_get_protocol(instance->nfc_device);
consumed = consumed = nfc_protocol_support[protocol]->scene_read_menu.on_event(instance, event);
nfc_protocol_support[protocol]->scene_read_menu.on_event(instance, event.event);
} }
} else if(event.type == SceneManagerEventTypeBack) { } else if(event.type == SceneManagerEventTypeBack) {
@ -456,8 +452,7 @@ static bool
consumed = true; consumed = true;
} else { } else {
const NfcProtocol protocol = nfc_device_get_protocol(instance->nfc_device); const NfcProtocol protocol = nfc_device_get_protocol(instance->nfc_device);
consumed = consumed = nfc_protocol_support[protocol]->scene_saved_menu.on_event(instance, event);
nfc_protocol_support[protocol]->scene_saved_menu.on_event(instance, event.event);
} }
} else if(event.type == SceneManagerEventTypeBack) { } else if(event.type == SceneManagerEventTypeBack) {
@ -523,8 +518,8 @@ static bool
DolphinDeedNfcSave); DolphinDeedNfcSave);
const NfcProtocol protocol = const NfcProtocol protocol =
instance->protocols_detected[instance->protocols_detected_selected_idx]; instance->protocols_detected[instance->protocols_detected_selected_idx];
consumed = nfc_protocol_support[protocol]->scene_save_name.on_event( consumed =
instance, event.event); nfc_protocol_support[protocol]->scene_save_name.on_event(instance, event);
} else { } else {
consumed = scene_manager_search_and_switch_to_previous_scene( consumed = scene_manager_search_and_switch_to_previous_scene(
instance->scene_manager, NfcSceneStart); instance->scene_manager, NfcSceneStart);

View File

@ -91,8 +91,8 @@ static void nfc_scene_emulate_on_enter_slix(NfcApp* instance) {
nfc_listener_start(instance->listener, nfc_scene_emulate_listener_callback_slix, instance); nfc_listener_start(instance->listener, nfc_scene_emulate_listener_callback_slix, instance);
} }
static bool nfc_scene_saved_menu_on_event_slix(NfcApp* instance, uint32_t event) { static bool nfc_scene_saved_menu_on_event_slix(NfcApp* instance, SceneManagerEvent event) {
if(event == SubmenuIndexCommonEdit) { if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEdit) {
scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid); scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid);
return true; return true;
} }

View File

@ -60,8 +60,8 @@ static void nfc_scene_read_success_on_enter_st25tb(NfcApp* instance) {
furi_string_free(temp_str); furi_string_free(temp_str);
} }
static bool nfc_scene_saved_menu_on_event_st25tb(NfcApp* instance, uint32_t event) { static bool nfc_scene_saved_menu_on_event_st25tb(NfcApp* instance, SceneManagerEvent event) {
if(event == SubmenuIndexCommonEdit) { if(event.type == SceneManagerEventTypeCustom && event.event == SubmenuIndexCommonEdit) {
scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid); scene_manager_next_scene(instance->scene_manager, NfcSceneSetUid);
return true; return true;
} }