Download the file
  1. #ifndef SPEAKER_H
  2. #define SPEAKER_H
  3.  
  4. #include "heater_controller_master.h"
  5. #include "Scheduler.h"
  6. #include "protocol.h"
  7. #include <RF12.h>
  8.  
  9. class Protocol; // forward declaration, needed because Speaker and Protocol
  10. // refer to each other
  11. class Speaker: public Task {
  12. public:
  13. Speaker();
  14. void set_protocol(Protocol* protocol);
  15. bool canRun(uint32_t now);
  16. void run(uint32_t now);
  17. uint8_t* get_buffer();
  18. void send(uint8_t len, bool ack);
  19. void got_ack();
  20.  
  21. private:
  22. Protocol* protocol;
  23. uint8_t buffer[BUFFER_LEN];
  24. uint8_t buffer_len;
  25. bool with_ack;
  26. uint8_t retry_count;
  27. unsigned long next_retry_millis;
  28. };
  29. #endif
  30. // vim:ft=arduino
  31.