Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,10 @@ func (mc *ModbusClient) writeRegisters(addr uint16, values []byte) (err error) {
}

func (mc *ModbusClient) executeRequest(req *pdu) (res *pdu, err error) {
if mc.transport == nil {
err = ErrTransportNotInitialized
return
}
// send the request over the wire, wait for and decode the response
res, err = mc.transport.ExecuteRequest(req)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions modbus.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const (
ErrBadTransactionId Error = "bad transaction id"
ErrUnknownProtocolId Error = "unknown protocol identifier"
ErrUnexpectedParameters Error = "unexpected parameters"
ErrTransportNotInitialized Error = "transport is not initialized"
)

// mapExceptionCodeToError turns a modbus exception code into a higher level Error object.
Expand Down