Documentation
¶
Index ¶
Constants ¶
View Source
const ( DevTypeModbus = DeviceType("modbus") // bit access ReadCoils = "ReadCoils" ReadDiscreteInputs = "ReadDiscreteInputs" WriteSingleCoil = "WriteSingleCoil" WriteMultipleCoils = "WriteMultipleCoils" // 16-bit access ReadInputRegisters = "ReadInputRegisters" ReadHoldingRegisters = "ReadHoldingRegisters" ReadWriteMultipleRegisters = "ReadWriteMultipleRegisters" WriteSingleRegister = "WriteSingleRegister" WriteMultipleRegisters = "WriteMultipleRegisters" )
View Source
const (
DevTypeCommand = DeviceType("command")
)
View Source
const (
DevTypeDefault = DeviceType("default")
)
View Source
const (
DevTypeSmartBus = DeviceType("smartbus")
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseResponse ¶
type DevCommandConfig ¶
type DevCommandConfig struct {
}
func (DevCommandConfig) Valid ¶
func (d DevCommandConfig) Valid() (ok bool, errs []*validation.Error)
type DevCommandRequest ¶
type DevCommandResponse ¶
type DevCommandResponse struct {
BaseResponse
Result string `json:"result"`
}
type DevModBusConfig ¶
type DevModBusConfig struct {
SlaveId int `json:"slave_id" mapstructure:"slave_id"` // 1-32
Baud int `json:"baud"` // 9600, 19200, ...
DataBits int `json:"data_bits" mapstructure:"data_bits"` // 5-9
StopBits int `json:"stop_bits" mapstructure:"stop_bits"` // 1, 2
Parity string `json:"parity"` // none, odd, even
Timeout int `json:"timeout"` // milliseconds
}
func (DevModBusConfig) Valid ¶
func (d DevModBusConfig) Valid() (ok bool, errs []*validation.Error)
type DevModBusRequest ¶
type DevModBusResponse ¶
type DevModBusResponse struct {
BaseResponse
Result []uint16 `json:"result"`
}
params: result error time
type DevSmartBusConfig ¶
type DevSmartBusConfig struct {
Baud int `json:"baud" valid:"Required"`
Device int `json:"device"`
Timeout int `json:"timeout" valid:"Required"`
StopBits int `json:"stop_bits" valid:"Required" mapstructure:"stop_bits"`
Sleep int `json:"sleep"`
}
func (DevSmartBusConfig) Valid ¶
func (d DevSmartBusConfig) Valid() (ok bool, errs []*validation.Error)
type DevSmartBusRequest ¶
type DevSmartBusRequest struct {
Command []byte `json:"command"`
}
type DevSmartBusResponse ¶
type DevSmartBusResponse struct {
BaseResponse
Result []byte `json:"result"`
}
Click to show internal directories.
Click to hide internal directories.