key-worker.h 731 B

12345678910111213141516171819202122232425262728293031323334
  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. private:
  23. // one wire
  24. OneWireMaster onewire_master;
  25. OneWireSlave onewire_slave;
  26. KeyReader key_reader;
  27. KeyEmulator key_emulator;
  28. KeyWriter key_writer;
  29. };