Loading...
Searching...
No Matches
lfrfid_worker.h
Go to the documentation of this file.
1
6#pragma once
7#include <toolbox/protocols/protocol_dict.h>
8#include "protocols/lfrfid_protocols.h"
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14typedef enum {
15 LFRFIDWorkerWriteOK,
16 LFRFIDWorkerWriteProtocolCannotBeWritten,
17 LFRFIDWorkerWriteFobCannotBeWritten,
18 LFRFIDWorkerWriteTooLongToWrite,
19} LFRFIDWorkerWriteResult;
20
21typedef enum {
22 LFRFIDWorkerReadTypeAuto,
23 LFRFIDWorkerReadTypeASKOnly,
24 LFRFIDWorkerReadTypePSKOnly,
25} LFRFIDWorkerReadType;
26
27typedef enum {
28 LFRFIDWorkerReadSenseStart, // TODO FL-3516: not implemented
29 LFRFIDWorkerReadSenseEnd, // TODO FL-3516: not implemented
30 LFRFIDWorkerReadSenseCardStart,
31 LFRFIDWorkerReadSenseCardEnd,
32 LFRFIDWorkerReadStartASK,
33 LFRFIDWorkerReadStartPSK,
34 LFRFIDWorkerReadDone,
35} LFRFIDWorkerReadResult;
36
37typedef enum {
38 LFRFIDWorkerReadRawFileError,
39 LFRFIDWorkerReadRawOverrun,
40} LFRFIDWorkerReadRawResult;
41
42typedef enum {
43 LFRFIDWorkerEmulateRawFileError,
44 LFRFIDWorkerEmulateRawOverrun,
45} LFRFIDWorkerEmulateRawResult;
46
47typedef void (
48 *LFRFIDWorkerReadCallback)(LFRFIDWorkerReadResult result, ProtocolId protocol, void* context);
49typedef void (*LFRFIDWorkerWriteCallback)(LFRFIDWorkerWriteResult result, void* context);
50
51typedef void (*LFRFIDWorkerReadRawCallback)(LFRFIDWorkerReadRawResult result, void* context);
52typedef void (*LFRFIDWorkerEmulateRawCallback)(LFRFIDWorkerEmulateRawResult result, void* context);
53
54typedef struct LFRFIDWorker LFRFIDWorker;
55
60
66
72
78
87 LFRFIDWorker* worker,
88 LFRFIDWorkerReadType type,
89 LFRFIDWorkerReadCallback callback,
90 void* context);
91
100 LFRFIDWorker* worker,
101 LFRFIDProtocol protocol,
102 LFRFIDWorkerWriteCallback callback,
103 void* context);
104
110void lfrfid_worker_emulate_start(LFRFIDWorker* worker, LFRFIDProtocol protocol);
111
121 LFRFIDWorker* worker,
122 const char* filename,
123 LFRFIDWorkerReadType type,
124 LFRFIDWorkerReadRawCallback callback,
125 void* context);
126
135 LFRFIDWorker* worker,
136 const char* filename,
137 LFRFIDWorkerEmulateRawCallback callback,
138 void* context);
139
144void lfrfid_worker_stop(LFRFIDWorker* worker);
145
146#ifdef __cplusplus
147}
148#endif
void lfrfid_worker_stop_thread(LFRFIDWorker *worker)
Stop LF-RFID worker thread.
Definition lfrfid_worker.c:134
void lfrfid_worker_read_raw_start(LFRFIDWorker *worker, const char *filename, LFRFIDWorkerReadType type, LFRFIDWorkerReadRawCallback callback, void *context)
Start raw read mode.
Definition lfrfid_worker.c:92
void lfrfid_worker_read_start(LFRFIDWorker *worker, LFRFIDWorkerReadType type, LFRFIDWorkerReadCallback callback, void *context)
Start read mode.
Definition lfrfid_worker.c:50
void lfrfid_worker_stop(LFRFIDWorker *worker)
Stop all modes.
Definition lfrfid_worker.c:122
void lfrfid_worker_emulate_raw_start(LFRFIDWorker *worker, const char *filename, LFRFIDWorkerEmulateRawCallback callback, void *context)
Emulate raw read mode.
Definition lfrfid_worker.c:108
void lfrfid_worker_free(LFRFIDWorker *worker)
Free LF-RFID worker.
Definition lfrfid_worker.c:39
void lfrfid_worker_start_thread(LFRFIDWorker *worker)
Start LF-RFID worker thread.
Definition lfrfid_worker.c:128
void lfrfid_worker_emulate_start(LFRFIDWorker *worker, LFRFIDProtocol protocol)
Start emulate mode.
Definition lfrfid_worker.c:76
void lfrfid_worker_write_start(LFRFIDWorker *worker, LFRFIDProtocol protocol, LFRFIDWorkerWriteCallback callback, void *context)
Start write mode.
Definition lfrfid_worker.c:64
LFRFIDWorker * lfrfid_worker_alloc(ProtocolDict *dict)
Allocate LF-RFID worker.
Definition lfrfid_worker.c:21
Definition lfrfid_worker_i.h:30
Definition protocol_dict.c:4