mirror of https://github.com/ARMmbed/mbed-os.git
Use SharedPtr class for detected endpoints
parent
d5201f00e4
commit
db2cdf0b02
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#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<NFCRemoteInitiator>& 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<NFCRemoteTarget>& nfc_target) {}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "NFCController.h"
|
||||
#include "NFCControllerDriver.h"
|
||||
#include "Type4RemoteInitiator.h"
|
||||
|
||||
#include "stack/transceiver/transceiver.h"
|
||||
|
||||
|
|
@ -118,7 +119,10 @@ 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<Type4RemoteInitiator> type4_remote_initiator( new Type4RemoteInitiator(_transceiver) );
|
||||
if( _delegate != NULL ) {
|
||||
_delegate->on_nfc_initiator_discovered(type4_remote_initiator);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue