2022-11-04 07:01:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <lib/nfc/nfc_device.h>
|
2023-05-25 17:01:02 +00:00
|
|
|
#include "nfc_magic.h"
|
2022-11-04 07:01:44 +00:00
|
|
|
|
|
|
|
typedef struct NfcMagicWorker NfcMagicWorker;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
NfcMagicWorkerStateReady,
|
|
|
|
|
|
|
|
NfcMagicWorkerStateCheck,
|
|
|
|
NfcMagicWorkerStateWrite,
|
2023-05-25 17:01:02 +00:00
|
|
|
NfcMagicWorkerStateRekey,
|
2022-11-04 07:01:44 +00:00
|
|
|
NfcMagicWorkerStateWipe,
|
|
|
|
|
|
|
|
NfcMagicWorkerStateStop,
|
|
|
|
} NfcMagicWorkerState;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
NfcMagicWorkerEventSuccess,
|
|
|
|
NfcMagicWorkerEventFail,
|
|
|
|
NfcMagicWorkerEventCardDetected,
|
|
|
|
NfcMagicWorkerEventNoCardDetected,
|
|
|
|
NfcMagicWorkerEventWrongCard,
|
|
|
|
} NfcMagicWorkerEvent;
|
|
|
|
|
|
|
|
typedef bool (*NfcMagicWorkerCallback)(NfcMagicWorkerEvent event, void* context);
|
|
|
|
|
|
|
|
NfcMagicWorker* nfc_magic_worker_alloc();
|
|
|
|
|
|
|
|
void nfc_magic_worker_free(NfcMagicWorker* nfc_magic_worker);
|
|
|
|
|
|
|
|
void nfc_magic_worker_stop(NfcMagicWorker* nfc_magic_worker);
|
|
|
|
|
|
|
|
void nfc_magic_worker_start(
|
|
|
|
NfcMagicWorker* nfc_magic_worker,
|
|
|
|
NfcMagicWorkerState state,
|
2023-05-25 17:01:02 +00:00
|
|
|
NfcMagicDevice* magic_dev,
|
2022-11-04 07:01:44 +00:00
|
|
|
NfcDeviceData* dev_data,
|
2023-05-25 17:01:02 +00:00
|
|
|
uint32_t new_password,
|
2022-11-04 07:01:44 +00:00
|
|
|
NfcMagicWorkerCallback callback,
|
|
|
|
void* context);
|