NbusCommunicator.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * @file NbusCommunicator.h
  3. * @brief Declaration of hardware communication interface.
  4. * @date Jun 23, 2026
  5. * @author Juraj Dudak, Matus Necas
  6. */
  7. #ifndef SRC_NBUSCOMMUNICATOR_H_
  8. #define SRC_NBUSCOMMUNICATOR_H_
  9. #include "inttypes.h"
  10. #include "dataframe.h"
  11. #include "nbus_config.h"
  12. #include "nbus_defines.h"
  13. /** @brief Interface for NBus Communicator handle.
  14. */
  15. class NbusCommunicator
  16. {
  17. public:
  18. /** Send data to master.
  19. * @param master_frame: data frame to send
  20. */
  21. virtual void sendToMaster(DataFrame *master_frame) = 0;
  22. /** Receive packet from master
  23. * @return received data frame
  24. */
  25. virtual DataFrame* receiveFromMaster() = 0;
  26. /** Send data to slave.
  27. * @param slave_frame: data frame to send
  28. */
  29. virtual void sendToSlave(DataFrame *slave_frame) = 0;
  30. /** Receive data from slave.
  31. * @return received data frame
  32. */
  33. virtual DataFrame* receiveFromSlave() = 0;
  34. /** Set onboard LED to ON-state.
  35. */
  36. virtual void setLedOn() = 0;
  37. /** Set onboard LED to OFF-state.
  38. */
  39. virtual void setLedOff() = 0;
  40. /** Change onboard LED state.
  41. */
  42. virtual void toggleLed() = 0;
  43. /** Get actual elapsed time in ms
  44. * @return time in ms
  45. */
  46. virtual uint32_t getTime() = 0;
  47. /** Send data to slave and receive response.
  48. * @param slave_frame: data frame to send
  49. * @return: response data frame
  50. */
  51. virtual DataFrame* sendAndReceiveSlave(DataFrame *slave_frame) = 0;
  52. };
  53. #endif /* SRC_NBUSCOMMUNICATOR_H_ */