mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-24 05:48:08 +03:00
c186d2b0cc
* added support for ISO15693 (NfcV) emulation, added support for reading SLIX tags * SLIX: fixed crash situation when an invalid password was requested * ISO15693: show emulate menu when opening file * rename NfcV emulate scene to match other NfcV names * optimize allocation size for signals * ISO15693: further optimizations of allocation and free code * ISO15693: reduce latency on state machine reset * respond with block security status when option flag is set * increased maximum memory size to match standard added security status handling/load/save added SELECT/QUIET handling more fine grained allocation routines and checks fix memset sizes * added "Listen NfcV Reader" to sniff traffic from reader to card * added correct description to delete menu * also added DSFID/AFI handling and locking * increase sniff log size * scale NfcV frequency a bit, add echo mode, fix signal level at the end * use symbolic modulated/unmodulated GPIO levels * honor AFI field, decrease verbosity and removed debug code * refactor defines for less namespace pollution by using NFCV_ prefixes * correct an oversight that original cards return an generic error when addressing outside block range * use inverse modulation, increasing readable range significantly * rework and better document nfc chip initialization * nfcv code review fixes * Disable accidentally left on signal debug gpio output * Improve NFCV Read/Info GUIs. Authored by @xMasterX, committed by @nvx * Fix crash that occurs when you exit from NFCV emulation and start it again. Authored by @xMasterX, committed by @nvx * Remove delay from emulation loop. This improves compatibility when the reader is Android. * Lib: digital signal debug output pin info Co-authored-by: Tiernan Messmer <tiernan.messmer@gmail.com> Co-authored-by: MX <10697207+xMasterX@users.noreply.github.com> Co-authored-by: gornekich <n.gorbadey@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
95 lines
3.1 KiB
C
95 lines
3.1 KiB
C
#include "../nfc_i.h"
|
|
|
|
void nfc_scene_nfcv_read_success_widget_callback(
|
|
GuiButtonType result,
|
|
InputType type,
|
|
void* context) {
|
|
furi_assert(context);
|
|
Nfc* nfc = context;
|
|
|
|
if(type == InputTypeShort) {
|
|
view_dispatcher_send_custom_event(nfc->view_dispatcher, result);
|
|
}
|
|
}
|
|
|
|
void nfc_scene_nfcv_read_success_on_enter(void* context) {
|
|
Nfc* nfc = context;
|
|
NfcDeviceData* dev_data = &nfc->dev->dev_data;
|
|
FuriHalNfcDevData* nfc_data = &nfc->dev->dev_data.nfc_data;
|
|
NfcVData* nfcv_data = &nfc->dev->dev_data.nfcv_data;
|
|
// Setup view
|
|
Widget* widget = nfc->widget;
|
|
widget_add_button_element(
|
|
widget, GuiButtonTypeLeft, "Retry", nfc_scene_nfcv_read_success_widget_callback, nfc);
|
|
widget_add_button_element(
|
|
widget, GuiButtonTypeRight, "More", nfc_scene_nfcv_read_success_widget_callback, nfc);
|
|
|
|
FuriString* temp_str = furi_string_alloc();
|
|
|
|
switch(dev_data->nfcv_data.sub_type) {
|
|
case NfcVTypePlain:
|
|
furi_string_cat_printf(temp_str, "\e#ISO15693\n");
|
|
break;
|
|
case NfcVTypeSlix:
|
|
furi_string_cat_printf(temp_str, "\e#ISO15693 SLIX\n");
|
|
break;
|
|
case NfcVTypeSlixS:
|
|
furi_string_cat_printf(temp_str, "\e#ISO15693 SLIX-S\n");
|
|
break;
|
|
case NfcVTypeSlixL:
|
|
furi_string_cat_printf(temp_str, "\e#ISO15693 SLIX-L\n");
|
|
break;
|
|
case NfcVTypeSlix2:
|
|
furi_string_cat_printf(temp_str, "\e#ISO15693 SLIX2\n");
|
|
break;
|
|
default:
|
|
furi_string_cat_printf(temp_str, "\e#ISO15693 (unknown)\n");
|
|
break;
|
|
}
|
|
furi_string_cat_printf(temp_str, "UID:");
|
|
for(size_t i = 0; i < nfc_data->uid_len; i++) {
|
|
furi_string_cat_printf(temp_str, " %02X", nfc_data->uid[i]);
|
|
}
|
|
furi_string_cat_printf(temp_str, "\n");
|
|
furi_string_cat_printf(temp_str, "Blocks: %02X\n", nfcv_data->block_num);
|
|
furi_string_cat_printf(temp_str, "Blocksize: %02X\n", nfcv_data->block_size);
|
|
|
|
widget_add_text_scroll_element(widget, 0, 0, 128, 52, furi_string_get_cstr(temp_str));
|
|
furi_string_free(temp_str);
|
|
|
|
notification_message_block(nfc->notifications, &sequence_set_green_255);
|
|
|
|
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget);
|
|
}
|
|
|
|
bool nfc_scene_nfcv_read_success_on_event(void* context, SceneManagerEvent event) {
|
|
Nfc* nfc = context;
|
|
bool consumed = false;
|
|
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
|
if(event.event == GuiButtonTypeLeft) {
|
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneRetryConfirm);
|
|
consumed = true;
|
|
} else if(event.event == GuiButtonTypeRight) {
|
|
// Clear device name
|
|
nfc_device_set_name(nfc->dev, "");
|
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcVMenu);
|
|
consumed = true;
|
|
}
|
|
} else if(event.type == SceneManagerEventTypeBack) {
|
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneExitConfirm);
|
|
consumed = true;
|
|
}
|
|
|
|
return consumed;
|
|
}
|
|
|
|
void nfc_scene_nfcv_read_success_on_exit(void* context) {
|
|
Nfc* nfc = context;
|
|
|
|
notification_message_block(nfc->notifications, &sequence_reset_green);
|
|
|
|
// Clear view
|
|
widget_reset(nfc->widget);
|
|
}
|