MiLightRadio.h 822 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * MiLightRadio.h
  3. *
  4. * Created on: 29 May 2015
  5. * Author: henryk
  6. */
  7. #ifdef ARDUINO
  8. #include "Arduino.h"
  9. #else
  10. #include <stdint.h>
  11. #include <stdlib.h>
  12. #include <string.h>
  13. #endif
  14. #include "AbstractPL1167.h"
  15. #include <MiLightRadioConfig.h>
  16. #ifndef MILIGHTRADIO_H_
  17. #define MILIGHTRADIO_H_
  18. class MiLightRadio {
  19. public:
  20. MiLightRadio(AbstractPL1167 &pl1167, MiLightRadioConfig& config);
  21. int begin();
  22. bool available();
  23. int read(uint8_t frame[], size_t &frame_length);
  24. int dupesReceived();
  25. int write(uint8_t frame[], size_t frame_length);
  26. int resend();
  27. private:
  28. AbstractPL1167 &_pl1167;
  29. const MiLightRadioConfig& config;
  30. uint32_t _prev_packet_id;
  31. uint8_t _packet[8], _out_packet[8];
  32. bool _waiting;
  33. int _dupes_received;
  34. };
  35. #endif /* MILIGHTRADIO_H_ */