fix naming ReadAuth->Unlock

This commit is contained in:
g3gg0
2022-11-09 21:19:12 +01:00
parent c840e9ad49
commit fa74fc9541
6 changed files with 34 additions and 34 deletions

View File

@@ -17,7 +17,7 @@ ADD_SCENE(nfc, nfca_menu, NfcaMenu)
ADD_SCENE(nfc, nfcv_menu, NfcVMenu) ADD_SCENE(nfc, nfcv_menu, NfcVMenu)
ADD_SCENE(nfc, nfcv_unlock_menu, NfcVUnlockMenu) ADD_SCENE(nfc, nfcv_unlock_menu, NfcVUnlockMenu)
ADD_SCENE(nfc, nfcv_key_input, NfcVKeyInput) ADD_SCENE(nfc, nfcv_key_input, NfcVKeyInput)
ADD_SCENE(nfc, nfcv_read_auth, NfcVReadAuth) ADD_SCENE(nfc, nfcv_unlock, NfcVUnlock)
ADD_SCENE(nfc, mf_ultralight_read_success, MfUltralightReadSuccess) ADD_SCENE(nfc, mf_ultralight_read_success, MfUltralightReadSuccess)
ADD_SCENE(nfc, mf_ultralight_data, MfUltralightData) ADD_SCENE(nfc, mf_ultralight_data, MfUltralightData)
ADD_SCENE(nfc, mf_ultralight_menu, MfUltralightMenu) ADD_SCENE(nfc, mf_ultralight_menu, MfUltralightMenu)

View File

@@ -30,7 +30,7 @@ bool nfc_scene_nfcv_key_input_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) { if(event.type == SceneManagerEventTypeCustom) {
if(event.event == NfcCustomEventByteInputDone) { if(event.event == NfcCustomEventByteInputDone) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVReadAuth); scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVUnlock);
DOLPHIN_DEED(DolphinDeedNfcRead); DOLPHIN_DEED(DolphinDeedNfcRead);
consumed = true; consumed = true;
} }

View File

@@ -2,14 +2,14 @@
#include <dolphin/dolphin.h> #include <dolphin/dolphin.h>
typedef enum { typedef enum {
NfcSceneNfcVReadStateIdle, NfcSceneNfcVUnlockStateIdle,
NfcSceneNfcVReadStateDetecting, NfcSceneNfcVUnlockStateDetecting,
NfcSceneNfcVReadStateUnlocked, NfcSceneNfcVUnlockStateUnlocked,
NfcSceneNfcVReadStateAlreadyUnlocked, NfcSceneNfcVUnlockStateAlreadyUnlocked,
NfcSceneNfcVReadStateNotSupportedCard, NfcSceneNfcVUnlockStateNotSupportedCard,
} NfcSceneNfcVReadState; } NfcSceneNfcVUnlockState;
bool nfc_scene_nfcv_read_auth_worker_callback(NfcWorkerEvent event, void* context) { bool nfc_scene_nfcv_unlock_worker_callback(NfcWorkerEvent event, void* context) {
Nfc* nfc = context; Nfc* nfc = context;
if(event == NfcWorkerEventNfcVPassKey) { if(event == NfcWorkerEventNfcVPassKey) {
@@ -20,24 +20,24 @@ bool nfc_scene_nfcv_read_auth_worker_callback(NfcWorkerEvent event, void* contex
return true; return true;
} }
void nfc_scene_nfcv_read_auth_popup_callback(void* context) { void nfc_scene_nfcv_unlock_popup_callback(void* context) {
Nfc* nfc = context; Nfc* nfc = context;
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventViewExit); view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventViewExit);
} }
void nfc_scene_nfcv_read_auth_set_state(Nfc* nfc, NfcSceneNfcVReadState state) { void nfc_scene_nfcv_unlock_set_state(Nfc* nfc, NfcSceneNfcVUnlockState state) {
NfcVData* nfcv_data = &(nfc->dev->dev_data.nfcv_data); NfcVData* nfcv_data = &(nfc->dev->dev_data.nfcv_data);
uint32_t curr_state = uint32_t curr_state =
scene_manager_get_scene_state(nfc->scene_manager, NfcSceneNfcVReadAuth); scene_manager_get_scene_state(nfc->scene_manager, NfcSceneNfcVUnlock);
if(curr_state != state) { if(curr_state != state) {
Popup* popup = nfc->popup; Popup* popup = nfc->popup;
if(state == NfcSceneNfcVReadStateDetecting) { if(state == NfcSceneNfcVUnlockStateDetecting) {
popup_reset(popup); popup_reset(popup);
popup_set_text( popup_set_text(
popup, "Put Tonie On\nFlipper's Back", 97, 24, AlignCenter, AlignTop); popup, "Put Tonie On\nFlipper's Back", 97, 24, AlignCenter, AlignTop);
popup_set_icon(popup, 0, 8, &I_NFC_manual_60x50); popup_set_icon(popup, 0, 8, &I_NFC_manual_60x50);
} else if(state == NfcSceneNfcVReadStateUnlocked) { } else if(state == NfcSceneNfcVUnlockStateUnlocked) {
popup_reset(popup); popup_reset(popup);
notification_message(nfc->notifications, &sequence_success); notification_message(nfc->notifications, &sequence_success);
@@ -45,24 +45,24 @@ void nfc_scene_nfcv_read_auth_set_state(Nfc* nfc, NfcSceneNfcVReadState state) {
popup_set_header(popup, "Successfully\nUnlocked!", 94, 3, AlignCenter, AlignTop); popup_set_header(popup, "Successfully\nUnlocked!", 94, 3, AlignCenter, AlignTop);
popup_set_icon(popup, 0, 6, &I_RFIDDolphinSuccess_108x57); popup_set_icon(popup, 0, 6, &I_RFIDDolphinSuccess_108x57);
popup_set_context(popup, nfc); popup_set_context(popup, nfc);
popup_set_callback(popup, nfc_scene_nfcv_read_auth_popup_callback); popup_set_callback(popup, nfc_scene_nfcv_unlock_popup_callback);
popup_set_timeout(popup, 1500); popup_set_timeout(popup, 1500);
//popup_enable_timeout(popup); //popup_enable_timeout(popup);
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup); view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
DOLPHIN_DEED(DolphinDeedNfcReadSuccess); DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
} else if(state == NfcSceneNfcVReadStateAlreadyUnlocked) { } else if(state == NfcSceneNfcVUnlockStateAlreadyUnlocked) {
popup_reset(popup); popup_reset(popup);
popup_set_header(popup, "Already\nUnlocked!", 94, 3, AlignCenter, AlignTop); popup_set_header(popup, "Already\nUnlocked!", 94, 3, AlignCenter, AlignTop);
popup_set_icon(popup, 0, 6, &I_RFIDDolphinSuccess_108x57); popup_set_icon(popup, 0, 6, &I_RFIDDolphinSuccess_108x57);
popup_set_context(popup, nfc); popup_set_context(popup, nfc);
popup_set_callback(popup, nfc_scene_nfcv_read_auth_popup_callback); popup_set_callback(popup, nfc_scene_nfcv_unlock_popup_callback);
popup_set_timeout(popup, 1500); popup_set_timeout(popup, 1500);
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup); view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
} else if(state == NfcSceneNfcVReadStateNotSupportedCard) { } else if(state == NfcSceneNfcVUnlockStateNotSupportedCard) {
popup_reset(popup); popup_reset(popup);
popup_set_header(popup, "Wrong Type Of Card!", 64, 3, AlignCenter, AlignTop); popup_set_header(popup, "Wrong Type Of Card!", 64, 3, AlignCenter, AlignTop);
popup_set_text( popup_set_text(
@@ -74,44 +74,44 @@ void nfc_scene_nfcv_read_auth_set_state(Nfc* nfc, NfcSceneNfcVReadState state) {
AlignTop); AlignTop);
popup_set_icon(popup, 73, 20, &I_DolphinCommon_56x48); popup_set_icon(popup, 73, 20, &I_DolphinCommon_56x48);
} }
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneNfcVReadAuth, state); scene_manager_set_scene_state(nfc->scene_manager, NfcSceneNfcVUnlock, state);
} }
} }
void nfc_scene_nfcv_read_auth_on_enter(void* context) { void nfc_scene_nfcv_unlock_on_enter(void* context) {
Nfc* nfc = context; Nfc* nfc = context;
nfc_device_clear(nfc->dev); nfc_device_clear(nfc->dev);
// Setup view // Setup view
nfc_scene_nfcv_read_auth_set_state(nfc, NfcSceneNfcVReadStateDetecting); nfc_scene_nfcv_unlock_set_state(nfc, NfcSceneNfcVUnlockStateDetecting);
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup); view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
// Start worker // Start worker
nfc_worker_start( nfc_worker_start(
nfc->worker, nfc->worker,
NfcWorkerStateNfcVReadAuth, NfcWorkerStateNfcVUnlock,
&nfc->dev->dev_data, &nfc->dev->dev_data,
nfc_scene_nfcv_read_auth_worker_callback, nfc_scene_nfcv_unlock_worker_callback,
nfc); nfc);
nfc_blink_read_start(nfc); nfc_blink_read_start(nfc);
} }
bool nfc_scene_nfcv_read_auth_on_event(void* context, SceneManagerEvent event) { bool nfc_scene_nfcv_unlock_on_event(void* context, SceneManagerEvent event) {
Nfc* nfc = context; Nfc* nfc = context;
bool consumed = false; bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) { if(event.type == SceneManagerEventTypeCustom) {
if(event.event == NfcWorkerEventCardDetected) { if(event.event == NfcWorkerEventCardDetected) {
nfc_scene_nfcv_read_auth_set_state(nfc, NfcSceneNfcVReadStateUnlocked); nfc_scene_nfcv_unlock_set_state(nfc, NfcSceneNfcVUnlockStateUnlocked);
consumed = true; consumed = true;
} else if(event.event == NfcWorkerEventAborted) { } else if(event.event == NfcWorkerEventAborted) {
nfc_scene_nfcv_read_auth_set_state(nfc, NfcSceneNfcVReadStateAlreadyUnlocked); nfc_scene_nfcv_unlock_set_state(nfc, NfcSceneNfcVUnlockStateAlreadyUnlocked);
consumed = true; consumed = true;
} else if(event.event == NfcWorkerEventNoCardDetected) { } else if(event.event == NfcWorkerEventNoCardDetected) {
nfc_scene_nfcv_read_auth_set_state(nfc, NfcSceneNfcVReadStateDetecting); nfc_scene_nfcv_unlock_set_state(nfc, NfcSceneNfcVUnlockStateDetecting);
consumed = true; consumed = true;
} else if(event.event == NfcWorkerEventWrongCardDetected) { } else if(event.event == NfcWorkerEventWrongCardDetected) {
nfc_scene_nfcv_read_auth_set_state(nfc, NfcSceneNfcVReadStateNotSupportedCard); nfc_scene_nfcv_unlock_set_state(nfc, NfcSceneNfcVUnlockStateNotSupportedCard);
} }
} else if(event.type == SceneManagerEventTypeBack) { } else if(event.type == SceneManagerEventTypeBack) {
consumed = scene_manager_search_and_switch_to_previous_scene( consumed = scene_manager_search_and_switch_to_previous_scene(
@@ -120,7 +120,7 @@ bool nfc_scene_nfcv_read_auth_on_event(void* context, SceneManagerEvent event) {
return consumed; return consumed;
} }
void nfc_scene_nfcv_read_auth_on_exit(void* context) { void nfc_scene_nfcv_unlock_on_exit(void* context) {
Nfc* nfc = context; Nfc* nfc = context;
// Stop worker // Stop worker
@@ -129,5 +129,5 @@ void nfc_scene_nfcv_read_auth_on_exit(void* context) {
popup_reset(nfc->popup); popup_reset(nfc->popup);
nfc_blink_stop(nfc); nfc_blink_stop(nfc);
scene_manager_set_scene_state( scene_manager_set_scene_state(
nfc->scene_manager, NfcSceneNfcVReadAuth, NfcSceneNfcVReadStateIdle); nfc->scene_manager, NfcSceneNfcVUnlock, NfcSceneNfcVUnlockStateIdle);
} }

View File

@@ -45,7 +45,7 @@ bool nfc_scene_nfcv_unlock_menu_on_event(void* context, SceneManagerEvent event)
consumed = true; consumed = true;
} else if(event.event == SubmenuIndexNfcVUnlockMenuTonieBox) { } else if(event.event == SubmenuIndexNfcVUnlockMenuTonieBox) {
nfc->dev->dev_data.nfcv_data.auth_method = NfcVAuthMethodTonieBox; nfc->dev->dev_data.nfcv_data.auth_method = NfcVAuthMethodTonieBox;
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVReadAuth); scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVUnlock);
DOLPHIN_DEED(DolphinDeedNfcRead); DOLPHIN_DEED(DolphinDeedNfcRead);
consumed = true; consumed = true;
} }

View File

@@ -109,7 +109,7 @@ int32_t nfc_worker_task(void* context) {
nfc_worker_mf_classic_dict_attack(nfc_worker); nfc_worker_mf_classic_dict_attack(nfc_worker);
} else if(nfc_worker->state == NfcWorkerStateAnalyzeReader) { } else if(nfc_worker->state == NfcWorkerStateAnalyzeReader) {
nfc_worker_analyze_reader(nfc_worker); nfc_worker_analyze_reader(nfc_worker);
} else if(nfc_worker->state == NfcWorkerStateNfcVReadAuth) { } else if(nfc_worker->state == NfcWorkerStateNfcVUnlock) {
nfc_worker_nfcv_unlock(nfc_worker); nfc_worker_nfcv_unlock(nfc_worker);
} }
furi_hal_nfc_sleep(); furi_hal_nfc_sleep();
@@ -133,7 +133,7 @@ void nfc_worker_nfcv_unlock(NfcWorker* nfc_worker) {
furi_hal_nfc_sleep(); furi_hal_nfc_sleep();
while(nfc_worker->state == NfcWorkerStateNfcVReadAuth) { while(nfc_worker->state == NfcWorkerStateNfcVUnlock) {
furi_hal_nfc_exit_sleep(); furi_hal_nfc_exit_sleep();
furi_hal_nfc_ll_txrx_on(); furi_hal_nfc_ll_txrx_on();

View File

@@ -19,7 +19,7 @@ typedef enum {
NfcWorkerStateReadMfUltralightReadAuth, NfcWorkerStateReadMfUltralightReadAuth,
NfcWorkerStateMfClassicDictAttack, NfcWorkerStateMfClassicDictAttack,
NfcWorkerStateAnalyzeReader, NfcWorkerStateAnalyzeReader,
NfcWorkerStateNfcVReadAuth, NfcWorkerStateNfcVUnlock,
// Debug // Debug
NfcWorkerStateEmulateApdu, NfcWorkerStateEmulateApdu,
NfcWorkerStateField, NfcWorkerStateField,