Documentation ¶
Overview ¶
Provides helpers for interacting with modbus devices.
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) ReadFloat32(address uint16) (float32, error)
- func (c *Client) ReadFloat64(address uint16) (float64, error)
- func (c *Client) ReadInt16(address uint16) (int16, error)
- func (c *Client) ReadInt32(address uint16) (int32, error)
- func (c *Client) ReadInt64(address uint16) (int64, error)
- func (c *Client) ReadInto(address uint16, v interface{}) error
- func (c *Client) ReadString(address, words uint16) (string, error)
- func (c *Client) ReadUint16(address uint16) (uint16, error)
- func (c *Client) ReadUint32(address uint16) (uint32, error)
- func (c *Client) ReadUint64(address uint16) (uint64, error)
- func (c *Client) SetSlaveID(id byte)
- type Mockbus
- func (m *Mockbus) AddHoldingRegisterEntries(entries map[uint16]interface{}) error
- func (m *Mockbus) AddHoldingRegisterEntry(addr uint16, data interface{}) error
- func (m *Mockbus) ReadHoldingRegisters(address, quantity uint16) ([]byte, error)
- func (m *Mockbus) ReadHoldingRegistersUint(address, quantity uint16) ([]uint16, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a modbus connection.
When the connection is unresponsive, the client will attempt to reconnect.
func (*Client) SetSlaveID ¶
SetSlaveID sets the slave id (device address) of following modbus requests.
type Mockbus ¶
type Mockbus struct {
// contains filtered or unexported fields
}
func NewMockbus ¶
NewMockbus creates a new mockbus instance.
The parameter specifies the number of registers that can be used starting from 0.
func (*Mockbus) AddHoldingRegisterEntries ¶
func (*Mockbus) AddHoldingRegisterEntry ¶
func (*Mockbus) ReadHoldingRegisters ¶
Click to show internal directories.
Click to hide internal directories.