Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
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] driver a pointer to a NFCControllerDriver instance [in] queue a pointer to the events queue to use [in] ndef_buffer a 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_protocols the 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] delegate the 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.
Generated on Tue Jul 12 2022 13:55:44 by
