 c186d2b0cc
			
		
	
	
		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>
		
			
				
	
	
		
			94 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			94 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| #include "../nfc_i.h"
 | |
| 
 | |
| void nfc_scene_rpc_on_enter(void* context) {
 | |
|     Nfc* nfc = context;
 | |
|     Popup* popup = nfc->popup;
 | |
| 
 | |
|     popup_set_header(popup, "NFC", 89, 42, AlignCenter, AlignBottom);
 | |
|     popup_set_text(popup, "RPC mode", 89, 44, AlignCenter, AlignTop);
 | |
| 
 | |
|     popup_set_icon(popup, 0, 12, &I_NFC_dolphin_emulation_47x61);
 | |
| 
 | |
|     view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
 | |
| 
 | |
|     notification_message(nfc->notifications, &sequence_display_backlight_on);
 | |
| }
 | |
| 
 | |
| static bool nfc_scene_rpc_emulate_callback(NfcWorkerEvent event, void* context) {
 | |
|     UNUSED(event);
 | |
|     Nfc* nfc = context;
 | |
| 
 | |
|     nfc->rpc_state = NfcRpcStateEmulated;
 | |
|     return true;
 | |
| }
 | |
| 
 | |
| bool nfc_scene_rpc_on_event(void* context, SceneManagerEvent event) {
 | |
|     Nfc* nfc = context;
 | |
|     Popup* popup = nfc->popup;
 | |
|     bool consumed = false;
 | |
| 
 | |
|     if(event.type == SceneManagerEventTypeCustom) {
 | |
|         consumed = true;
 | |
|         if(event.event == NfcCustomEventViewExit) {
 | |
|             rpc_system_app_confirm(nfc->rpc_ctx, RpcAppEventAppExit, true);
 | |
|             scene_manager_stop(nfc->scene_manager);
 | |
|             view_dispatcher_stop(nfc->view_dispatcher);
 | |
|         } else if(event.event == NfcCustomEventRpcSessionClose) {
 | |
|             scene_manager_stop(nfc->scene_manager);
 | |
|             view_dispatcher_stop(nfc->view_dispatcher);
 | |
|         } else if(event.event == NfcCustomEventRpcLoad) {
 | |
|             bool result = false;
 | |
|             const char* arg = rpc_system_app_get_data(nfc->rpc_ctx);
 | |
|             if((arg) && (nfc->rpc_state == NfcRpcStateIdle)) {
 | |
|                 if(nfc_device_load(nfc->dev, arg, false)) {
 | |
|                     if(nfc->dev->format == NfcDeviceSaveFormatMifareUl) {
 | |
|                         nfc_worker_start(
 | |
|                             nfc->worker,
 | |
|                             NfcWorkerStateMfUltralightEmulate,
 | |
|                             &nfc->dev->dev_data,
 | |
|                             nfc_scene_rpc_emulate_callback,
 | |
|                             nfc);
 | |
|                     } else if(nfc->dev->format == NfcDeviceSaveFormatMifareClassic) {
 | |
|                         nfc_worker_start(
 | |
|                             nfc->worker,
 | |
|                             NfcWorkerStateMfClassicEmulate,
 | |
|                             &nfc->dev->dev_data,
 | |
|                             nfc_scene_rpc_emulate_callback,
 | |
|                             nfc);
 | |
|                     } else if(nfc->dev->format == NfcDeviceSaveFormatNfcV) {
 | |
|                         nfc_worker_start(
 | |
|                             nfc->worker,
 | |
|                             NfcWorkerStateNfcVEmulate,
 | |
|                             &nfc->dev->dev_data,
 | |
|                             nfc_scene_rpc_emulate_callback,
 | |
|                             nfc);
 | |
|                     } else {
 | |
|                         nfc_worker_start(
 | |
|                             nfc->worker, NfcWorkerStateUidEmulate, &nfc->dev->dev_data, NULL, nfc);
 | |
|                     }
 | |
|                     nfc->rpc_state = NfcRpcStateEmulating;
 | |
|                     result = true;
 | |
| 
 | |
|                     nfc_blink_emulate_start(nfc);
 | |
|                     nfc_text_store_set(nfc, "emulating\n%s", nfc->dev->dev_name);
 | |
|                     popup_set_text(popup, nfc->text_store, 89, 44, AlignCenter, AlignTop);
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             rpc_system_app_confirm(nfc->rpc_ctx, RpcAppEventLoadFile, result);
 | |
|         }
 | |
|     }
 | |
|     return consumed;
 | |
| }
 | |
| 
 | |
| void nfc_scene_rpc_on_exit(void* context) {
 | |
|     Nfc* nfc = context;
 | |
|     Popup* popup = nfc->popup;
 | |
| 
 | |
|     nfc_blink_stop(nfc);
 | |
| 
 | |
|     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);
 | |
| }
 |