NbusBridge.h 875 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * @file NbusBridge.h
  3. * @brief Deklarácia modulu nBus Brige
  4. * @date Mar 7, 2025
  5. * @author Juraj Dudak
  6. */
  7. #ifndef SRC_NBUSBRIDGE_H_
  8. #define SRC_NBUSBRIDGE_H_
  9. #include "NbusSlave.h"
  10. /* DEFINES BEGIN */
  11. #define MAX_SLAVES 16
  12. #define MODULE_ADDRESS(packet) packet[0]
  13. #define SENSOR_ADDRESS(packet) packet[1]
  14. #define FUNCTION_CODE(packet) packet[2]
  15. /* DEFINES END */
  16. class NbusBridge {
  17. private:
  18. NbusCommunicator *_communicator;
  19. NbusSlave _slaves[MAX_SLAVES];
  20. uint8_t _num_slaves;
  21. void transmit(DataFrame *packet);
  22. DataFrame *_frame_nbus_internal;
  23. public:
  24. NbusBridge(NbusCommunicator *);
  25. virtual ~NbusBridge();
  26. void scan();
  27. uint8_t getNumSlaves();
  28. bool call_echo(uint8_t slave);
  29. NbusSlave * getSlave(uint8_t index);
  30. void sendResponseToMaster(DataFrame *response_frame);
  31. void processRequest(uint8_t *rxFrame);
  32. };
  33. #endif /* SRC_NBUSBRIDGE_H_ */