Documentation ¶
Index ¶
- type FlyModbusSlave
- func (s *FlyModbusSlave) BytesToFloat32(b []byte) float32
- func (s *FlyModbusSlave) BytesToFloat64(b []byte) float64
- func (s *FlyModbusSlave) BytesToInt16(b []byte) int16
- func (s *FlyModbusSlave) BytesToInt32(b []byte) int32
- func (s *FlyModbusSlave) BytesToInt64(b []byte) int64
- func (s *FlyModbusSlave) Close()
- func (s *FlyModbusSlave) Float32ToBytes(n float32) []byte
- func (s *FlyModbusSlave) Float64ToBytes(n float64) []byte
- func (s *FlyModbusSlave) GetBytes(addr int, n int) ([]byte, error)
- func (s *FlyModbusSlave) GetFloat32(addr int) (float32, error)
- func (s *FlyModbusSlave) GetFloat64(addr int) (float64, error)
- func (s *FlyModbusSlave) GetInt16(addr int) (int16, error)
- func (s *FlyModbusSlave) GetInt32(addr int) (int32, error)
- func (s *FlyModbusSlave) GetInt64(addr int) (int64, error)
- func (s *FlyModbusSlave) GetName() string
- func (s *FlyModbusSlave) Int16ToBytes(n int16) []byte
- func (s *FlyModbusSlave) Int32ToBytes(n int32) []byte
- func (s *FlyModbusSlave) Int64ToBytes(n int64) []byte
- func (s *FlyModbusSlave) LoadSettings(settings *FlyModbusSlaveSettings)
- func (s *FlyModbusSlave) Open(settings *FlyModbusSlaveSettings) error
- func (s *FlyModbusSlave) SetBytes(addr int, value []byte) error
- func (s *FlyModbusSlave) SetFloat32(addr int, value float32) error
- func (s *FlyModbusSlave) SetFloat64(addr int, value float64) error
- func (s *FlyModbusSlave) SetInt16(addr int, value int16) error
- func (s *FlyModbusSlave) SetInt32(addr int, value int32) error
- func (s *FlyModbusSlave) SetInt64(addr int, value int64) error
- func (s *FlyModbusSlave) Start() error
- func (s *FlyModbusSlave) Stop()
- type FlyModbusSlaveSettings
- type FlyModbusSlaveTrigger
- type FlyModbusSlaveTriggerInt16
- type FlyModbusSlaveTriggerInt32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FlyModbusSlave ¶
type FlyModbusSlave struct { IsRunning bool Settings *FlyModbusSlaveSettings Serv *mbserver.Server Serial *FlySerials.FlySerial }
func NewFlyModbusSlave ¶
func NewFlyModbusSlave() *FlyModbusSlave
func (*FlyModbusSlave) BytesToFloat32 ¶
func (s *FlyModbusSlave) BytesToFloat32(b []byte) float32
func (*FlyModbusSlave) BytesToFloat64 ¶
func (s *FlyModbusSlave) BytesToFloat64(b []byte) float64
func (*FlyModbusSlave) BytesToInt16 ¶
func (s *FlyModbusSlave) BytesToInt16(b []byte) int16
func (*FlyModbusSlave) BytesToInt64 ¶
func (s *FlyModbusSlave) BytesToInt64(b []byte) int64
func (*FlyModbusSlave) Close ¶
func (s *FlyModbusSlave) Close()
func (*FlyModbusSlave) Float32ToBytes ¶
func (s *FlyModbusSlave) Float32ToBytes(n float32) []byte
func (*FlyModbusSlave) Float64ToBytes ¶
func (s *FlyModbusSlave) Float64ToBytes(n float64) []byte
func (*FlyModbusSlave) GetBytes ¶
func (s *FlyModbusSlave) GetBytes(addr int, n int) ([]byte, error)
func (*FlyModbusSlave) GetFloat32 ¶
func (s *FlyModbusSlave) GetFloat32(addr int) (float32, error)
func (*FlyModbusSlave) GetFloat64 ¶
func (s *FlyModbusSlave) GetFloat64(addr int) (float64, error)
func (*FlyModbusSlave) Int16ToBytes ¶
func (s *FlyModbusSlave) Int16ToBytes(n int16) []byte
func (*FlyModbusSlave) Int64ToBytes ¶
func (s *FlyModbusSlave) Int64ToBytes(n int64) []byte
func (*FlyModbusSlave) LoadSettings ¶
func (s *FlyModbusSlave) LoadSettings(settings *FlyModbusSlaveSettings)
func (*FlyModbusSlave) Open ¶
func (s *FlyModbusSlave) Open(settings *FlyModbusSlaveSettings) error
func (*FlyModbusSlave) SetBytes ¶
func (s *FlyModbusSlave) SetBytes(addr int, value []byte) error
if addr+count >= 65535 { return errors.New("overflow") } for i := 0; i < count; i++ { s.Serv.HoldingRegisters[addr+i] = b[i] } return nil }
func (*FlyModbusSlave) SetFloat32 ¶
func (s *FlyModbusSlave) SetFloat32(addr int, value float32) error
func (*FlyModbusSlave) SetFloat64 ¶
func (s *FlyModbusSlave) SetFloat64(addr int, value float64) error
func (*FlyModbusSlave) Stop ¶
func (s *FlyModbusSlave) Stop()
type FlyModbusSlaveSettings ¶
type FlyModbusSlaveSettings struct { Enable bool ConfigType string ConfigKey string Debug bool SlaveID uint EnableTcp bool EnableSerial bool MirrorAddress int TcpAddr string Port string BaudRate uint DataBits uint ParityMode string StopBits uint MinimumReadSize uint InterCharacterTimeout uint Ready bool }
func NewFlyModbusSlaveSettings ¶
func NewFlyModbusSlaveSettings() *FlyModbusSlaveSettings
func (*FlyModbusSlaveSettings) LoadIni ¶
func (s *FlyModbusSlaveSettings) LoadIni(config *FlyConfigFile.FlyIni, key string) error
从ini加载配置信息
type FlyModbusSlaveTrigger ¶
type FlyModbusSlaveTrigger struct { sync.Mutex MB *FlyModbusSlave ListInt16 map[int]*FlyModbusSlaveTriggerInt16 ListInt32 map[int]*FlyModbusSlaveTriggerInt32 // isStart bool // isStop bool Task *FlyTasks.FlyLoopTask }
func NewFlyModbusSlaveTrigger ¶
func NewFlyModbusSlaveTrigger(mb *FlyModbusSlave) *FlyModbusSlaveTrigger
func (*FlyModbusSlaveTrigger) Clean ¶
func (s *FlyModbusSlaveTrigger) Clean()
func (*FlyModbusSlaveTrigger) OnInt16 ¶
func (s *FlyModbusSlaveTrigger) OnInt16(addr int, f func(int16) int16)
func (*FlyModbusSlaveTrigger) OnInt32 ¶
func (s *FlyModbusSlaveTrigger) OnInt32(addr int, f func(int32) int32)
func (*FlyModbusSlaveTrigger) Start ¶
func (s *FlyModbusSlaveTrigger) Start() error
func (*FlyModbusSlaveTrigger) Stop ¶
func (s *FlyModbusSlaveTrigger) Stop() error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.