19 #include <uuid/modbus.h>
33 const std::shared_ptr<Response> &response)
34 : device_(device), function_code_(function_code), timeout_ms_(timeout_ms),
45 if (actual != expected) {
46 logger.
err(F(
"Length mismatch for function %02X from device %u, expected %u received %u"),
47 frame[1], frame[0], expected, actual);
std::array< uint8_t, MAX_MESSAGE_SIZE+1 > frame_buffer_t
void err(const char *format,...) const
Log a message at level Level::ERR.
virtual uint16_t encode(frame_buffer_t &frame)
Encode this request and store it in a message frame buffer.
uint16_t device() const
Get the destination device address.
const uuid::log::Logger logger
Request(uint16_t device, uint8_t function_code, uint16_t timeout_ms, const std::shared_ptr< Response > &response)
Create a new request message (not directly useful).
bool check_length(frame_buffer_t &frame, uint16_t actual, uint16_t expected)
Check the length of the message frame is correct and log an error if it is not.
uint8_t function_code() const
Get the function code of the request.