17 #ifndef MBED_NFC_EEPROM_H 18 #define MBED_NFC_EEPROM_H 21 #include "events/EventQueue.h" 23 #include "NFCDefinitions.h" 24 #include "NFCTarget.h" 25 #include "NFCEEPROMDriver.h" 108 virtual void on_session_started(
bool success);
109 virtual void on_session_ended(
bool success);
110 virtual void on_bytes_read(
size_t count);
111 virtual void on_bytes_written(
size_t count);
112 virtual void on_size_written(
bool success);
113 virtual void on_size_read(
bool success,
size_t size);
114 virtual void on_bytes_erased(
size_t count);
116 void handle_error(nfc_err_t ret);
117 void continue_write();
118 void continue_read();
119 void continue_erase();
124 enum nfc_eeprom_operation_t {
127 nfc_eeprom_write_start_session,
128 nfc_eeprom_write_write_size,
129 nfc_eeprom_write_write_bytes,
130 nfc_eeprom_write_end_session,
132 nfc_eeprom_read_start_session,
133 nfc_eeprom_read_read_size,
134 nfc_eeprom_read_read_bytes,
135 nfc_eeprom_read_end_session,
137 nfc_eeprom_erase_start_session,
138 nfc_eeprom_erase_write_max_size,
139 nfc_eeprom_erase_erase_bytes,
140 nfc_eeprom_erase_write_0_size,
141 nfc_eeprom_erase_end_session
149 nfc_eeprom_operation_t _current_op;
151 size_t _ndef_buffer_read_sz;
152 uint32_t _eeprom_address;
153 nfc_err_t _operation_result;
NFCEEPROM(NFCEEPROMDriver *driver, events::EventQueue *queue, const Span< uint8_t > &ndef_buffer)
Construct a NFCEEPROM instance.
virtual void on_ndef_message_read(nfc_err_t result)
The NDEF message reading request completed.
The abstraction for a NFC EEPROM driver.
This class represents a NFC target (either a remote target when the local controller in in initiator ...
nfc_err_t initialize()
Initialize the NFC EEPROM.
virtual void on_ndef_message_erased(nfc_err_t result)
The NDEF message erasing request completed.
virtual void write_ndef_message()
Write a NDEF message to the target.
void set_delegate(Delegate *delegate)
Set the delegate that will receive events generated by this EEPROM.
The NFC EEPROM class represents a NFC target device connected using a wired link (I2C, SPI, etc).
virtual void on_ndef_message_written(nfc_err_t result)
The NDEF message writing request completed.
virtual void erase_ndef_message()
Erase the NDEF message in the target.
virtual void read_ndef_message()
Read a NDEF message from the target.
The NFCEEPROMDriver delegate.