rename NfcV emulate scene to match other NfcV names

This commit is contained in:
g3gg0.de
2022-12-29 22:02:02 +01:00
parent 9e9f445cb8
commit 21e7e7e89b
6 changed files with 32 additions and 33 deletions

View File

@@ -291,7 +291,7 @@ int32_t nfc_app(void* p) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicEmulate);
DOLPHIN_DEED(DolphinDeedNfcEmulate);
} else if(nfc->dev->format == NfcDeviceSaveFormatNfcV) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneEmulateNfcV);
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVEmulate);
DOLPHIN_DEED(DolphinDeedNfcEmulate);
} else if(nfc->dev->format == NfcDeviceSaveFormatBankCard) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneDeviceInfo);

View File

@@ -18,7 +18,7 @@ ADD_SCENE(nfc, nfcv_menu, NfcVMenu)
ADD_SCENE(nfc, nfcv_unlock_menu, NfcVUnlockMenu)
ADD_SCENE(nfc, nfcv_key_input, NfcVKeyInput)
ADD_SCENE(nfc, nfcv_unlock, NfcVUnlock)
ADD_SCENE(nfc, emulate_nfcv, EmulateNfcV)
ADD_SCENE(nfc, nfcv_emulate, NfcVEmulate)
ADD_SCENE(nfc, mf_ultralight_read_success, MfUltralightReadSuccess)
ADD_SCENE(nfc, mf_ultralight_data, MfUltralightData)
ADD_SCENE(nfc, mf_ultralight_menu, MfUltralightMenu)

View File

