Download the file
  1. #ifndef PROTOCOL_H
  2. #define PROTOCOL_H
  3.  
  4. #include <RF12.h>
  5. #include <Ports.h>
  6. #include "ui.h"
  7. #include "heater_controller_master.h"
  8. #include "speaker.h"
  9. #include "Scheduler.h"
  10.  
  11. class Speaker;
  12. class UI; // forward declaration, needed because UI and Protocol
  13. // refer to each other
  14.  
  15. class Protocol: public TimedTask {
  16. public:
  17. Protocol(Speaker* speaker);
  18.  
  19. bool canRun(uint32_t now);
  20. void run(uint32_t now);
  21.  
  22. void set_ui(UI* ui);
  23. void handle(uint8_t * buffer, uint8_t buffer_len);
  24. void status_request();
  25. void relay_close_request();
  26. void relay_open_request();
  27. void got_ack();
  28. void got_nack();
  29.  
  30. protected:
  31. void process_status_reply(uint8_t * buffer, uint8_t buffer_len);
  32.  
  33. private:
  34. Speaker* speaker;
  35. UI* ui;
  36. bool timer_armed;
  37. };
  38. #endif
  39. // vim:ft=arduino
  40.