|
|
@@ -9,6 +9,7 @@ static PassyReader* passy_reader = NULL;
|
|
|
void passy_scene_detect_scan_callback(NfcScannerEvent event, void* context) {
|
|
|
furi_assert(context);
|
|
|
Passy* passy = context;
|
|
|
+ passy->proto = NULL;
|
|
|
|
|
|
// detect the type of protocol, either 4a/4b and then run the specific poller callback functions yada yada yada
|
|
|
if(event.type == NfcScannerEventTypeDetected) {
|
|
|
@@ -17,10 +18,15 @@ void passy_scene_detect_scan_callback(NfcScannerEvent event, void* context) {
|
|
|
} else if(event.data.protocols && *event.data.protocols == NfcProtocolIso14443_4b) {
|
|
|
passy->proto = "4b";
|
|
|
} else {
|
|
|
- passy->proto = "";
|
|
|
- // just continue as expected..
|
|
|
+ FURI_LOG_E(TAG, "Unknown protocol detected, %d", *event.data.protocols);
|
|
|
+ }
|
|
|
+ if(passy->proto && strlen(passy->proto) > 0) {
|
|
|
+ view_dispatcher_send_custom_event(
|
|
|
+ passy->view_dispatcher, PassyCustomEventReaderDetected);
|
|
|
+ } else {
|
|
|
+ view_dispatcher_send_custom_event(
|
|
|
+ passy->view_dispatcher, PassyCustomEventReaderRestart);
|
|
|
}
|
|
|
- view_dispatcher_send_custom_event(passy->view_dispatcher, PassyCustomEventReaderDetected);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -58,6 +64,10 @@ bool passy_scene_read_on_event(void* context, SceneManagerEvent event) {
|
|
|
passy->last_sw = passy_reader->last_sw;
|
|
|
scene_manager_next_scene(passy->scene_manager, PassySceneReadError);
|
|
|
consumed = true;
|
|
|
+ } else if(event.event == PassyCustomEventReaderRestart) {
|
|
|
+ nfc_scanner_stop(passy->scanner);
|
|
|
+ nfc_scanner_start(passy->scanner, passy_scene_detect_scan_callback, passy);
|
|
|
+ consumed = true;
|
|
|
} else if(event.event == PassyCustomEventReaderDetected) {
|
|
|
nfc_scanner_stop(passy->scanner);
|
|
|
nfc_scanner_free(passy->scanner);
|
|
|
@@ -66,7 +76,6 @@ bool passy_scene_read_on_event(void* context, SceneManagerEvent event) {
|
|
|
FURI_LOG_I(TAG, "detected 4B protocol");
|
|
|
passy->poller = nfc_poller_alloc(passy->nfc, NfcProtocolIso14443_4b);
|
|
|
passy_reader = passy_reader_alloc(passy);
|
|
|
- FURI_LOG_I(TAG, "mhm");
|
|
|
nfc_poller_start(passy->poller, passy_reader_poller_callback, passy_reader);
|
|
|
passy->bytes_total = 0;
|
|
|
} else if(strcmp(passy->proto, "4a") == 0) {
|