From b0c4600115f40f1e4435c5c1a04bd1aeb9d789b3 Mon Sep 17 00:00:00 2001 From: RebornedBrain Date: Tue, 27 Aug 2024 17:46:49 +0300 Subject: [PATCH] Now 4a listener invokes upper level callback on Halt and FieldOff --- lib/nfc/protocols/iso14443_4a/iso14443_4a_listener.c | 9 +++++++++ lib/nfc/protocols/iso14443_4a/iso14443_4a_listener.h | 1 + 2 files changed, 10 insertions(+) diff --git a/lib/nfc/protocols/iso14443_4a/iso14443_4a_listener.c b/lib/nfc/protocols/iso14443_4a/iso14443_4a_listener.c index 95612bf54..32cc8f198 100644 --- a/lib/nfc/protocols/iso14443_4a/iso14443_4a_listener.c +++ b/lib/nfc/protocols/iso14443_4a/iso14443_4a_listener.c @@ -84,6 +84,15 @@ static NfcCommand iso14443_4a_listener_run(NfcGenericEvent event, void* context) iso14443_3a_event->type == Iso14443_3aListenerEventTypeHalted || iso14443_3a_event->type == Iso14443_3aListenerEventTypeFieldOff) { instance->state = Iso14443_4aListenerStateIdle; + + instance->iso14443_4a_event.type = iso14443_3a_event->type == + Iso14443_3aListenerEventTypeHalted ? + Iso14443_4aListenerEventTypeHalted : + Iso14443_4aListenerEventTypeFieldOff; + + if(instance->callback) { + command = instance->callback(instance->generic_event, instance->context); + } command = NfcCommandContinue; } diff --git a/lib/nfc/protocols/iso14443_4a/iso14443_4a_listener.h b/lib/nfc/protocols/iso14443_4a/iso14443_4a_listener.h index ba649847b..04f0b197a 100644 --- a/lib/nfc/protocols/iso14443_4a/iso14443_4a_listener.h +++ b/lib/nfc/protocols/iso14443_4a/iso14443_4a_listener.h @@ -12,6 +12,7 @@ typedef struct Iso14443_4aListener Iso14443_4aListener; typedef enum { Iso14443_4aListenerEventTypeHalted, + Iso14443_4aListenerEventTypeFieldOff, Iso14443_4aListenerEventTypeReceivedData, } Iso14443_4aListenerEventType;