Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

NFCController Class Reference

NFCController Class Reference
[Nfc]

This class represents a NFC Controller. More...

#include <NFCController.h>

Inherits mbed::nfc::NFCControllerDriver::Delegate.

Data Structures

struct  Delegate
 The NFCController delegate. More...

Public Member Functions

 NFCController (NFCControllerDriver *driver, events::EventQueue *queue, const Span< uint8_t > &ndef_buffer)
 Construct a NFCController instance.
nfc_err_t initialize ()
 Initialize the NFC controller.
void set_delegate (Delegate *delegate)
 Set the delegate that will receive events generated by this controller.
nfc_rf_protocols_bitmask_t get_supported_rf_protocols () const
 Get the list of RF protocols supported by this controller.
nfc_err_t configure_rf_protocols (nfc_rf_protocols_bitmask_t rf_protocols)
 Set the list of RF protocols to look for during discovery.
nfc_err_t start_discovery ()
 Start the discovery process using the protocols configured previously.
nfc_err_t cancel_discovery ()
 Cancel/stop a running discovery process.

Detailed Description

This class represents a NFC Controller.

A controller can be in one of three different states: * Idle/sleep state * Discovery state: The controller tries to discover a remote endpoint (initiator or target) * Connected state: The controller exchanges data with an endpoint (initiator or target)

A NFCController instance needs to be initialized with a NFCControllerDriver instance which abstracts the specific controller being used. A delegate needs to be set by the user to receive discovery events.

Definition at line 53 of file NFCController.h.


Constructor & Destructor Documentation

NFCController ( NFCControllerDriver driver,
events::EventQueue queue,
const Span< uint8_t > &  ndef_buffer 
)

Construct a NFCController instance.

Parameters:
[in]drivera pointer to a NFCControllerDriver instance
[in]queuea pointer to the events queue to use
[in]ndef_buffera bytes array used to store NDEF messages

Definition at line 26 of file NFCController.cpp.


Member Function Documentation

nfc_err_t cancel_discovery (  )

Cancel/stop a running discovery process.

Returns:
NFC_OK

Definition at line 121 of file NFCController.cpp.

nfc_err_t configure_rf_protocols ( nfc_rf_protocols_bitmask_t  rf_protocols )

Set the list of RF protocols to look for during discovery.

Parameters:
[in]rf_protocolsthe relevant bitmask
Returns:
NFC_OK on success, or NFC_ERR_UNSUPPORTED if a protocol is not supported by the controller, NFC_ERR_BUSY if the discovery process is already running

Definition at line 84 of file NFCController.cpp.

nfc_rf_protocols_bitmask_t get_supported_rf_protocols (  ) const

Get the list of RF protocols supported by this controller.

Returns:
a bitmask of RF protocols supported by the controller

Definition at line 56 of file NFCController.cpp.

nfc_err_t initialize (  )

Initialize the NFC controller.

This method must be called before any other method call.

Returns:
NFC_OK, or an error.

Definition at line 32 of file NFCController.cpp.

void set_delegate ( Delegate delegate )

Set the delegate that will receive events generated by this controller.

Parameters:
[in]delegatethe delegate instance to use

Definition at line 51 of file NFCController.cpp.

nfc_err_t start_discovery (  )

Start the discovery process using the protocols configured previously.

If remote endpoints are connected when this is called, they will be disconnected.

Returns:
NFC_OK on success, or NFC_ERR_BUSY if the discovery process is already running

Definition at line 109 of file NFCController.cpp.