2022-11-04 10:01:44 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <lib/nfc/nfc_device.h>
|
2023-05-25 20:01:02 +03:00
|
|
|
#include "nfc_magic.h"
|
2022-11-04 10:01:44 +03:00
|
|
|
|
|
|
|
typedef struct NfcMagicWorker NfcMagicWorker;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
NfcMagicWorkerStateReady,
|
|
|
|
|
|
|
|
NfcMagicWorkerStateCheck,
|
|
|
|
NfcMagicWorkerStateWrite,
|
2023-05-25 20:01:02 +03:00
|
|
|
NfcMagicWorkerStateRekey,
|
2022-11-04 10:01:44 +03: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 20:01:02 +03:00
|
|
|
NfcMagicDevice* magic_dev,
|
2022-11-04 10:01:44 +03:00
|
|
|
NfcDeviceData* dev_data,
|
2023-05-25 20:01:02 +03:00
|
|
|
uint32_t new_password,
|
2022-11-04 10:01:44 +03:00
|
|
|
NfcMagicWorkerCallback callback,
|
|
|
|
void* context);
|