2021-06-28 17:42:30 +03:00
|
|
|
#pragma once
|
2022-01-05 19:10:18 +03:00
|
|
|
#include "key_info.h"
|
|
|
|
#include "rfid_reader.h"
|
|
|
|
#include "rfid_writer.h"
|
|
|
|
#include "rfid_timer_emulator.h"
|
|
|
|
#include "rfid_key.h"
|
|
|
|
#include "state_sequencer.h"
|
2021-06-28 17:42:30 +03:00
|
|
|
|
|
|
|
class RfidWorker {
|
|
|
|
public:
|
|
|
|
RfidWorker();
|
|
|
|
~RfidWorker();
|
|
|
|
|
|
|
|
void start_read();
|
|
|
|
bool read();
|
2021-08-02 01:11:18 +03:00
|
|
|
bool detect();
|
|
|
|
bool any_read();
|
2021-06-28 17:42:30 +03:00
|
|
|
void stop_read();
|
|
|
|
|
|
|
|
enum class WriteResult : uint8_t {
|
|
|
|
Ok,
|
|
|
|
NotWritable,
|
|
|
|
Nothing,
|
|
|
|
};
|
|
|
|
|
|
|
|
void start_write();
|
|
|
|
WriteResult write();
|
|
|
|
void stop_write();
|
|
|
|
|
|
|
|
void start_emulate();
|
|
|
|
void stop_emulate();
|
|
|
|
|
|
|
|
RfidKey key;
|
|
|
|
|
|
|
|
private:
|
|
|
|
RfidWriter writer;
|
|
|
|
RfidReader reader;
|
|
|
|
RfidTimerEmulator emulator;
|
|
|
|
|
|
|
|
WriteResult write_result;
|
|
|
|
TickSequencer* write_sequence;
|
|
|
|
|
|
|
|
void sq_write();
|
|
|
|
void sq_write_start_validate();
|
|
|
|
void sq_write_validate();
|
2021-10-04 02:30:47 +03:00
|
|
|
uint16_t validate_counts;
|
2021-06-28 17:42:30 +03:00
|
|
|
void sq_write_stop_validate();
|
2022-05-06 16:37:10 +03:00
|
|
|
};
|