[FL-1396] Mifare Classic read (#1034)
* rfal: add new data exchange function * core: add FURI_BIT to common defines * furi_hal_nfc: add data exchange with custom patiry bits * lib: extend nfc common API * assets: add mf classic dictionary * lib: introduce mifare classic library * nfc: add dictionary reader helper * nfc worker: add worker events, add mifare classic read * nfc: rework scenes with worker events * nfc: add read mifare classic GUI * nfc device: add mifare classic save * nfc: add dictionary open fail scene * nfc: mention resources * stream: fix stream read line * subghz: rework file read with fixed stream_read_line * furi_hal_nfc: decrease communication timeout * nfc: rework keys load from dictionary with file_stream * nfc: add read mifare classic suggestion * nfc: fix mifare classic read view * nfc: fix index size * nfc: add switch to no dictionary found scene * nfc: add mifare classic load * nfc: improve read mifare classic design * mifare_classic: add proxmark3 mention * nfc: format sources * nfc: fix typos, add documentation
This commit is contained in:
@@ -8,13 +8,13 @@ enum SubmenuIndex {
|
||||
};
|
||||
|
||||
void nfc_scene_card_menu_submenu_callback(void* context, uint32_t index) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
Nfc* nfc = context;
|
||||
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, index);
|
||||
}
|
||||
|
||||
void nfc_scene_card_menu_on_enter(void* context) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
Nfc* nfc = context;
|
||||
Submenu* submenu = nfc->submenu;
|
||||
|
||||
if(nfc->dev->dev_data.nfc_data.protocol > NfcDeviceProtocolUnknown) {
|
||||
@@ -42,7 +42,8 @@ void nfc_scene_card_menu_on_enter(void* context) {
|
||||
}
|
||||
|
||||
bool nfc_scene_card_menu_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
Nfc* nfc = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubmenuIndexRunApp) {
|
||||
@@ -54,34 +55,36 @@ bool nfc_scene_card_menu_on_event(void* context, SceneManagerEvent event) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneReadMifareDesfire);
|
||||
} else if(nfc->dev->dev_data.nfc_data.protocol == NfcDeviceProtocolEMV) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneReadEmvApp);
|
||||
} else if(nfc->dev->dev_data.nfc_data.protocol == NfcDeviceProtocolMifareClassic) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneReadMifareClassic);
|
||||
}
|
||||
return true;
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexChooseScript) {
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneCardMenu, SubmenuIndexChooseScript);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneScriptsMenu);
|
||||
return true;
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexEmulate) {
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneCardMenu, SubmenuIndexEmulate);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneEmulateUid);
|
||||
return true;
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexSave) {
|
||||
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneCardMenu, SubmenuIndexSave);
|
||||
nfc->dev->format = NfcDeviceSaveFormatUid;
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveName);
|
||||
return true;
|
||||
consumed = true;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
return scene_manager_search_and_switch_to_previous_scene(
|
||||
nfc->scene_manager, NfcSceneStart);
|
||||
consumed =
|
||||
scene_manager_search_and_switch_to_previous_scene(nfc->scene_manager, NfcSceneStart);
|
||||
}
|
||||
|
||||
return false;
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_scene_card_menu_on_exit(void* context) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
Nfc* nfc = context;
|
||||
|
||||
submenu_reset(nfc->submenu);
|
||||
}
|
||||
|
||||
@@ -34,3 +34,5 @@ ADD_SCENE(nfc, emulate_apdu_sequence, EmulateApduSequence)
|
||||
ADD_SCENE(nfc, restore_original, RestoreOriginal)
|
||||
ADD_SCENE(nfc, debug, Debug)
|
||||
ADD_SCENE(nfc, field, Field)
|
||||
ADD_SCENE(nfc, read_mifare_classic, ReadMifareClassic)
|
||||
ADD_SCENE(nfc, dict_not_found, DictNotFound)
|
||||
|
||||
@@ -30,13 +30,19 @@ void nfc_scene_device_info_bank_card_callback(GuiButtonType result, InputType ty
|
||||
void nfc_scene_device_info_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
bool data_display_supported = (nfc->dev->format == NfcDeviceSaveFormatUid) ||
|
||||
(nfc->dev->format == NfcDeviceSaveFormatMifareUl) ||
|
||||
(nfc->dev->format == NfcDeviceSaveFormatMifareDesfire) ||
|
||||
(nfc->dev->format == NfcDeviceSaveFormatBankCard);
|
||||
// Setup Custom Widget view
|
||||
widget_add_text_box_element(
|
||||
nfc->widget, 0, 0, 128, 22, AlignCenter, AlignTop, nfc->dev->dev_name);
|
||||
widget_add_button_element(
|
||||
nfc->widget, GuiButtonTypeLeft, "Back", nfc_scene_device_info_widget_callback, nfc);
|
||||
widget_add_button_element(
|
||||
nfc->widget, GuiButtonTypeRight, "Data", nfc_scene_device_info_widget_callback, nfc);
|
||||
if(data_display_supported) {
|
||||
widget_add_button_element(
|
||||
nfc->widget, GuiButtonTypeRight, "Data", nfc_scene_device_info_widget_callback, nfc);
|
||||
}
|
||||
char uid_str[32];
|
||||
NfcDeviceCommonData* data = &nfc->dev->dev_data.nfc_data;
|
||||
if(data->uid_len == 4) {
|
||||
@@ -69,6 +75,8 @@ void nfc_scene_device_info_on_enter(void* context) {
|
||||
protocol_name = nfc_guess_protocol(data->protocol);
|
||||
} else if(data->protocol == NfcDeviceProtocolMifareUl) {
|
||||
protocol_name = nfc_mf_ul_type(nfc->dev->dev_data.mf_ul_data.type, false);
|
||||
} else if(data->protocol == NfcDeviceProtocolMifareClassic) {
|
||||
protocol_name = nfc_mf_classic_type(nfc->dev->dev_data.mf_classic_data.type);
|
||||
}
|
||||
if(protocol_name) {
|
||||
widget_add_string_element(
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
#include "../nfc_i.h"
|
||||
|
||||
void nfc_scene_dict_not_found_popup_callback(void* context) {
|
||||
Nfc* nfc = context;
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventViewExit);
|
||||
}
|
||||
|
||||
void nfc_scene_dict_not_found_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
// Setup view
|
||||
Popup* popup = nfc->popup;
|
||||
popup_set_text(
|
||||
popup,
|
||||
"Function requires\nan SD card with\nfresh databases.",
|
||||
82,
|
||||
24,
|
||||
AlignCenter,
|
||||
AlignCenter);
|
||||
popup_set_icon(popup, 6, 10, &I_SDQuestion_35x43);
|
||||
popup_set_timeout(popup, 2500);
|
||||
popup_set_context(popup, nfc);
|
||||
popup_set_callback(popup, nfc_scene_dict_not_found_popup_callback);
|
||||
popup_enable_timeout(popup);
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
|
||||
}
|
||||
|
||||
bool nfc_scene_dict_not_found_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == NfcCustomEventViewExit) {
|
||||
if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneScriptsMenu)) {
|
||||
consumed = scene_manager_search_and_switch_to_previous_scene(
|
||||
nfc->scene_manager, NfcSceneScriptsMenu);
|
||||
} else if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneCardMenu)) {
|
||||
consumed = scene_manager_search_and_switch_to_previous_scene(
|
||||
nfc->scene_manager, NfcSceneCardMenu);
|
||||
} else {
|
||||
consumed = scene_manager_search_and_switch_to_previous_scene(
|
||||
nfc->scene_manager, NfcSceneStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_scene_dict_not_found_on_exit(void* context) {
|
||||
Nfc* nfc = context;
|
||||
popup_reset(nfc->popup);
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
#define NFC_MF_UL_DATA_NOT_CHANGED (0UL)
|
||||
#define NFC_MF_UL_DATA_CHANGED (1UL)
|
||||
|
||||
void nfc_emulate_mifare_ul_worker_callback(void* context) {
|
||||
void nfc_emulate_mifare_ul_worker_callback(NfcWorkerEvent event, void* context) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneEmulateMifareUl, NFC_MF_UL_DATA_CHANGED);
|
||||
|
||||
@@ -6,7 +6,7 @@ enum {
|
||||
NfcSceneEmulateUidStateTextBox,
|
||||
};
|
||||
|
||||
void nfc_emulate_uid_worker_callback(void* context) {
|
||||
void nfc_emulate_uid_worker_callback(NfcWorkerEvent event, void* context) {
|
||||
furi_assert(context);
|
||||
Nfc* nfc = context;
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventWorkerExit);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
void nfc_read_card_worker_callback(void* context) {
|
||||
void nfc_read_card_worker_callback(NfcWorkerEvent event, void* context) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventWorkerExit);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
void nfc_read_emv_app_worker_callback(void* context) {
|
||||
void nfc_read_emv_app_worker_callback(NfcWorkerEvent event, void* context) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventWorkerExit);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
void nfc_read_emv_data_worker_callback(void* context) {
|
||||
void nfc_read_emv_data_worker_callback(NfcWorkerEvent event, void* context) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventWorkerExit);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
#include "../nfc_i.h"
|
||||
|
||||
enum {
|
||||
NfcSceneReadMifareClassicStateInProgress,
|
||||
NfcSceneReadMifareClassicStateDone,
|
||||
};
|
||||
|
||||
void nfc_read_mifare_classic_worker_callback(NfcWorkerEvent event, void* context) {
|
||||
furi_assert(context);
|
||||
Nfc* nfc = context;
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, event);
|
||||
}
|
||||
|
||||
void nfc_read_mifare_classic_dict_attack_result_callback(void* context) {
|
||||
furi_assert(context);
|
||||
Nfc* nfc = context;
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventDictAttackDone);
|
||||
}
|
||||
|
||||
void nfc_scene_read_mifare_classic_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
// Setup and start worker
|
||||
memset(&nfc->dev->dev_data.mf_classic_data, 0, sizeof(MfClassicData));
|
||||
dict_attack_set_result_callback(
|
||||
nfc->dict_attack, nfc_read_mifare_classic_dict_attack_result_callback, nfc);
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneReadMifareClassic, NfcSceneReadMifareClassicStateInProgress);
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewDictAttack);
|
||||
nfc_worker_start(
|
||||
nfc->worker,
|
||||
NfcWorkerStateReadMifareClassic,
|
||||
&nfc->dev->dev_data,
|
||||
nfc_read_mifare_classic_worker_callback,
|
||||
nfc);
|
||||
}
|
||||
|
||||
bool nfc_scene_read_mifare_classic_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = context;
|
||||
bool consumed = false;
|
||||
|
||||
uint32_t state = scene_manager_get_scene_state(nfc->scene_manager, NfcSceneReadMifareClassic);
|
||||
if(event.type == SceneManagerEventTypeTick) {
|
||||
if(state == NfcSceneReadMifareClassicStateInProgress) {
|
||||
notification_message(nfc->notifications, &sequence_blink_blue_10);
|
||||
}
|
||||
consumed = true;
|
||||
} else if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == NfcCustomEventDictAttackDone) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveName);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventDetectedClassic1k) {
|
||||
dict_attack_card_detected(nfc->dict_attack, MfClassicType1k);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventDetectedClassic4k) {
|
||||
dict_attack_card_detected(nfc->dict_attack, MfClassicType4k);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventNewSector) {
|
||||
dict_attack_inc_curr_sector(nfc->dict_attack);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventFoundKeyA) {
|
||||
dict_attack_inc_found_key(nfc->dict_attack, MfClassicKeyA);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventFoundKeyB) {
|
||||
dict_attack_inc_found_key(nfc->dict_attack, MfClassicKeyB);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventNoCardDetected) {
|
||||
dict_attack_card_removed(nfc->dict_attack);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventSuccess) {
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneReadMifareClassic, NfcSceneReadMifareClassicStateDone);
|
||||
notification_message(nfc->notifications, &sequence_success);
|
||||
nfc->dev->format = NfcDeviceSaveFormatMifareClassic;
|
||||
dict_attack_set_result(nfc->dict_attack, true);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventFail) {
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneReadMifareClassic, NfcSceneReadMifareClassicStateDone);
|
||||
dict_attack_set_result(nfc->dict_attack, false);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventNoDictFound) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneDictNotFound);
|
||||
consumed = true;
|
||||
}
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_scene_read_mifare_classic_on_exit(void* context) {
|
||||
Nfc* nfc = context;
|
||||
// Stop worker
|
||||
nfc_worker_stop(nfc->worker);
|
||||
dict_attack_reset(nfc->dict_attack);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
void nfc_read_mifare_desfire_worker_callback(void* context) {
|
||||
void nfc_read_mifare_desfire_worker_callback(NfcWorkerEvent event, void* context) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventWorkerExit);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
void nfc_read_mifare_ul_worker_callback(void* context) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
void nfc_read_mifare_ul_worker_callback(NfcWorkerEvent event, void* context) {
|
||||
Nfc* nfc = context;
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventWorkerExit);
|
||||
}
|
||||
|
||||
void nfc_scene_read_mifare_ul_on_enter(void* context) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
Nfc* nfc = context;
|
||||
DOLPHIN_DEED(DolphinDeedNfcRead);
|
||||
|
||||
// Setup view
|
||||
@@ -26,29 +26,25 @@ void nfc_scene_read_mifare_ul_on_enter(void* context) {
|
||||
}
|
||||
|
||||
bool nfc_scene_read_mifare_ul_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
Nfc* nfc = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == NfcCustomEventWorkerExit) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneReadMifareUlSuccess);
|
||||
return true;
|
||||
consumed = true;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeTick) {
|
||||
notification_message(nfc->notifications, &sequence_blink_blue_10);
|
||||
return true;
|
||||
consumed = true;
|
||||
}
|
||||
return false;
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_scene_read_mifare_ul_on_exit(void* context) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
|
||||
Nfc* nfc = context;
|
||||
// Stop worker
|
||||
nfc_worker_stop(nfc->worker);
|
||||
|
||||
// Clear view
|
||||
Popup* popup = nfc->popup;
|
||||
popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignBottom);
|
||||
popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignTop);
|
||||
popup_set_icon(popup, 0, 0, NULL);
|
||||
popup_reset(nfc->popup);
|
||||
}
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
enum SubmenuIndex {
|
||||
SubmenuIndexBankCard,
|
||||
SubmenuIndexMifareUltralight,
|
||||
SubmenuIdexReadMfClassic,
|
||||
SubmenuIndexMifareDesfire,
|
||||
};
|
||||
|
||||
void nfc_scene_scripts_menu_submenu_callback(void* context, uint32_t index) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
|
||||
Nfc* nfc = context;
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, index);
|
||||
}
|
||||
|
||||
void nfc_scene_scripts_menu_on_enter(void* context) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
Nfc* nfc = context;
|
||||
Submenu* submenu = nfc->submenu;
|
||||
|
||||
submenu_add_item(
|
||||
@@ -28,6 +28,12 @@ void nfc_scene_scripts_menu_on_enter(void* context) {
|
||||
SubmenuIndexMifareUltralight,
|
||||
nfc_scene_scripts_menu_submenu_callback,
|
||||
nfc);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Read Mifare Classic",
|
||||
SubmenuIdexReadMfClassic,
|
||||
nfc_scene_scripts_menu_submenu_callback,
|
||||
nfc);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Read Mifare DESFire",
|
||||
@@ -40,32 +46,37 @@ void nfc_scene_scripts_menu_on_enter(void* context) {
|
||||
}
|
||||
|
||||
bool nfc_scene_scripts_menu_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
Nfc* nfc = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubmenuIndexBankCard) {
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneScriptsMenu, SubmenuIndexBankCard);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneReadEmvApp);
|
||||
return true;
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexMifareUltralight) {
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneScriptsMenu, SubmenuIndexMifareUltralight);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneReadMifareUl);
|
||||
return true;
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIdexReadMfClassic) {
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneScriptsMenu, SubmenuIdexReadMfClassic);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneReadMifareClassic);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexMifareDesfire) {
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneScriptsMenu, SubmenuIndexMifareDesfire);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneReadMifareDesfire);
|
||||
return true;
|
||||
consumed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_scene_scripts_menu_on_exit(void* context) {
|
||||
Nfc* nfc = (Nfc*)context;
|
||||
|
||||
Nfc* nfc = context;
|
||||
submenu_reset(nfc->submenu);
|
||||
}
|
||||
|
||||
@@ -49,21 +49,15 @@ bool nfc_scene_start_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubmenuIndexRead) {
|
||||
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneStart, SubmenuIndexRead);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneReadCard);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexRunScript) {
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneStart, SubmenuIndexRunScript);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneScriptsMenu);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexSaved) {
|
||||
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneStart, SubmenuIndexSaved);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneFileSelect);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexAddManualy) {
|
||||
scene_manager_set_scene_state(
|
||||
nfc->scene_manager, NfcSceneStart, SubmenuIndexAddManualy);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneSetType);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexDebug) {
|
||||
@@ -71,6 +65,7 @@ bool nfc_scene_start_on_event(void* context, SceneManagerEvent event) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneDebug);
|
||||
consumed = true;
|
||||
}
|
||||
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneStart, event.event);
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user