common

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Enabled  = StatusType("enabled")
	Disabled = StatusType("disabled")
)
View Source
const (
	DevTypeModBusRtu = DeviceType("modbus_rtu")
	DevTypeModBusTcp = DeviceType("modbus_tcp")
	DevTypeDefault   = DeviceType("default")
	DevTypeCommand   = DeviceType("command")
)
View Source
const (
	ThreadOk          = ThreadState("ok")
	ThreadBusy        = ThreadState("busy")
	ThreadDevNotFound = ThreadState("port by device not found")
	ThreadNotFound    = ThreadState("port not found")
	ThreadAllBusy     = ThreadState("all ports busy")
)
View Source
const (
	StatusEnabled  = ClientStatus("enabled")
	StatusDisabled = ClientStatus("disabled")
	StatusError    = ClientStatus("error")
	StatusBusy     = ClientStatus("busy")
)

Variables

This section is empty.

Functions

func Start added in v0.1.0

func Start(app *fx.App)

Start ...

func Stop added in v0.1.0

func Stop(app *fx.App)

Stop ...

func Work added in v0.1.0

func Work()

Work ...

Types

type ClientStatus

type ClientStatus string

type ClientStatusModel

type ClientStatusModel struct {
	Status    ClientStatus `json:"status"`
	Thread    int          `json:"thread"`
	Rps       int64        `json:"rps"`
	Min       int64        `json:"min"`
	Max       int64        `json:"max"`
	Latency   int64        `json:"latency"`
	StartedAt time.Time    `json:"started_at"`
}

type DeviceType

type DeviceType string

type MessageRequest

type MessageRequest struct {
	EntityId   string          `json:"entity_id"`
	DeviceType DeviceType      `json:"device_type"`
	Properties json.RawMessage `json:"properties" valid:"Required"`
	Command    json.RawMessage `json:"command"`
}

type MessageResponse

type MessageResponse struct {
	EntityId   string          `json:"entity_id"`
	DeviceType DeviceType      `json:"device_type"`
	Properties json.RawMessage `json:"properties"`
	Response   json.RawMessage `json:"response"`
	Status     string          `json:"status"`
}

type StatusType

type StatusType string

type Thread

type Thread interface {
	//DEPRECATED
	SetParams(baud, timeout, stopBits int) (err error)
	//DEPRECATED
	Open() (err error)
	//DEPRECATED
	Close()
	Restart()
	GetSerial() *serial.Serial
	Device() string
	SetErr()
	SetCon(conn interface{})
	GetCon() interface{}
}

type ThreadCaller

type ThreadCaller interface {
	Exec(t Thread) (resp *MessageResponse, err error)
	Send(entityId string, data interface{})
	EntityId() string
}

type ThreadState

type ThreadState string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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