1#ifndef LIGHTMODBUS_DEBUG_IMPL_H
2#define LIGHTMODBUS_DEBUG_IMPL_H
15#define ESTR(x) [(int)(x)] = #x
21#define ECASE(x) case (int)(x): return #x; break;
44 default:
return "[invalid ModbusError]";
60 default:
return "[invalid ModbusErrorInfo source]";
79 default:
return "[invalid ModbusExceptionCode]";
95 default:
return "[invalid ModbusDataType]";
111 default:
return "[invalid ModbusRegisterQuery]";
ModbusExceptionCode
Represents a Modbus exception code.
Definition base.h:230
@ MODBUS_EXCEP_ILLEGAL_ADDRESS
Illegal data address.
Definition base.h:233
@ MODBUS_EXCEP_ACK
Acknowledge.
Definition base.h:236
@ MODBUS_EXCEP_NONE
Definition base.h:231
@ MODBUS_EXCEP_NACK
Negative acknowledge.
Definition base.h:237
@ MODBUS_EXCEP_SLAVE_FAILURE
Slave could not process the request.
Definition base.h:235
@ MODBUS_EXCEP_ILLEGAL_FUNCTION
Illegal function code.
Definition base.h:232
@ MODBUS_EXCEP_ILLEGAL_VALUE
Illegal data value.
Definition base.h:234
ModbusDataType
Represents different Modbus data types.
Definition base.h:244
@ MODBUS_DISCRETE_INPUT
Discrete input.
Definition base.h:248
@ MODBUS_HOLDING_REGISTER
Holding register.
Definition base.h:245
@ MODBUS_INPUT_REGISTER
Input register.
Definition base.h:246
@ MODBUS_COIL
Coil.
Definition base.h:247
ModbusError
Represtents different kinds of errors.
Definition base.h:137
@ MODBUS_ERROR_FUNCTION
Invalid function.
Definition base.h:168
@ MODBUS_ERROR_RANGE
Invalid register range.
Definition base.h:193
@ MODBUS_ERROR_VALUE
Invalid register value.
Definition base.h:185
@ MODBUS_ERROR_LENGTH
Invalid frame length.
Definition base.h:156
@ MODBUS_ERROR_CRC
CRC invalid.
Definition base.h:199
@ MODBUS_ERROR_BAD_TRANSACTION
Mismatched transaction ID.
Definition base.h:213
@ MODBUS_ERROR_ALLOC
Memory allocation error.
Definition base.h:163
@ MODBUS_ERROR_BAD_PROTOCOL
Invalid protocol ID (nonzero)
Definition base.h:205
@ MODBUS_ERROR_OTHER
Other error.
Definition base.h:223
@ MODBUS_ERROR_COUNT
Invalid register count.
Definition base.h:175
@ MODBUS_ERROR_ADDRESS
Invalid slave address.
Definition base.h:218
@ MODBUS_ERROR_INDEX
Invalid index value.
Definition base.h:180
@ MODBUS_OK
No error.
Definition base.h:143
#define MODBUS_ERROR_SOURCE_REQUEST
The request frame contains errors.
Definition base.h:62
#define MODBUS_ERROR_SOURCE_RESPONSE
The response frame contains errors.
Definition base.h:68
#define MODBUS_ERROR_SOURCE_GENERAL
General library error - can be caused by providing an incorrect argument or a internal library error.
Definition base.h:56
#define MODBUS_ERROR_SOURCE_RESERVED
Reserved for future use.
Definition base.h:74
const char * modbusRegisterQueryStr(ModbusRegisterQuery query)
Returns a string containing the name of the ModbusRegisterQuery enum value.
Definition debug.impl.h:102
#define ECASE(x)
Defines a case halding enum value, returning the name of the enum value.
Definition debug.impl.h:21
const char * modbusErrorStr(ModbusError err)
Returns a string containing the name of the ModbusError value.
Definition debug.impl.h:26
const char * modbusErrorSourceStr(uint8_t src)
Returns a string containing the name error source.
Definition debug.impl.h:51
const char * modbusDataTypeStr(ModbusDataType type)
Returns a string containing the name of the ModbusDataType enum value.
Definition debug.impl.h:86
const char * modbusExceptionCodeStr(ModbusExceptionCode code)
Returns a string containing the name of the ModbusExceptionCode enum value.
Definition debug.impl.h:67
ModbusRegisterQuery
Determines type of request made to the register callback function.
Definition slave.h:37
@ MODBUS_REGQ_W_CHECK
Request for write access.
Definition slave.h:39
@ MODBUS_REGQ_W
Write request.
Definition slave.h:41
@ MODBUS_REGQ_R_CHECK
Request for read access.
Definition slave.h:38
@ MODBUS_REGQ_R
Read request.
Definition slave.h:40