lfrfid_worker_i.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * @file lfrfid_worker_i.h
  3. *
  4. * lfrfid worker, internal definitions
  5. */
  6. #pragma once
  7. #include <furi.h>
  8. #include "lfrfid_worker.h"
  9. #include "lfrfid_raw_worker.h"
  10. #include "protocols/lfrfid_protocols.h"
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. typedef struct {
  15. void (*const process)(LFRFIDWorker* worker);
  16. } LFRFIDWorkerModeType;
  17. typedef enum {
  18. LFRFIDWorkerIdle,
  19. LFRFIDWorkerRead,
  20. LFRFIDWorkerWrite,
  21. LFRFIDWorkerEmulate,
  22. LFRFIDWorkerReadRaw,
  23. LFRFIDWorkerEmulateRaw,
  24. } LFRFIDWorkerMode;
  25. struct LFRFIDWorker {
  26. char* raw_filename;
  27. LFRFIDWorkerMode mode_index;
  28. void* mode_storage;
  29. FuriEventFlag* events;
  30. FuriThread* thread;
  31. LFRFIDWorkerReadType read_type;
  32. LFRFIDWorkerReadCallback read_cb;
  33. LFRFIDWorkerWriteCallback write_cb;
  34. LFRFIDWorkerReadRawCallback read_raw_cb;
  35. LFRFIDWorkerEmulateRawCallback emulate_raw_cb;
  36. void* cb_ctx;
  37. ProtocolDict* protocols;
  38. LFRFIDProtocol protocol;
  39. };
  40. extern const LFRFIDWorkerModeType lfrfid_worker_modes[];
  41. /**
  42. * @brief Check for stop flag
  43. *
  44. * @param worker
  45. * @return bool
  46. */
  47. bool lfrfid_worker_check_for_stop(LFRFIDWorker* worker);
  48. #ifdef __cplusplus
  49. }
  50. #endif