MCPcopy Create free account
hub / github.com/dalathegreat/Battery-Emulator / getError

Method getError

Software/src/lib/eModbus-eModbus/ModbusMessage.cpp:122–134  ·  view source on GitHub ↗

getError() - returns error code

Source from the content-addressed store, hash-verified

120
121// getError() - returns error code
122Error ModbusMessage::getError() const {
123 // Do we have data long enough?
124 if (MM_data.size() > 2) {
125 // Yes. Does it indicate an error?
126 if (MM_data[1] & 0x80)
127 {
128 // Yes. Get it.
129 return static_cast<Modbus::Error>(MM_data[2]);
130 }
131 }
132 // Default: everything OK - SUCCESS
133 return SUCCESS;
134}
135
136// Modbus data manipulation
137void ModbusMessage::setServerID(uint8_t serverID) {

Callers 2

localRequestMethod · 0.80
serveMethod · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected