Loading...
Searching...
No Matches
felica_listener_i.h
1#include "felica_listener.h"
2
4
5#define FELICA_LISTENER_READ_BLOCK_COUNT_MAX (4U)
6#define FELICA_LISTENER_READ_BLOCK_COUNT_MIN (1U)
7#define FELICA_LISTENER_WRITE_BLOCK_COUNT_MAX (2U)
8#define FELICA_LISTENER_WRITE_BLOCK_COUNT_MIN (1U)
9
10typedef enum {
11 Felica_ListenerStateIdle,
12 Felica_ListenerStateActivated,
13} FelicaListenerState;
14
16typedef struct {
17 uint8_t length;
20
26
29
34typedef struct {
35 FelicaBlockData blocks[FELICA_LISTENER_WRITE_BLOCK_COUNT_MAX];
37
43typedef void (*FelicaCommandWriteBlockHandler)(
44 FelicaListener* instance,
45 const uint8_t block_number,
46 const FelicaBlockData* data_block);
47
53typedef void (*FelicaCommanReadBlockHandler)(
54 FelicaListener* instance,
55 const uint8_t block_number,
56 const uint8_t resp_data_index,
58
60 Nfc* nfc;
61 FelicaData* data;
62 FelicaListenerState state;
64 FelicaBlockData mc_shadow;
65
66 uint8_t request_size_buf;
67 uint8_t block_list_size;
68 uint8_t requested_blocks[FELICA_LISTENER_READ_BLOCK_COUNT_MAX];
69 uint8_t mac_calc_start;
70 bool rc_written;
71
72 BitBuffer* tx_buffer;
73 BitBuffer* rx_buffer;
74
75 NfcGenericEvent generic_event;
76 NfcGenericCallback callback;
77 void* context;
78};
79
85void felica_listener_reset(FelicaListener* instance);
86
91void felica_wcnt_increment(FelicaData* data);
92
100bool felica_listener_check_idm(const FelicaListener* instance, const FelicaIDm* request_idm);
101
117bool felica_listener_check_block_list_size(
118 FelicaListener* instance,
120
134const FelicaBlockListElement* felica_listener_block_list_item_get_first(
135 FelicaListener* instance,
136 const FelicaListenerRequest* request);
137
149const FelicaBlockListElement* felica_listener_block_list_item_get_next(
150 FelicaListener* instance,
151 const FelicaBlockListElement* prev_item);
152
164const FelicaListenerWriteBlockData* felica_listener_get_write_request_data_pointer(
165 const FelicaListener* const instance,
166 const FelicaListenerGenericRequest* const generic_request);
167
187bool felica_listener_validate_write_request_and_set_sf(
188 FelicaListener* instance,
189 const FelicaListenerWriteRequest* const request,
190 const FelicaListenerWriteBlockData* const data,
192
213bool felica_listener_validate_read_request_and_set_sf(
214 FelicaListener* instance,
215 const FelicaListenerReadRequest* const request,
216 FelicaCommandResponseHeader* resp_header);
217
225FelicaCommanReadBlockHandler felica_listener_get_read_block_handler(const uint8_t block_number);
226
234FelicaCommandWriteBlockHandler felica_listener_get_write_block_handler(const uint8_t block_number);
235
243FelicaError
244 felica_listener_frame_exchange(const FelicaListener* instance, const BitBuffer* tx_buffer);
Generic Nfc stack event definitions.
NfcCommand(* NfcGenericCallback)(NfcGenericEvent event, void *context)
Generic Nfc event callback type.
Definition nfc_generic_event.h:75
Definition bit_buffer.c:7
Structure used to hold authentication related fields.
Definition felica.h:99
Definition felica.h:63
Definition felica.h:175
Definition felica.h:158
Definition felica.h:167
Structure used to store Felica data and additional values about reading.
Definition felica.h:149
Felica ID block.
Definition felica.h:106
Generic Felica request same for both read and write operations.
Definition felica_listener_i.h:16
Definition felica_listener_i.h:59
Definition felica.h:192
Generic request but with list of requested elements.
Definition felica_listener_i.h:22
Struct for write request data.
Definition felica_listener_i.h:34
Generic Nfc event type.
Definition nfc_generic_event.h:58
Definition nfc.c:41