My Project
Public Member Functions | Protected Attributes | List of all members
uuid::modbus::RegisterDataResponse Class Reference

Register data response message. More...

#include <uuid/modbus.h>

Inheritance diagram for uuid::modbus::RegisterDataResponse:
Inheritance graph
[legend]
Collaboration diagram for uuid::modbus::RegisterDataResponse:
Collaboration graph
[legend]

Public Member Functions

const std::vector< uint16_t > & data () const
 Data from the device response, which may be fewer or more register values than requested. More...
 
ResponseStatus parse (frame_buffer_t &frame, uint16_t len) override
 Parse a message frame buffer and store the outcome in this response. More...
 
- Public Member Functions inherited from uuid::modbus::Response
bool done () const
 Determine if the request is complete. More...
 
bool pending () const
 Determine if the request is still pending. More...
 
bool success () const
 Determine if the request was successful. More...
 
bool exception () const
 Determine if the request returned an exception. More...
 
bool failed () const
 Determine if the request failed for a reason other than an exception. More...
 
ResponseStatus status () const
 Get the status of the response message. More...
 
void status (ResponseStatus status)
 Set the status of the response message. More...
 
uint8_t exception_code () const
 Get the exception code from the device response. More...
 
void exception_code (uint8_t exception_code)
 Set the exception code from the device response. More...
 

Protected Attributes

std::vector< uint16_t > data_
 

Additional Inherited Members

- Protected Member Functions inherited from uuid::modbus::Response
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. More...
 

Detailed Description

Register data response message.

This will be created when a request is submitted and then later updated with the outcome. Poll the status() of the response to know when to access data.

Since
0.1.0

Definition at line 245 of file modbus.h.

Member Function Documentation

◆ data()

const std::vector<uint16_t>& uuid::modbus::RegisterDataResponse::data ( ) const
inline

Data from the device response, which may be fewer or more register values than requested.

Valid only if the status() is ResponseStatus::SUCCESS.

Returns
A reference to the data in the response.
Since
0.1.0

Definition at line 256 of file modbus.h.

◆ parse()

ResponseStatus uuid::modbus::RegisterDataResponse::parse ( frame_buffer_t frame,
uint16_t  len 
)
overridevirtual

Parse a message frame buffer and store the outcome in this response.

Parameters
[in]frameMessage frame buffer.
[in]lenSize of message frame.
Returns
The status result of message parsing.
Since
0.1.0

Implements uuid::modbus::Response.

Reimplemented in uuid::modbus::RegisterWriteResponse.

Definition at line 116 of file register_functions.cpp.

Member Data Documentation

◆ data_

std::vector<uint16_t> uuid::modbus::RegisterDataResponse::data_
protected

Data from device response.

Since
0.1.0

Definition at line 269 of file modbus.h.


The documentation for this class was generated from the following files: