env

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

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

func NewConnector

func NewConnector(logger log.Logger) *Connector

func (*Connector) AddDevice

func (c *Connector) AddDevice(sn, ip string, port int, slaveID uint8,
	quantity uint16, option RegisterOption) error

AddDevice 添加设备 sn 设备唯一编号 ip 气体传感器ip port 其它传感器port quantity 读取的寄存器数量

func (*Connector) Destroy

func (c *Connector) Destroy() error

func (*Connector) GetValChan

func (c *Connector) GetValChan() chan SensorVal

func (*Connector) Initialize

func (c *Connector) Initialize() error

func (*Connector) RemoveDevice

func (c *Connector) RemoveDevice(sn string) error

RemoveDevice 移除气体检测设备

type ModbusReader added in v1.2.1

type ModbusReader interface {
	Read(client *modbus.ModbusClient, d *modbusDevice) ([]float64, error)

	Type() SensorType
}

type RegisterOption added in v1.2.0

type RegisterOption struct {
	ValueAddress    uint16
	AccuracyAddress uint16
	Type            SensorType
}

type SensorType

type SensorType = uint8
const (
	GasType  SensorType = 0x00
	TempType SensorType = 0x10
)

type SensorVal

type SensorVal struct {
	SN   string    `json:"sn"`
	IP   string    `json:"ip"`
	Port int       `json:"port"`
	Val  []float64 `json:"values"`
}

Jump to

Keyboard shortcuts

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