-
Notifications
You must be signed in to change notification settings - Fork 2
/
as_card_worker.h
40 lines (35 loc) · 1.13 KB
/
as_card_worker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
#include <furi.h>
#include <nfc/nfc_listener.h>
#include <nfc/protocols/iso14443_4a/iso14443_4a.h>
#include "nfc_relay.h"
#include "comm.h"
typedef enum {
AsCardWorkerStateWaitPong,
AsCardWorkerStateWaitNfcDevData,
AsCardWorkerStateWaitApduReq,
AsCardWorkerStateWaitApduResp,
AsCardWorkerStateGetApduResp,
} AsCardWorkerState;
typedef bool (*AsCardWorkerCallback)(AsCardWorkerState event, void* context);
typedef struct AsCardWorker {
FuriThread* thread;
AsCardWorkerState state;
Comm* comm;
NfcRelay* nfc_relay;
AsCardWorkerCallback callback;
Iso14443_4aData* dev_data;
Nfc* nfc;
NfcListener* listener;
BitBuffer* bitbuffer;
uint8_t* buff_tx;
uint32_t delayus;
uint16_t apdu_buf_len;
uint8_t apdu_buf[260];
bool running;
} AsCardWorker;
AsCardWorker* as_card_worker_alloc();
int32_t as_card_worker_task(void* context);
void as_card_worker_start(AsCardWorker* as_reader_worker, AsCardWorkerCallback callback);
void as_card_worker_stop(AsCardWorker* as_reader_worker);
void as_card_worker_free(AsCardWorker* as_reader_worker);