2020-11-12 09:44:35 +00:00
|
|
|
#include "nfc_i.h"
|
2023-02-07 16:33:05 +00:00
|
|
|
#include <furi_hal_nfc.h>
|
2022-10-28 07:18:41 +00:00
|
|
|
#include <dolphin/dolphin.h>
|
2021-07-12 18:56:14 +00:00
|
|
|
|
|
|
|
bool nfc_custom_event_callback(void* context, uint32_t event) {
|
|
|
|
furi_assert(context);
|
2022-04-19 15:23:58 +00:00
|
|
|
Nfc* nfc = context;
|
2021-07-12 18:56:14 +00:00
|
|
|
return scene_manager_handle_custom_event(nfc->scene_manager, event);
|
|
|
|
}
|
|
|
|
|
2021-07-28 14:52:00 +00:00
|
|
|
bool nfc_back_event_callback(void* context) {
|
2021-07-12 18:56:14 +00:00
|
|
|
furi_assert(context);
|
2022-04-19 15:23:58 +00:00
|
|
|
Nfc* nfc = context;
|
2021-07-28 14:52:00 +00:00
|
|
|
return scene_manager_handle_back_event(nfc->scene_manager);
|
2021-07-12 18:56:14 +00:00
|
|
|
}
|
|
|
|
|
2022-08-02 12:54:12 +00:00
|
|
|
static void nfc_rpc_command_callback(RpcAppSystemEvent event, void* context) {
|
2022-07-04 13:09:46 +00:00
|
|
|
furi_assert(context);
|
|
|
|
Nfc* nfc = context;
|
|
|
|
|
2022-08-02 12:54:12 +00:00
|
|
|
furi_assert(nfc->rpc_ctx);
|
2022-07-04 13:09:46 +00:00
|
|
|
|
|
|
|
if(event == RpcAppEventSessionClose) {
|
2022-08-02 12:54:12 +00:00
|
|
|
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventRpcSessionClose);
|
2022-08-11 15:37:23 +00:00
|
|
|
rpc_system_app_set_callback(nfc->rpc_ctx, NULL, NULL);
|
|
|
|
nfc->rpc_ctx = NULL;
|
2022-07-04 13:09:46 +00:00
|
|
|
} else if(event == RpcAppEventAppExit) {
|
|
|
|
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventViewExit);
|
|
|
|
} else if(event == RpcAppEventLoadFile) {
|
2022-08-02 12:54:12 +00:00
|
|
|
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventRpcLoad);
|
|
|
|
} else {
|
|
|
|
rpc_system_app_confirm(nfc->rpc_ctx, event, false);
|
2022-07-04 13:09:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
FL-53: new NFC worker, A/B/F/V poll and display. (#283)
* GUI: view. Flooper-blooper fix compilation error.
* GUI: view and viewdispatcher bones
* GUI: view implementation, view models, view dispatcher
* GUI: view navigation, model refinement. Power: use view, view dispatcher.
* HAL Flash: proper page write. Dolphin: views. Power: views
* Dolphin: transition idle scree to Views
* Dolphin: input events on stats view. Format sources.
* HAL: flash erase. Dolphin: permanent state storage.
* Dolphin: first start welcome. HAL: flash operation status, errata 2.2.9 crutch.
* NFC: rewrite worker
* NFC: add support for B,F,V.
* NFC: replace rfal irq hanlder with realtime thread, more details about cards.
* Bootloader: LSE and RTS shenanigans, LED control, morse code for LSE failure error.
* F4: stop in Error_Handler
* BLE: handle working FUS, but empty radio stack.
* HAL: alive FUS is now sufficient for flash controller access
* Dolphin: update model after state load
* NFC: detect navigation
* RFAL: use osPriorityISR for isr thread
* NFC: emulation
* Bootloader: rollback incorrectly merged rename
* Dolphin: rollback incorrectly merged changes
* RFAL: remove volatile from thread attr
* RFAL: do not call platform ErrorHandler, error codes is enough
* NFC: improved error handling
* Format sources
* NFC: reset detect view model on start
* Format sources
* update codeowners
* NFC: hide last info if no card detected
2021-01-11 12:42:25 +00:00
|
|
|
Nfc* nfc_alloc() {
|
2022-02-18 19:53:46 +00:00
|
|
|
Nfc* nfc = malloc(sizeof(Nfc));
|
2020-10-18 22:09:48 +00:00
|
|
|
|
2021-07-22 06:05:07 +00:00
|
|
|
nfc->worker = nfc_worker_alloc();
|
|
|
|
nfc->view_dispatcher = view_dispatcher_alloc();
|
2021-07-12 18:56:14 +00:00
|
|
|
nfc->scene_manager = scene_manager_alloc(&nfc_scene_handlers, nfc);
|
2021-07-22 06:05:07 +00:00
|
|
|
view_dispatcher_enable_queue(nfc->view_dispatcher);
|
|
|
|
view_dispatcher_set_event_callback_context(nfc->view_dispatcher, nfc);
|
|
|
|
view_dispatcher_set_custom_event_callback(nfc->view_dispatcher, nfc_custom_event_callback);
|
2021-07-28 14:52:00 +00:00
|
|
|
view_dispatcher_set_navigation_event_callback(nfc->view_dispatcher, nfc_back_event_callback);
|
2020-11-16 15:26:34 +00:00
|
|
|
|
2021-11-08 21:55:06 +00:00
|
|
|
// Nfc device
|
|
|
|
nfc->dev = nfc_device_alloc();
|
2022-12-19 19:57:48 +00:00
|
|
|
furi_string_set(nfc->dev->folder, NFC_APP_FOLDER);
|
2021-11-08 21:55:06 +00:00
|
|
|
|
2021-05-06 19:51:20 +00:00
|
|
|
// Open GUI record
|
2022-07-26 12:21:51 +00:00
|
|
|
nfc->gui = furi_record_open(RECORD_GUI);
|
2021-05-06 19:51:20 +00:00
|
|
|
|
2021-06-30 17:43:29 +00:00
|
|
|
// Open Notification record
|
2022-07-26 12:21:51 +00:00
|
|
|
nfc->notifications = furi_record_open(RECORD_NOTIFICATION);
|
2021-06-30 17:43:29 +00:00
|
|
|
|
|
|
|
// Submenu
|
2021-05-06 19:51:20 +00:00
|
|
|
nfc->submenu = submenu_alloc();
|
2021-07-22 06:05:07 +00:00
|
|
|
view_dispatcher_add_view(nfc->view_dispatcher, NfcViewMenu, submenu_get_view(nfc->submenu));
|
2021-06-30 17:43:29 +00:00
|
|
|
|
|
|
|
// Dialog
|
|
|
|
nfc->dialog_ex = dialog_ex_alloc();
|
|
|
|
view_dispatcher_add_view(
|
2021-07-22 06:05:07 +00:00
|
|
|
nfc->view_dispatcher, NfcViewDialogEx, dialog_ex_get_view(nfc->dialog_ex));
|
2021-06-15 14:54:09 +00:00
|
|
|
|
2021-06-30 17:43:29 +00:00
|
|
|
// Popup
|
|
|
|
nfc->popup = popup_alloc();
|
2021-07-22 06:05:07 +00:00
|
|
|
view_dispatcher_add_view(nfc->view_dispatcher, NfcViewPopup, popup_get_view(nfc->popup));
|
2021-06-30 17:43:29 +00:00
|
|
|
|
[FL-1962, FL-2464, FL-2465, FL-2466, FL-2560, FL-2637, FL-2595] Ibutton, Infrared, LfRFID GUI fixes (#1392)
* Ibutton, Infrared, LfRFID GUI fixes
* Loading screens update
Co-authored-by: あく <alleteam@gmail.com>
2022-07-17 07:41:16 +00:00
|
|
|
// Loading
|
|
|
|
nfc->loading = loading_alloc();
|
|
|
|
view_dispatcher_add_view(nfc->view_dispatcher, NfcViewLoading, loading_get_view(nfc->loading));
|
|
|
|
|
2021-06-30 17:43:29 +00:00
|
|
|
// Text Input
|
|
|
|
nfc->text_input = text_input_alloc();
|
|
|
|
view_dispatcher_add_view(
|
2021-07-22 06:05:07 +00:00
|
|
|
nfc->view_dispatcher, NfcViewTextInput, text_input_get_view(nfc->text_input));
|
2021-06-30 17:43:29 +00:00
|
|
|
|
|
|
|
// Byte Input
|
|
|
|
nfc->byte_input = byte_input_alloc();
|
|
|
|
view_dispatcher_add_view(
|
2021-07-22 06:05:07 +00:00
|
|
|
nfc->view_dispatcher, NfcViewByteInput, byte_input_get_view(nfc->byte_input));
|
2021-05-06 19:51:20 +00:00
|
|
|
|
2021-07-08 20:41:34 +00:00
|
|
|
// TextBox
|
|
|
|
nfc->text_box = text_box_alloc();
|
|
|
|
view_dispatcher_add_view(
|
2021-07-22 06:05:07 +00:00
|
|
|
nfc->view_dispatcher, NfcViewTextBox, text_box_get_view(nfc->text_box));
|
2022-10-05 15:15:23 +00:00
|
|
|
nfc->text_box_store = furi_string_alloc();
|
2021-07-08 20:41:34 +00:00
|
|
|
|
2021-07-22 06:05:07 +00:00
|
|
|
// Custom Widget
|
2021-07-23 13:09:34 +00:00
|
|
|
nfc->widget = widget_alloc();
|
|
|
|
view_dispatcher_add_view(nfc->view_dispatcher, NfcViewWidget, widget_get_view(nfc->widget));
|
2021-05-06 19:51:20 +00:00
|
|
|
|
2022-07-26 15:30:49 +00:00
|
|
|
// Mifare Classic Dict Attack
|
2022-03-23 22:14:34 +00:00
|
|
|
nfc->dict_attack = dict_attack_alloc();
|
|
|
|
view_dispatcher_add_view(
|
|
|
|
nfc->view_dispatcher, NfcViewDictAttack, dict_attack_get_view(nfc->dict_attack));
|
|
|
|
|
2022-09-03 12:25:36 +00:00
|
|
|
// Detect Reader
|
|
|
|
nfc->detect_reader = detect_reader_alloc();
|
|
|
|
view_dispatcher_add_view(
|
|
|
|
nfc->view_dispatcher, NfcViewDetectReader, detect_reader_get_view(nfc->detect_reader));
|
|
|
|
|
2022-07-04 11:16:59 +00:00
|
|
|
// Generator
|
|
|
|
nfc->generator = NULL;
|
|
|
|
|
FL-53: new NFC worker, A/B/F/V poll and display. (#283)
* GUI: view. Flooper-blooper fix compilation error.
* GUI: view and viewdispatcher bones
* GUI: view implementation, view models, view dispatcher
* GUI: view navigation, model refinement. Power: use view, view dispatcher.
* HAL Flash: proper page write. Dolphin: views. Power: views
* Dolphin: transition idle scree to Views
* Dolphin: input events on stats view. Format sources.
* HAL: flash erase. Dolphin: permanent state storage.
* Dolphin: first start welcome. HAL: flash operation status, errata 2.2.9 crutch.
* NFC: rewrite worker
* NFC: add support for B,F,V.
* NFC: replace rfal irq hanlder with realtime thread, more details about cards.
* Bootloader: LSE and RTS shenanigans, LED control, morse code for LSE failure error.
* F4: stop in Error_Handler
* BLE: handle working FUS, but empty radio stack.
* HAL: alive FUS is now sufficient for flash controller access
* Dolphin: update model after state load
* NFC: detect navigation
* RFAL: use osPriorityISR for isr thread
* NFC: emulation
* Bootloader: rollback incorrectly merged rename
* Dolphin: rollback incorrectly merged changes
* RFAL: remove volatile from thread attr
* RFAL: do not call platform ErrorHandler, error codes is enough
* NFC: improved error handling
* Format sources
* NFC: reset detect view model on start
* Format sources
* update codeowners
* NFC: hide last info if no card detected
2021-01-11 12:42:25 +00:00
|
|
|
return nfc;
|
2020-11-12 09:44:35 +00:00
|
|
|
}
|
|
|
|
|
2021-05-06 19:51:20 +00:00
|
|
|
void nfc_free(Nfc* nfc) {
|
2021-06-24 08:46:37 +00:00
|
|
|
furi_assert(nfc);
|
2020-11-12 09:44:35 +00:00
|
|
|
|
2022-08-02 12:54:12 +00:00
|
|
|
if(nfc->rpc_state == NfcRpcStateEmulating) {
|
|
|
|
// Stop worker
|
|
|
|
nfc_worker_stop(nfc->worker);
|
|
|
|
} else if(nfc->rpc_state == NfcRpcStateEmulated) {
|
|
|
|
// Stop worker
|
|
|
|
nfc_worker_stop(nfc->worker);
|
|
|
|
// Save data in shadow file
|
2022-11-10 16:20:35 +00:00
|
|
|
if(furi_string_size(nfc->dev->load_path)) {
|
|
|
|
nfc_device_save_shadow(nfc->dev, furi_string_get_cstr(nfc->dev->load_path));
|
|
|
|
}
|
2022-08-02 12:54:12 +00:00
|
|
|
}
|
|
|
|
if(nfc->rpc_ctx) {
|
|
|
|
rpc_system_app_send_exited(nfc->rpc_ctx);
|
|
|
|
rpc_system_app_set_callback(nfc->rpc_ctx, NULL, NULL);
|
|
|
|
nfc->rpc_ctx = NULL;
|
|
|
|
}
|
|
|
|
|
2021-11-08 21:55:06 +00:00
|
|
|
// Nfc device
|
|
|
|
nfc_device_free(nfc->dev);
|
|
|
|
|
2021-06-24 08:46:37 +00:00
|
|
|
// Submenu
|
2021-07-22 06:05:07 +00:00
|
|
|
view_dispatcher_remove_view(nfc->view_dispatcher, NfcViewMenu);
|
2021-05-06 19:51:20 +00:00
|
|
|
submenu_free(nfc->submenu);
|
2020-10-18 22:09:48 +00:00
|
|
|
|
2021-06-30 17:43:29 +00:00
|
|
|
// DialogEx
|
2021-07-22 06:05:07 +00:00
|
|
|
view_dispatcher_remove_view(nfc->view_dispatcher, NfcViewDialogEx);
|
2021-06-30 17:43:29 +00:00
|
|
|
dialog_ex_free(nfc->dialog_ex);
|
|
|
|
|
|
|
|
// Popup
|
2021-07-22 06:05:07 +00:00
|
|
|
view_dispatcher_remove_view(nfc->view_dispatcher, NfcViewPopup);
|
2021-06-30 17:43:29 +00:00
|
|
|
popup_free(nfc->popup);
|
|
|
|
|
[FL-1962, FL-2464, FL-2465, FL-2466, FL-2560, FL-2637, FL-2595] Ibutton, Infrared, LfRFID GUI fixes (#1392)
* Ibutton, Infrared, LfRFID GUI fixes
* Loading screens update
Co-authored-by: あく <alleteam@gmail.com>
2022-07-17 07:41:16 +00:00
|
|
|
// Loading
|
|
|
|
view_dispatcher_remove_view(nfc->view_dispatcher, NfcViewLoading);
|
|
|
|
loading_free(nfc->loading);
|
|
|
|
|
2021-06-30 17:43:29 +00:00
|
|
|
// TextInput
|
2021-07-22 06:05:07 +00:00
|
|
|
view_dispatcher_remove_view(nfc->view_dispatcher, NfcViewTextInput);
|
2021-06-30 17:43:29 +00:00
|
|
|
text_input_free(nfc->text_input);
|
|
|
|
|
|
|
|
// ByteInput
|
2021-07-22 06:05:07 +00:00
|
|
|
view_dispatcher_remove_view(nfc->view_dispatcher, NfcViewByteInput);
|
2021-06-30 17:43:29 +00:00
|
|
|
byte_input_free(nfc->byte_input);
|
|
|
|
|
2021-07-08 20:41:34 +00:00
|
|
|
// TextBox
|
2021-07-22 06:05:07 +00:00
|
|
|
view_dispatcher_remove_view(nfc->view_dispatcher, NfcViewTextBox);
|
2021-07-08 20:41:34 +00:00
|
|
|
text_box_free(nfc->text_box);
|
2022-10-05 15:15:23 +00:00
|
|
|
furi_string_free(nfc->text_box_store);
|
2021-07-08 20:41:34 +00:00
|
|
|
|
2021-07-22 06:05:07 +00:00
|
|
|
// Custom Widget
|
|
|
|
view_dispatcher_remove_view(nfc->view_dispatcher, NfcViewWidget);
|
2021-07-23 13:09:34 +00:00
|
|
|
widget_free(nfc->widget);
|
2021-05-06 19:51:20 +00:00
|
|
|
|
2022-07-26 15:30:49 +00:00
|
|
|
// Mifare Classic Dict Attack
|
2022-03-23 22:14:34 +00:00
|
|
|
view_dispatcher_remove_view(nfc->view_dispatcher, NfcViewDictAttack);
|
|
|
|
dict_attack_free(nfc->dict_attack);
|
|
|
|
|
2022-09-03 12:25:36 +00:00
|
|
|
// Detect Reader
|
|
|
|
view_dispatcher_remove_view(nfc->view_dispatcher, NfcViewDetectReader);
|
|
|
|
detect_reader_free(nfc->detect_reader);
|
|
|
|
|
2021-06-24 08:46:37 +00:00
|
|
|
// Worker
|
2021-07-22 06:05:07 +00:00
|
|
|
nfc_worker_stop(nfc->worker);
|
|
|
|
nfc_worker_free(nfc->worker);
|
2021-05-06 19:51:20 +00:00
|
|
|
|
2021-06-30 17:43:29 +00:00
|
|
|
// View Dispatcher
|
2021-07-22 06:05:07 +00:00
|
|
|
view_dispatcher_free(nfc->view_dispatcher);
|
2021-05-06 19:51:20 +00:00
|
|
|
|
2021-07-12 18:56:14 +00:00
|
|
|
// Scene Manager
|
|
|
|
scene_manager_free(nfc->scene_manager);
|
|
|
|
|
2021-06-24 08:46:37 +00:00
|
|
|
// GUI
|
2022-07-26 12:21:51 +00:00
|
|
|
furi_record_close(RECORD_GUI);
|
2021-05-06 19:51:20 +00:00
|
|
|
nfc->gui = NULL;
|
|
|
|
|
2021-06-30 17:43:29 +00:00
|
|
|
// Notifications
|
2022-07-26 12:21:51 +00:00
|
|
|
furi_record_close(RECORD_NOTIFICATION);
|
2021-06-30 17:43:29 +00:00
|
|
|
nfc->notifications = NULL;
|
|
|
|
|
2021-05-06 19:51:20 +00:00
|
|
|
free(nfc);
|
2020-10-18 22:09:48 +00:00
|
|
|
}
|
|
|
|
|
2021-08-07 16:54:42 +00:00
|
|
|
void nfc_text_store_set(Nfc* nfc, const char* text, ...) {
|
|
|
|
va_list args;
|
|
|
|
va_start(args, text);
|
|
|
|
|
|
|
|
vsnprintf(nfc->text_store, sizeof(nfc->text_store), text, args);
|
|
|
|
|
|
|
|
va_end(args);
|
|
|
|
}
|
|
|
|
|
|
|
|
void nfc_text_store_clear(Nfc* nfc) {
|
|
|
|
memset(nfc->text_store, 0, sizeof(nfc->text_store));
|
|
|
|
}
|
|
|
|
|
2022-09-15 15:49:10 +00:00
|
|
|
void nfc_blink_read_start(Nfc* nfc) {
|
|
|
|
notification_message(nfc->notifications, &sequence_blink_start_cyan);
|
|
|
|
}
|
|
|
|
|
|
|
|
void nfc_blink_emulate_start(Nfc* nfc) {
|
|
|
|
notification_message(nfc->notifications, &sequence_blink_start_magenta);
|
|
|
|
}
|
|
|
|
|
|
|
|
void nfc_blink_detect_start(Nfc* nfc) {
|
|
|
|
notification_message(nfc->notifications, &sequence_blink_start_yellow);
|
2022-06-13 01:08:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void nfc_blink_stop(Nfc* nfc) {
|
|
|
|
notification_message(nfc->notifications, &sequence_blink_stop);
|
|
|
|
}
|
|
|
|
|
2022-11-10 16:20:35 +00:00
|
|
|
bool nfc_save_file(Nfc* nfc) {
|
|
|
|
furi_string_printf(
|
|
|
|
nfc->dev->load_path, "%s/%s%s", NFC_APP_FOLDER, nfc->dev->dev_name, NFC_APP_EXTENSION);
|
|
|
|
bool file_saved = nfc_device_save(nfc->dev, furi_string_get_cstr(nfc->dev->load_path));
|
|
|
|
return file_saved;
|
|
|
|
}
|
|
|
|
|
[FL-1962, FL-2464, FL-2465, FL-2466, FL-2560, FL-2637, FL-2595] Ibutton, Infrared, LfRFID GUI fixes (#1392)
* Ibutton, Infrared, LfRFID GUI fixes
* Loading screens update
Co-authored-by: あく <alleteam@gmail.com>
2022-07-17 07:41:16 +00:00
|
|
|
void nfc_show_loading_popup(void* context, bool show) {
|
|
|
|
Nfc* nfc = context;
|
|
|
|
TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME);
|
|
|
|
|
|
|
|
if(show) {
|
|
|
|
// Raise timer priority so that animations can play
|
|
|
|
vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1);
|
|
|
|
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewLoading);
|
|
|
|
} else {
|
|
|
|
// Restore default timer priority
|
|
|
|
vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-19 12:46:56 +00:00
|
|
|
static bool nfc_is_hal_ready() {
|
|
|
|
if(!furi_hal_nfc_is_init()) {
|
|
|
|
// No connection to the chip, show an error screen
|
|
|
|
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
|
|
|
|
DialogMessage* message = dialog_message_alloc();
|
|
|
|
dialog_message_set_text(
|
|
|
|
message,
|
|
|
|
"Error!\nNFC chip failed to start\n\n\nSend a photo of this to:\nsupport@flipperzero.one",
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
AlignLeft,
|
|
|
|
AlignTop);
|
|
|
|
dialog_message_show(dialogs, message);
|
|
|
|
dialog_message_free(message);
|
|
|
|
furi_record_close(RECORD_DIALOGS);
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-07 16:54:42 +00:00
|
|
|
int32_t nfc_app(void* p) {
|
2022-09-19 12:46:56 +00:00
|
|
|
if(!nfc_is_hal_ready()) return 0;
|
|
|
|
|
2020-10-18 22:55:41 +00:00
|
|
|
Nfc* nfc = nfc_alloc();
|
2021-08-16 21:45:04 +00:00
|
|
|
char* args = p;
|
2020-10-18 22:09:48 +00:00
|
|
|
|
2021-07-15 21:39:21 +00:00
|
|
|
// Check argument and run corresponding scene
|
2022-08-03 15:47:10 +00:00
|
|
|
if(args && strlen(args)) {
|
[FL-1962, FL-2464, FL-2465, FL-2466, FL-2560, FL-2637, FL-2595] Ibutton, Infrared, LfRFID GUI fixes (#1392)
* Ibutton, Infrared, LfRFID GUI fixes
* Loading screens update
Co-authored-by: あく <alleteam@gmail.com>
2022-07-17 07:41:16 +00:00
|
|
|
nfc_device_set_loading_callback(nfc->dev, nfc_show_loading_popup, nfc);
|
2022-07-04 13:09:46 +00:00
|
|
|
uint32_t rpc_ctx = 0;
|
|
|
|
if(sscanf(p, "RPC %lX", &rpc_ctx) == 1) {
|
|
|
|
nfc->rpc_ctx = (void*)rpc_ctx;
|
|
|
|
rpc_system_app_set_callback(nfc->rpc_ctx, nfc_rpc_command_callback, nfc);
|
2022-07-25 14:16:45 +00:00
|
|
|
rpc_system_app_send_started(nfc->rpc_ctx);
|
|
|
|
view_dispatcher_attach_to_gui(
|
|
|
|
nfc->view_dispatcher, nfc->gui, ViewDispatcherTypeDesktop);
|
2022-07-04 13:09:46 +00:00
|
|
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneRpc);
|
2022-07-25 14:16:45 +00:00
|
|
|
} else {
|
|
|
|
view_dispatcher_attach_to_gui(
|
|
|
|
nfc->view_dispatcher, nfc->gui, ViewDispatcherTypeFullscreen);
|
|
|
|
if(nfc_device_load(nfc->dev, p, true)) {
|
|
|
|
if(nfc->dev->format == NfcDeviceSaveFormatMifareUl) {
|
2022-07-26 15:30:49 +00:00
|
|
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightEmulate);
|
2023-06-09 11:02:47 +00:00
|
|
|
dolphin_deed(DolphinDeedNfcEmulate);
|
2022-07-25 14:16:45 +00:00
|
|
|
} else if(nfc->dev->format == NfcDeviceSaveFormatMifareClassic) {
|
2022-07-26 15:30:49 +00:00
|
|
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicEmulate);
|
2023-06-09 11:02:47 +00:00
|
|
|
dolphin_deed(DolphinDeedNfcEmulate);
|
2023-05-17 16:45:30 +00:00
|
|
|
} else if(nfc->dev->format == NfcDeviceSaveFormatNfcV) {
|
|
|
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVEmulate);
|
|
|
|
DOLPHIN_DEED(DolphinDeedNfcEmulate);
|
2022-07-25 14:16:45 +00:00
|
|
|
} else {
|
|
|
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneEmulateUid);
|
2023-06-09 11:02:47 +00:00
|
|
|
dolphin_deed(DolphinDeedNfcEmulate);
|
2022-07-25 14:16:45 +00:00
|
|
|
}
|
2022-04-20 14:08:36 +00:00
|
|
|
} else {
|
2022-07-25 14:16:45 +00:00
|
|
|
// Exit app
|
|
|
|
view_dispatcher_stop(nfc->view_dispatcher);
|
2022-04-20 14:08:36 +00:00
|
|
|
}
|
2021-11-05 12:38:59 +00:00
|
|
|
}
|
[FL-1962, FL-2464, FL-2465, FL-2466, FL-2560, FL-2637, FL-2595] Ibutton, Infrared, LfRFID GUI fixes (#1392)
* Ibutton, Infrared, LfRFID GUI fixes
* Loading screens update
Co-authored-by: あく <alleteam@gmail.com>
2022-07-17 07:41:16 +00:00
|
|
|
nfc_device_set_loading_callback(nfc->dev, NULL, nfc);
|
2021-07-15 21:39:21 +00:00
|
|
|
} else {
|
2022-07-25 14:16:45 +00:00
|
|
|
view_dispatcher_attach_to_gui(
|
|
|
|
nfc->view_dispatcher, nfc->gui, ViewDispatcherTypeFullscreen);
|
2021-07-15 21:39:21 +00:00
|
|
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneStart);
|
|
|
|
}
|
|
|
|
|
2021-07-22 06:05:07 +00:00
|
|
|
view_dispatcher_run(nfc->view_dispatcher);
|
2021-06-15 14:54:09 +00:00
|
|
|
|
2021-06-24 08:46:37 +00:00
|
|
|
nfc_free(nfc);
|
2021-02-12 17:24:34 +00:00
|
|
|
|
|
|
|
return 0;
|
2020-10-18 22:09:48 +00:00
|
|
|
}
|