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

Method setError

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

8. Error response generator

Source from the content-addressed store, hash-verified

651
652// 8. Error response generator
653Error ModbusMessage::setError(uint8_t serverID, uint8_t functionCode, Error errorCode) {
654 // No error checking for server ID or function code here, as both may be the cause for the message!?
655 MM_data.reserve(3);
656 MM_data.shrink_to_fit();
657 MM_data.clear();
658 add(serverID, static_cast<uint8_t>((functionCode | 0x80) & 0xFF), static_cast<uint8_t>(errorCode));
659 return SUCCESS;
660}
661
662// Error output in case a message constructor will fail
663void ModbusMessage::printError(const char *file, int lineNo, Error e, uint8_t serverID, uint8_t functionCode) {

Callers 6

localRequestMethod · 0.80
serveMethod · 0.80
FC03Method · 0.80
FC06Method · 0.80
FC16Method · 0.80
FC23Method · 0.80

Calls 3

addFunction · 0.85
reserveMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected