|
1 | 1 | #include "nfc_magic_scanner.h" |
2 | 2 |
|
3 | 3 | #include "protocols/gen1a/gen1a_poller.h" |
4 | | -#include "protocols/gen2/gen2_poller.h" |
5 | 4 | #include "protocols/gen4/gen4_poller.h" |
6 | 5 | #include <nfc/nfc_poller.h> |
7 | 6 |
|
@@ -66,33 +65,20 @@ static int32_t nfc_magic_scanner_worker(void* context) { |
66 | 65 | furi_assert(instance->session_state == NfcMagicScannerSessionStateActive); |
67 | 66 |
|
68 | 67 | while(instance->session_state == NfcMagicScannerSessionStateActive) { |
69 | | - do { |
70 | | - if(instance->current_protocol == NfcMagicProtocolGen1) { |
71 | | - instance->magic_protocol_detected = gen1a_poller_detect(instance->nfc); |
72 | | - if(instance->magic_protocol_detected) { |
73 | | - break; |
74 | | - } |
75 | | - } else if(instance->current_protocol == NfcMagicProtocolGen4) { |
76 | | - Gen4PollerError error = gen4_poller_detect(instance->nfc, instance->gen4_password); |
| 68 | + if(instance->current_protocol == NfcMagicProtocolGen1) { |
| 69 | + instance->magic_protocol_detected = gen1a_poller_detect(instance->nfc); |
| 70 | + } else if(instance->current_protocol == NfcMagicProtocolGen4) { |
| 71 | + Gen4PollerError error = gen4_poller_detect(instance->nfc, instance->gen4_password); |
| 72 | + if(error == Gen4PollerErrorProtocol) { |
| 73 | + NfcMagicScannerEvent event = { |
| 74 | + .type = NfcMagicScannerEventTypeDetectedNotMagic, |
| 75 | + }; |
| 76 | + instance->callback(event, instance->context); |
| 77 | + break; |
| 78 | + } else { |
77 | 79 | instance->magic_protocol_detected = (error == Gen4PollerErrorNone); |
78 | | - if(instance->magic_protocol_detected) { |
79 | | - break; |
80 | | - } |
81 | | - } else if(instance->current_protocol == NfcMagicProtocolGen2) { |
82 | | - Gen2PollerError error = gen2_poller_detect(instance->nfc); |
83 | | - instance->magic_protocol_detected = (error == Gen2PollerErrorNone); |
84 | | - if(instance->magic_protocol_detected) { |
85 | | - break; |
86 | | - } |
87 | | - } else if(instance->current_protocol == NfcMagicProtocolClassic) { |
88 | | - NfcPoller* poller = nfc_poller_alloc(instance->nfc, NfcProtocolMfClassic); |
89 | | - instance->magic_protocol_detected = nfc_poller_detect(poller); |
90 | | - nfc_poller_free(poller); |
91 | | - if(instance->magic_protocol_detected) { |
92 | | - break; |
93 | | - } |
94 | 80 | } |
95 | | - } while(false); |
| 81 | + } |
96 | 82 |
|
97 | 83 | if(instance->magic_protocol_detected) { |
98 | 84 | NfcMagicScannerEvent event = { |
|
0 commit comments