[FL-1447] NFC application refactoring (#532)
* nfc: add separate nfc_detect * nfc_worker: add callback and context * api-hal-nfc: return busy if rfal worker is running * nfc: introduce nfc_detect, change nfc_worker API, rework main nfc task * nfc_emulate: introduce nfc_emulate module * nfc: introduce nfc_emv module * nfc: introduce nfc_mifare_ul module * nfc: remove unused nfc_views * nfc: separate messages and models * nfc: remove unused nfc message types * nfc: remove message_queue from common api * view_dispatcher: delete internal queue in destructor * api-hal-nfc: fix rfal worker initialization condition Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
24
applications/nfc/nfc_worker.h
Normal file → Executable file
24
applications/nfc/nfc_worker.h
Normal file → Executable file
@@ -2,6 +2,24 @@
|
||||
|
||||
typedef struct NfcWorker NfcWorker;
|
||||
|
||||
typedef enum {
|
||||
// Init states
|
||||
NfcWorkerStateNone,
|
||||
NfcWorkerStateBroken,
|
||||
NfcWorkerStateReady,
|
||||
// Main worker states
|
||||
NfcWorkerStateDetect,
|
||||
NfcWorkerStateEmulate,
|
||||
NfcWorkerStateReadEMV,
|
||||
NfcWorkerStateEmulateEMV,
|
||||
NfcWorkerStateField,
|
||||
NfcWorkerStateReadMfUltralight,
|
||||
// Transition
|
||||
NfcWorkerStateStop,
|
||||
} NfcWorkerState;
|
||||
|
||||
typedef void (*NfcWorkerCallback)(void* context);
|
||||
|
||||
NfcWorker* nfc_worker_alloc(osMessageQueueId_t message_queue);
|
||||
|
||||
NfcWorkerState nfc_worker_get_state(NfcWorker* nfc_worker);
|
||||
@@ -10,6 +28,10 @@ ReturnCode nfc_worker_get_error(NfcWorker* nfc_worker);
|
||||
|
||||
void nfc_worker_free(NfcWorker* nfc_worker);
|
||||
|
||||
void nfc_worker_start(NfcWorker* nfc_worker, NfcWorkerState state);
|
||||
void nfc_worker_start(
|
||||
NfcWorker* nfc_worker,
|
||||
NfcWorkerState state,
|
||||
NfcWorkerCallback callback,
|
||||
void* context);
|
||||
|
||||
void nfc_worker_stop(NfcWorker* nfc_worker);
|
||||
|
Reference in New Issue
Block a user