You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -28,21 +31,21 @@ This will be called during initialisation and may be called repeatedly. This mus
28
31
29
32
#### Implementing `read_max_size`
30
33
31
-
This must return synchronously the (effective) size of the EEPROM memory available to NDEF messages (not including the memory required by other files).
34
+
This must synchronously return the (effective) size of the EEPROM memory available to NDEF messages (not including the memory required by other files or headers).
32
35
33
36
#### Implementing `start_session` and `end_session`
34
37
35
-
These open and close the communication wit the device. The `start_session` has an extra parameter that indicates the session should be started even if it would kill the RF session in the process if one is already opened. Otherwise the `open_session` should trigger the `on_session_opened` with the parameter set to false (failure) if an RF session is already opened.
38
+
These open and close the communication with the device. The `start_session` has an extra parameter that indicates the session should be started even if it would kill the RF session in the process. Otherwise the `open_session` should trigger the `on_session_opened` with the parameter set to false (failure) if an RF session is already opened.
36
39
37
40
#### Implementing `read_bytes` and `write_bytes`
38
41
39
42
Both methods contain the `address` which is to be used as the starting offset in the file. This starts at the beginning of the body of the file where NDEF messages may be written. Any headers must be accounted for in the offset and size calculations. The `count` parameters are the maximum sizes of the operations but the operation may return less than the requested counts.
40
43
41
-
The events `on_bytes_read` and `on_bytes_written` must return the number of bytes successfully read or written in case the maximum size of the operation the device allows is smaller than the request operation. It's up to the caller to call these function multiple times with appropriate offsets as required.
44
+
The events `on_bytes_read` and `on_bytes_written` must return the number of bytes successfully read or written in case the maximum size of the operation the device allows is smaller than the request operation. It's up to the caller to call these methods multiple times with appropriate offsets as required.
42
45
43
46
#### Implementing `read_size` and `write_size`
44
47
45
-
These read and write the limits used by the write and read operations. Writing beyond the set size must be truncated to the set size.
48
+
These read and write the limits used by the write and read operations. Writing or reading beyond the set size must be truncated to the current size.
46
49
47
50
#### Implementing `erase_bytes`
48
51
@@ -52,7 +55,7 @@ This is the equivalent of calling `write_bytes` with a buffer filled with `0`. L
52
55
53
56
Depending on your hardware you may support synchronous or asynchronous operation.
54
57
55
-
The `NFCEEPROMDriver` is designed with asynchronous operation in mind and the results of long operation are communicated through events. These must be used even if your implementation is synchronous.
58
+
The `NFCEEPROMDriver` is designed with asynchronous operation in mind and the results of long operations are communicated through events. These must be used even if your implementation is synchronous.
56
59
57
60
In asynchronous implementations you may use an `EventQueue` to schedule processing caused by interrupts. The `NFCTarget` has set up your event queue which you can get by calling:
58
61
`EventQueue* event_queue()`
@@ -61,11 +64,13 @@ You may initiate your event processing by calling `call()` on the event queue.
61
64
62
65
For example:
63
66
64
-
if your event management is done in a function called `manage_event` then you should call `event_queue()->call(&manage_event);`. The `EventQueue` also accepts passed in parameters and objects for non-static method calls - please see the `EventQueue` documentation for details on calling function on the queue.
67
+
if your event management is done in a function called `manage_event` then you should call:
68
+
`event_queue()->call(&manage_event);`.
69
+
The `EventQueue` also accepts passed in parameters and objects for non-static method calls - please see the `EventQueue` documentation for details on calling functions on the queue.
65
70
66
71
#### Communicating events back to the NFCTarget
67
72
68
-
All events shall call function in the `Delegate` class object that has been set by the `NFCTarget`. Delegate is accessible through:
73
+
All events shall call methods in the `Delegate` class object that has been set by the `NFCTarget`. Delegate is accessible through:
69
74
`Delegate* delegate()`
70
75
71
76
It implements the following methods:
@@ -78,6 +83,8 @@ It implements the following methods:
78
83
-`void on_size_read(bool success, size_t size)`
79
84
-`void on_bytes_erased(size_t count)`
80
85
86
+
These must be used to communicate the results of all asynchronous calls.
0 commit comments