diff --git a/features/nfc/nfc/NFCController.h b/features/nfc/nfc/NFCController.h index 7b0fbc95f2..529fbd94f2 100644 --- a/features/nfc/nfc/NFCController.h +++ b/features/nfc/nfc/NFCController.h @@ -19,6 +19,7 @@ #include #include "events/EventQueue.h" +#include "platform/SharedPtr.h" #include "NFCDefinitions.h" @@ -71,13 +72,13 @@ namespace nfc { * A remote initiator was discovered (the local controller is in target mode). * @param[in] the NFCRemoteInitiator instance */ - virtual void on_nfc_initiator_discovered(const NFCRemoteInitiator& nfc_initiator) {} + virtual void on_nfc_initiator_discovered(const SharedPtr& nfc_initiator) {} /** * A remote target was discovered (the local controller is in initiator mode). * @param[in] the NFCRemoteTarget instance */ - virtual void on_nfc_target_discovered(const NFCRemoteTarget& nfc_target) {} + virtual void on_nfc_target_discovered(const SharedPtr& nfc_target) {} }; /** diff --git a/features/nfc/nfc/Type4RemoteInitiator.h b/features/nfc/nfc/Type4RemoteInitiator.h index f5c116144e..ea2664a19b 100644 --- a/features/nfc/nfc/Type4RemoteInitiator.h +++ b/features/nfc/nfc/Type4RemoteInitiator.h @@ -39,6 +39,8 @@ namespace nfc { */ class Type4RemoteInitiator : public NFCRemoteInitiator, public ISO7816App, public NFCNDEFCapable { private: + Type4RemoteInitiator(nfc_transceiver_t* transceiver); + // NFCNDEFCapable implementation virtual bool is_ndef_supported() const; diff --git a/features/nfc/source/nfc/NFCController.cpp b/features/nfc/source/nfc/NFCController.cpp index 5d3d9a78f1..d3754684f2 100644 --- a/features/nfc/source/nfc/NFCController.cpp +++ b/features/nfc/source/nfc/NFCController.cpp @@ -16,6 +16,7 @@ #include "NFCController.h" #include "NFCControllerDriver.h" +#include "Type4RemoteInitiator.h" #include "stack/transceiver/transceiver.h" @@ -118,12 +119,15 @@ void NFCController::polling_callback(nfc_err_t ret) if( !transceiver_is_initiator_mode(_transceiver) ) { nfc_tech_t active_tech = transceiver_get_active_techs(_transceiver); if( active_tech.nfc_iso_dep_a || active_tech.nfc_iso_dep_b ) { - SharedPtr ptr = + SharedPtr type4_remote_initiator( new Type4RemoteInitiator(_transceiver) ); + if( _delegate != NULL ) { + _delegate->on_nfc_initiator_discovered(type4_remote_initiator); + } } } } - if(_delegate != NULL) { + if( _delegate != NULL ) { nfc_discovery_terminated_reason_t reason; // Map reason