cmdModbus

package
v0.0.0-...-391253a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2023 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeSigned8Bit  = "S8"
	TypeSigned16Bit = "S16"
	TypeSigned32Bit = "S32"
	TypeSigned64Bit = "S64"

	TypeUnsigned8Bit  = "U8"
	TypeUnsigned16Bit = "U16"
	TypeUnsigned32Bit = "U32"
	TypeUnsigned64Bit = "U64"

	TypeFloat32Bit = "F32"
	TypeFloat64Bit = "F64"

	TypeString = "UTF-8"
)
View Source
const (
	DefaultPort = "502"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address uint16

func StringToAddress

func StringToAddress(address string) (Address, error)

type Boolean

type Boolean struct {
	// contains filtered or unexported fields
}

func (Boolean) String

func (m Boolean) String() string

func (Boolean) Table

func (m Boolean) Table(width int) string

type Byte

type Byte struct {
	// contains filtered or unexported fields
}

func (Byte) String

func (m Byte) String() string

func (*Byte) Table

func (m *Byte) Table(width int) string

type Float32

type Float32 struct {
	// contains filtered or unexported fields
}

func (Float32) String

func (m Float32) String() string

func (Float32) Table

func (m Float32) Table(width int) string

type Float64

type Float64 struct {
	// contains filtered or unexported fields
}

func (Float64) String

func (m Float64) String() string

func (Float64) Table

func (m Float64) Table(width int) string

type Modbus

type Modbus struct {
	ClientId   string        `json:"client_id"`
	Username   string        `json:"username"`
	Password   string        `json:"password"`
	Host       string        `json:"host"`
	Port       string        `json:"port"`
	Timeout    time.Duration `json:"timeout"`
	ServerCert string        `json:"server_cert"`
	ClientCert string        `json:"client_cert"`
	ClientKey  string        `json:"client_key"`
	LogLevel   string        `json:"log_level"`
	// contains filtered or unexported fields
}

func New

func New(req Modbus) Modbus

func (*Modbus) Connect

func (m *Modbus) Connect() error

func (*Modbus) Disconnect

func (m *Modbus) Disconnect() error

func (*Modbus) GetError

func (m *Modbus) GetError() error

func (*Modbus) IsError

func (m *Modbus) IsError() bool

func (*Modbus) Read

func (m *Modbus) Read(address Address, quantity Quantity, valueType string) string

func (*Modbus) Read16Bit

func (m *Modbus) Read16Bit(address Address, quantity Quantity, regType modbus.RegType) U16Bit

func (*Modbus) Read16BitHolding

func (m *Modbus) Read16BitHolding(address Address, quantity Quantity) U16Bit

func (*Modbus) Read16BitInput

func (m *Modbus) Read16BitInput(address Address, quantity Quantity) U16Bit

func (*Modbus) Read32Bit

func (m *Modbus) Read32Bit(address Address, quantity Quantity, regType modbus.RegType) U32Bit

func (*Modbus) Read32BitHolding

func (m *Modbus) Read32BitHolding(address Address, quantity Quantity) U32Bit

func (*Modbus) Read32BitInput

func (m *Modbus) Read32BitInput(address Address, quantity Quantity) U32Bit

func (*Modbus) Read64Bit

func (m *Modbus) Read64Bit(address Address, quantity Quantity, regType modbus.RegType) U64Bit

func (*Modbus) Read64BitHolding

func (m *Modbus) Read64BitHolding(address Address, quantity Quantity) U64Bit

func (*Modbus) Read64BitInput

func (m *Modbus) Read64BitInput(address Address, quantity Quantity) U64Bit

func (*Modbus) ReadBool

func (m *Modbus) ReadBool(address Address, quantity Quantity) Boolean

func (*Modbus) ReadByte

func (m *Modbus) ReadByte(address Address, quantity Quantity, regType modbus.RegType) Byte

func (*Modbus) ReadByteHolding

func (m *Modbus) ReadByteHolding(address Address, quantity Quantity) Byte

func (*Modbus) ReadByteInput

func (m *Modbus) ReadByteInput(address Address, quantity Quantity) Byte

func (*Modbus) ReadDiscreteInput

func (m *Modbus) ReadDiscreteInput(address Address, quantity Quantity) Boolean

func (*Modbus) ReadFloat32

func (m *Modbus) ReadFloat32(address Address, quantity Quantity, regType modbus.RegType) Float32

func (*Modbus) ReadFloat32Holding

func (m *Modbus) ReadFloat32Holding(address Address, quantity Quantity) Float32

func (*Modbus) ReadFloat32Input

func (m *Modbus) ReadFloat32Input(address Address, quantity Quantity) Float32

func (*Modbus) ReadFloat64

func (m *Modbus) ReadFloat64(address Address, quantity Quantity, regType modbus.RegType) Float64

func (*Modbus) ReadFloat64Holding

func (m *Modbus) ReadFloat64Holding(address Address, quantity Quantity) Float64

func (*Modbus) ReadFloat64Input

func (m *Modbus) ReadFloat64Input(address Address, quantity Quantity) Float64

func (*Modbus) ReadHolding

func (m *Modbus) ReadHolding(address Address, quantity Quantity, valueType string) string

func (*Modbus) SetAuth

func (m *Modbus) SetAuth(username string, password string) error

func (*Modbus) SetBigEndian

func (m *Modbus) SetBigEndian()

func (*Modbus) SetHighWordFirst

func (m *Modbus) SetHighWordFirst()

func (*Modbus) SetLittleEndian

func (m *Modbus) SetLittleEndian()

func (*Modbus) SetLog

func (m *Modbus) SetLog(log cmdLog.Log)

func (*Modbus) SetLowWordFirst

func (m *Modbus) SetLowWordFirst()

type Quantity

type Quantity uint16

func StringToQuantity

func StringToQuantity(quantity string) (Quantity, error)

type U16Bit

type U16Bit struct {
	// contains filtered or unexported fields
}

func (U16Bit) String

func (m U16Bit) String() string

func (U16Bit) Table

func (m U16Bit) Table(width int) string

type U32Bit

type U32Bit struct {
	// contains filtered or unexported fields
}

func (U32Bit) String

func (m U32Bit) String() string

func (U32Bit) Table

func (m U32Bit) Table(width int) string

type U64Bit

type U64Bit struct {
	// contains filtered or unexported fields
}

func (U64Bit) String

func (m U64Bit) String() string

func (U64Bit) Table

func (m U64Bit) Table(width int) string

type Value

type Value uint16

func StringToValue

func StringToValue(value string) (Value, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL