devices

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevTypeModbusRtu = DeviceType("modbus_rtu")
	DevTypeModbusTcp = DeviceType("modbus_tcp")

	// 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 (
	DevTypeMqtt = DeviceType("mqtt")
)
View Source
const (
	DevTypeSmartBus = DeviceType("smartbus")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseResponse

type BaseResponse struct {
	Error string  `json:"error"`
	Time  float64 `json:"time"`
}

type DevCommandConfig

type DevCommandConfig struct {
	Validation
}

type DevCommandRequest

type DevCommandRequest struct {
	Name string   `json:"name"`
	Args []string `json:"args"`
}

type DevCommandResponse

type DevCommandResponse struct {
	BaseResponse
	Result string `json:"result"`
}

type DevModBusRequest

type DevModBusRequest struct {
	Function string   `json:"function"`
	Address  uint16   `json:"address"`
	Count    uint16   `json:"count"`
	Command  []uint16 `json:"command"`
}

type DevModBusResponse

type DevModBusResponse struct {
	BaseResponse
	Result []uint16 `json:"result"`
}

params: result error time

type DevModBusRtuConfig added in v0.0.19

type DevModBusRtuConfig struct {
	Validation
	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
}

type DevModBusTcpConfig added in v0.0.19

type DevModBusTcpConfig struct {
	Validation
	SlaveId     int    `json:"slave_id" mapstructure:"slave_id"`
	AddressPort string `json:"address_port" mapstructure:"address_port"`
}

type DevMqttConfig added in v0.0.19

type DevMqttConfig struct {
	Validation
	Address  string `json:"address"`
	User     string `json:"user"`
	Password string `json:"password"`
}

type DevMqttRequest added in v0.0.19

type DevMqttRequest struct {
	Topic   string `json:"topic"`
	Payload []byte `json:"payload"`
	Qos     uint8  `json:"qos"`
	Retain  bool   `json:"retain"`
}

type DevSmartBusConfig

type DevSmartBusConfig struct {
	Validation
	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"`
}

type DevSmartBusRequest

type DevSmartBusRequest struct {
	Command []byte `json:"command"`
}

type DevSmartBusResponse

type DevSmartBusResponse struct {
	BaseResponse
	Result []byte `json:"result"`
}

Jump to

Keyboard shortcuts

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