Exception.h
Go to the documentation of this file.
1 
20 #pragma once
21 
22 #include <WString.h>
23 
24 namespace IO
25 {
26 namespace Modbus
27 {
31 enum class Exception {
35  Success = 0x00,
36 
42  IllegalFunction = 0x01,
43 
57  IllegalDataAddress = 0x02,
58 
67  IllegalDataValue = 0x03,
68 
74  SlaveDeviceFailure = 0x04,
75 };
76 
77 inline bool operator!(Exception exception)
78 {
79  return exception == Exception::Success;
80 }
81 
82 String toString(Exception exception);
83 
84 // Modbus function codes
85 #define MODBUS_FUNCTION_MAP(XX) \
86  XX(None, 0x00) \
87  XX(ReadCoils, 0x01) \
88  XX(ReadDiscreteInputs, 0x02) \
89  XX(ReadHoldingRegisters, 0x03) \
90  XX(ReadInputRegisters, 0x04) \
91  XX(WriteSingleCoil, 0x05) \
92  XX(WriteSingleRegister, 0x06) \
93  XX(ReadExceptionStatus, 0x07) \
94  XX(GetComEventCounter, 0x0b) \
95  XX(GetComEventLog, 0x0c) \
96  XX(WriteMultipleCoils, 0x0f) \
97  XX(WriteMultipleRegisters, 0x10) \
98  XX(ReportServerId, 0x11) \
99  XX(MaskWriteRegister, 0x16) \
100  XX(ReadWriteMultipleRegisters, 0x17)
101 
102 } // namespace Modbus
103 } // namespace IO
bool operator!(Exception exception)
Definition: Exception.h:77
Function not allowed/supported/implemented, or device in wrong state to process request.
Protocol slave device failure exception.
Exception
Modbus exception codes returned in response packets.
Definition: Exception.h:31
Definition: IOControl/include/IO/Controller.h:25
The String class.
Definition: WString.h:136
String toString(Exception exception)
No exception, transaction completed normally.