Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,22 @@ var (
GatewayTargetDeviceFailedToRespondError = Error{Code: 11, msg: "gateway target device failed to respond"}
)

// ErrorMap is a map where all the implemented Modbus errors are stored, which
// their ID as the key. This makes is easy to ge the error based on the
// errorcode
var ErrorMap = map[int]Error{
1: IllegalFunctionError,
2: IllegalAddressError,
3: IllegalDataValueError,
4: SlaveDeviceFailureError,
5: AcknowledgeError,
6: SlaveDeviceBusyError,
7: NegativeAcknowledgeError,
8: MemoryParityError,
10: GatewayPathUnavailableError,
11: GatewayTargetDeviceFailedToRespondError,
}

// Value is a value an integer ranging from range of -32768 through 65535.
type Value struct {
v int
Expand Down