Documentation
¶
Index ¶
- type OptionDelegate
- type OptionFunc
- func WithSerialBaudRate(baudRate uint) OptionFunc
- func WithSerialDataBits(dataBits uint) OptionFunc
- func WithSerialParityMode(ParityMode ParityMode) OptionFunc
- func WithSerialPortName(portName string) OptionFunc
- func WithSerialRs485Enable(enable bool) OptionFunc
- func WithSerialStopBits(stopBits uint) OptionFunc
- func WithTcpClientReadTimeout(timeout time.Duration) OptionFunc
- func WithTcpClientTargetAddr(targetAddr string) OptionFunc
- func WithTcpClientWriteTimeout(timeout time.Duration) OptionFunc
- func WithTcpServerListenAddr(listenAddr string) OptionFunc
- func WithUdpClientConnectTimeout(timeout time.Duration) OptionFunc
- func WithUdpClientTargetAddr(targetAddr string) OptionFunc
- type OptionType
- type ParityMode
- type SerialOption
- func (o *SerialOption) Close() error
- func (o *SerialOption) Connect() (*delegate.ReadWriteCloser, error)
- func (o *SerialOption) GetNcs() string
- func (o *SerialOption) SetBaudRate(baudRate uint) error
- func (o *SerialOption) SetDataBits(dataBits uint) error
- func (o *SerialOption) SetParityMode(parityMode ParityMode) error
- func (o *SerialOption) SetPortName(portName string) error
- func (o *SerialOption) SetRs485Enable(enable bool)
- func (o *SerialOption) SetStopBits(stopBits uint) error
- type TcpClientOption
- func (o *TcpClientOption) Close() error
- func (o *TcpClientOption) Connect() (*delegate.ReadWriteCloser, error)
- func (o *TcpClientOption) GetNcs() string
- func (o *TcpClientOption) SetConnectionTimeout(timeout time.Duration) error
- func (o *TcpClientOption) SetReadTimeout(timeout time.Duration) error
- func (o *TcpClientOption) SetTargetAddr(targetAddr string) error
- func (o *TcpClientOption) SetWriteTimeout(timeout time.Duration) error
- type TcpServerOption
- type UdpClientOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OptionDelegate ¶
type OptionDelegate interface { Connect() (*delegate.ReadWriteCloser, error) GetNcs() string Close() error }
func GetDefaultSerialOption ¶
func GetDefaultSerialOption() OptionDelegate
func GetDefaultTcpClientOption ¶
func GetDefaultTcpClientOption() OptionDelegate
func GetDefaultTcpServerOption ¶
func GetDefaultTcpServerOption() OptionDelegate
func GetDefaultUdpClientOption ¶
func GetDefaultUdpClientOption() OptionDelegate
type OptionFunc ¶
type OptionFunc func(OptionDelegate) error
func WithSerialBaudRate ¶
func WithSerialBaudRate(baudRate uint) OptionFunc
func WithSerialDataBits ¶
func WithSerialDataBits(dataBits uint) OptionFunc
func WithSerialParityMode ¶
func WithSerialParityMode(ParityMode ParityMode) OptionFunc
func WithSerialPortName ¶
func WithSerialPortName(portName string) OptionFunc
func WithSerialRs485Enable ¶
func WithSerialRs485Enable(enable bool) OptionFunc
func WithSerialStopBits ¶
func WithSerialStopBits(stopBits uint) OptionFunc
func WithTcpClientReadTimeout ¶
func WithTcpClientReadTimeout(timeout time.Duration) OptionFunc
func WithTcpClientTargetAddr ¶
func WithTcpClientTargetAddr(targetAddr string) OptionFunc
func WithTcpClientWriteTimeout ¶
func WithTcpClientWriteTimeout(timeout time.Duration) OptionFunc
func WithTcpServerListenAddr ¶
func WithTcpServerListenAddr(listenAddr string) OptionFunc
func WithUdpClientConnectTimeout ¶
func WithUdpClientConnectTimeout(timeout time.Duration) OptionFunc
func WithUdpClientTargetAddr ¶
func WithUdpClientTargetAddr(targetAddr string) OptionFunc
type OptionType ¶
type OptionType uint8
const ( OptionType_Serial OptionType = iota + 1 OptionType_UDPClient OptionType_TCPServer OptionType_TcpClient )
func (OptionType) String ¶
func (i OptionType) String() string
type ParityMode ¶
type ParityMode string
ParityMode Valid parity values.
const ( PARITY_NONE ParityMode = "N" PARITY_ODD ParityMode = "O" PARITY_EVEN ParityMode = "E" )
type SerialOption ¶
type SerialOption struct {
serial.OpenOptions
}
SerialOption is the struct containing all of the options necessary for opening a serial port.
func (*SerialOption) Close ¶
func (o *SerialOption) Close() error
func (*SerialOption) Connect ¶
func (o *SerialOption) Connect() (*delegate.ReadWriteCloser, error)
func (*SerialOption) GetNcs ¶
func (o *SerialOption) GetNcs() string
func (*SerialOption) SetBaudRate ¶
func (o *SerialOption) SetBaudRate(baudRate uint) error
func (*SerialOption) SetDataBits ¶
func (o *SerialOption) SetDataBits(dataBits uint) error
func (*SerialOption) SetParityMode ¶
func (o *SerialOption) SetParityMode(parityMode ParityMode) error
func (*SerialOption) SetPortName ¶
func (o *SerialOption) SetPortName(portName string) error
func (*SerialOption) SetRs485Enable ¶
func (o *SerialOption) SetRs485Enable(enable bool)
func (*SerialOption) SetStopBits ¶
func (o *SerialOption) SetStopBits(stopBits uint) error
type TcpClientOption ¶
type TcpClientOption struct {
// contains filtered or unexported fields
}
func (*TcpClientOption) Close ¶
func (o *TcpClientOption) Close() error
func (*TcpClientOption) Connect ¶
func (o *TcpClientOption) Connect() (*delegate.ReadWriteCloser, error)
func (*TcpClientOption) GetNcs ¶
func (o *TcpClientOption) GetNcs() string
func (*TcpClientOption) SetConnectionTimeout ¶
func (o *TcpClientOption) SetConnectionTimeout(timeout time.Duration) error
SetConnectionTimeout 连接建立后设置不生效
func (*TcpClientOption) SetReadTimeout ¶
func (o *TcpClientOption) SetReadTimeout(timeout time.Duration) error
func (*TcpClientOption) SetTargetAddr ¶
func (o *TcpClientOption) SetTargetAddr(targetAddr string) error
SetTargetAddr 连接建立后设置不生效
func (*TcpClientOption) SetWriteTimeout ¶
func (o *TcpClientOption) SetWriteTimeout(timeout time.Duration) error
type TcpServerOption ¶
type TcpServerOption struct {
// contains filtered or unexported fields
}
TcpServerOption is the struct containing all of the options necessary for listening udp connection.
func (*TcpServerOption) Close ¶
func (o *TcpServerOption) Close() error
func (*TcpServerOption) Connect ¶
func (o *TcpServerOption) Connect() (*delegate.ReadWriteCloser, error)
func (*TcpServerOption) GetNcs ¶
func (o *TcpServerOption) GetNcs() string
func (*TcpServerOption) SetListenAddr ¶
func (o *TcpServerOption) SetListenAddr(laddr string) error
type UdpClientOption ¶
type UdpClientOption struct {
// contains filtered or unexported fields
}
UdpClientOption is the struct containing all of the options necessary for opening udp connection.
func (*UdpClientOption) Close ¶
func (o *UdpClientOption) Close() error
func (*UdpClientOption) Connect ¶
func (o *UdpClientOption) Connect() (*delegate.ReadWriteCloser, error)
func (*UdpClientOption) GetNcs ¶
func (o *UdpClientOption) GetNcs() string
func (*UdpClientOption) SetConnectTimeout ¶
func (o *UdpClientOption) SetConnectTimeout(timeout time.Duration) error
func (*UdpClientOption) SetTargetAddr ¶
func (o *UdpClientOption) SetTargetAddr(targetAddr string) error
Click to show internal directories.
Click to hide internal directories.