@@ -3,11 +3,11 @@
#define NFC_SCENE_EMULATE_NFCV_LOG_SIZE_MAX (100)
enum {
NfcSceneEmulateNfcVStateWidget,
NfcSceneEmulateNfcVStateTextBox,
NfcSceneNfcVEmulateStateWidget,
NfcSceneNfcVEmulateStateTextBox,
};
bool nfc_emulate_nfcv_worker_callback(NfcWorkerEvent event, void* context) {
bool nfc_scene_nfcv_emulate_worker_callback(NfcWorkerEvent event, void* context) {
UNUSED(event);
furi_assert(context);
Nfc* nfc = context;
@@ -15,7 +15,7 @@ bool nfc_emulate_nfcv_worker_callback(NfcWorkerEvent event, void* context) {
return true;
}
void nfc_scene_emulate_nfcv_widget_callback(GuiButtonType result, InputType type, void* context) {
void nfc_scene_nfcv_emulate_widget_callback(GuiButtonType result, InputType type, void* context) {
furi_assert(context);
Nfc* nfc = context;
if(type == InputTypeShort) {
@@ -23,14 +23,14 @@ void nfc_scene_emulate_nfcv_widget_callback(GuiButtonType result, InputType type
}
}
void nfc_emulate_nfcv_textbox_callback(void* context) {
void nfc_scene_nfcv_emulate_textbox_callback(void* context) {
furi_assert(context);
Nfc* nfc = context;
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventViewExit);
}
// Add widget with device name or inform that data received
static void nfc_scene_emulate_nfcv_widget_config(Nfc* nfc, bool data_received) {
static void nfc_scene_nfcv_emulate_widget_config(Nfc* nfc, bool data_received) {
FuriHalNfcDevData* data = &nfc->dev->dev_data.nfc_data;
Widget* widget = nfc->widget;
widget_reset(widget);
@@ -53,15 +53,15 @@ static void nfc_scene_emulate_nfcv_widget_config(Nfc* nfc, bool data_received) {
furi_string_free(info_str);
if(data_received) {
widget_add_button_element(
widget, GuiButtonTypeCenter, "Log", nfc_scene_emulate_nfcv_widget_callback, nfc);
widget, GuiButtonTypeCenter, "Log", nfc_scene_nfcv_emulate_widget_callback, nfc);
}
}
void nfc_scene_emulate_nfcv_on_enter(void* context) {
void nfc_scene_nfcv_emulate_on_enter(void* context) {
Nfc* nfc = context;
// Setup Widget
nfc_scene_emulate_nfcv_widget_config(nfc, false);
nfc_scene_nfcv_emulate_widget_config(nfc, false);
// Setup TextBox
TextBox* text_box = nfc->text_box;
text_box_set_font(text_box, TextBoxFontHex);
@@ -70,7 +70,7 @@ void nfc_scene_emulate_nfcv_on_enter(void* context) {
// Set Widget state and view
scene_manager_set_scene_state(
nfc->scene_manager, NfcSceneEmulateNfcV, NfcSceneEmulateNfcVStateWidget);
nfc->scene_manager, NfcSceneNfcVEmulate, NfcSceneNfcVEmulateStateWidget);
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget);
// Start worker
memset(&nfc->dev->dev_data.reader_data, 0, sizeof(NfcReaderRequestData));
@@ -78,23 +78,23 @@ void nfc_scene_emulate_nfcv_on_enter(void* context) {
nfc->worker,
NfcWorkerStateNfcVEmulate,
&nfc->dev->dev_data,
nfc_emulate_nfcv_worker_callback,
nfc_scene_nfcv_emulate_worker_callback,
nfc);
nfc_blink_emulate_start(nfc);
}
bool nfc_scene_emulate_nfcv_on_event(void* context, SceneManagerEvent event) {
bool nfc_scene_nfcv_emulate_on_event(void* context, SceneManagerEvent event) {
Nfc* nfc = context;
NfcVData* nfcv_data = &nfc->dev->dev_data.nfcv_data;
uint32_t state = scene_manager_get_scene_state(nfc->scene_manager, NfcSceneEmulateNfcV);
uint32_t state = scene_manager_get_scene_state(nfc->scene_manager, NfcSceneNfcVEmulate);
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == NfcCustomEventWorkerExit) {
// Add data button to widget if data is received for the first time
if(!furi_string_size(nfc->text_box_store)) {
nfc_scene_emulate_nfcv_widget_config(nfc, true);
nfc_scene_nfcv_emulate_widget_config(nfc, true);
}
if(strlen(nfcv_data->last_command) > 0) {
/* use the last n bytes from the log so there's enough space for the new log entry */
@@ -111,22 +111,22 @@ bool nfc_scene_emulate_nfcv_on_event(void* context, SceneManagerEvent event) {
strcpy(nfcv_data->last_command, "");
}
consumed = true;
} else if(event.event == GuiButtonTypeCenter && state == NfcSceneEmulateNfcVStateWidget) {
} else if(event.event == GuiButtonTypeCenter && state == NfcSceneNfcVEmulateStateWidget) {
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewTextBox);
scene_manager_set_scene_state(
nfc->scene_manager, NfcSceneEmulateNfcV, NfcSceneEmulateNfcVStateTextBox);
nfc->scene_manager, NfcSceneNfcVEmulate, NfcSceneNfcVEmulateStateTextBox);
consumed = true;
} else if(event.event == NfcCustomEventViewExit && state == NfcSceneEmulateNfcVStateTextBox) {
} else if(event.event == NfcCustomEventViewExit && state == NfcSceneNfcVEmulateStateTextBox) {
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget);
scene_manager_set_scene_state(
nfc->scene_manager, NfcSceneEmulateNfcV, NfcSceneEmulateNfcVStateWidget);
nfc->scene_manager, NfcSceneNfcVEmulate, NfcSceneNfcVEmulateStateWidget);
consumed = true;
}
} else if(event.type == SceneManagerEventTypeBack) {
if(state == NfcSceneEmulateNfcVStateTextBox) {
if(state == NfcSceneNfcVEmulateStateTextBox) {
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget);
scene_manager_set_scene_state(
nfc->scene_manager, NfcSceneEmulateNfcV, NfcSceneEmulateNfcVStateWidget);
nfc->scene_manager, NfcSceneNfcVEmulate, NfcSceneNfcVEmulateStateWidget);
consumed = true;
}
}
@@ -134,7 +134,7 @@ bool nfc_scene_emulate_nfcv_on_event(void* context, SceneManagerEvent event) {
return consumed;
}
void nfc_scene_emulate_nfcv_on_exit(void* context) {
void nfc_scene_nfcv_emulate_on_exit(void* context) {
Nfc* nfc = context;
// Stop worker

View File

@@ -16,9 +16,9 @@ void nfc_scene_nfcv_menu_on_enter(void* context) {
Nfc* nfc = context;
Submenu* submenu = nfc->submenu;
submenu_add_item(submenu, "Save", SubmenuIndexSave, nfc_scene_nfcv_menu_submenu_callback, nfc);
submenu_add_item(
submenu, "Emulate", SubmenuIndexEmulate, nfc_scene_nfcv_menu_submenu_callback, nfc);
submenu_add_item(submenu, "Save", SubmenuIndexSave, nfc_scene_nfcv_menu_submenu_callback, nfc);
submenu_set_selected_item(
nfc->submenu, scene_manager_get_scene_state(nfc->scene_manager, NfcSceneNfcVMenu));
@@ -38,7 +38,7 @@ bool nfc_scene_nfcv_menu_on_event(void* context, SceneManagerEvent event) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveName);
consumed = true;
} else if(event.event == SubmenuIndexEmulate) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneEmulateNfcV);
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVEmulate);
if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetType)) {
DOLPHIN_DEED(DolphinDeedNfcAddEmulate);
} else {

View File

@@ -42,10 +42,10 @@ void nfc_scene_nfcv_unlock_set_state(Nfc* nfc, NfcSceneNfcVUnlockState state) {
popup_reset(popup);
if(nfc_worker_get_state(nfc->worker) == NfcWorkerStateNfcVUnlockAndSave) {
nfc_text_store_set(
nfc,
"%s/SLIX_%02X%02X%02X%02X%02X%02X%02X%02X%s",
NFC_APP_FOLDER,
snprintf(
nfc->dev->dev_name,
sizeof(nfc->dev->dev_name),
"SLIX_%02X%02X%02X%02X%02X%02X%02X%02X",
nfc_data->uid[0],
nfc_data->uid[1],
nfc_data->uid[2],
@@ -53,12 +53,11 @@ void nfc_scene_nfcv_unlock_set_state(Nfc* nfc, NfcSceneNfcVUnlockState state) {
nfc_data->uid[4],
nfc_data->uid[5],
nfc_data->uid[6],
nfc_data->uid[7],
NFC_APP_EXTENSION);
nfc_data->uid[7]);
nfc->dev->format = NfcDeviceSaveFormatNfcV;
if(nfc_device_save(nfc->dev, nfc->text_store)) {
if(nfc_save_file(nfc)) {
popup_set_header(popup, "Successfully\nsaved", 94, 3, AlignCenter, AlignTop);
} else {
popup_set_header(

View File

@@ -118,7 +118,7 @@ bool nfc_scene_saved_menu_on_event(void* context, SceneManagerEvent event) {
} else if(nfc->dev->format == NfcDeviceSaveFormatMifareClassic) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicEmulate);
} else if(nfc->dev->format == NfcDeviceSaveFormatNfcV) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneEmulateNfcV);
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVEmulate);
} else {
scene_manager_next_scene(nfc->scene_manager, NfcSceneEmulateUid);
}