key_worker.h 749 B

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include <furi.h>
  3. #include "key_info.h"
  4. #include "key_reader.h"
  5. #include "key_emulator.h"
  6. #include "key_writer.h"
  7. #include "../ibutton_key.h"
  8. #include <one_wire_master.h>
  9. #include <one_wire_slave.h>
  10. class KeyWorker {
  11. public:
  12. KeyReader::Error read(iButtonKey* key);
  13. void start_read();
  14. void stop_read();
  15. bool emulated();
  16. void start_emulate(iButtonKey* key);
  17. void stop_emulate();
  18. KeyWriter::Error write(iButtonKey* key);
  19. void start_write();
  20. void stop_write();
  21. KeyWorker(const GpioPin* one_wire_gpio);
  22. ~KeyWorker();
  23. private:
  24. // one wire
  25. OneWireMaster onewire_master;
  26. OneWireSlave onewire_slave;
  27. KeyReader key_reader;
  28. KeyEmulator key_emulator;
  29. KeyWriter key_writer;
  30. };