device

package
v4.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOnlineCount

func GetOnlineCount() int64

func Load

func Load(id string) error

func Set added in v4.0.18

func Set(id string, dev *Device)

func Shutdown added in v4.1.0

func Shutdown() error

func Startup added in v4.1.0

func Startup() error

func SubscribePropertyStrict added in v4.0.13

func SubscribePropertyStrict() error

Types

type Device

type Device struct {
	Id string `json:"id" xorm:"pk"` //ClientID

	ProductId string `json:"product_id,omitempty" xorm:"index"`
	Product   string `json:"product,omitempty" xorm:"<-"`

	ProjectId string `json:"project_id,omitempty" xorm:"index"`
	Project   string `json:"project,omitempty" xorm:"<-"`

	Name        string         `json:"name"`
	Description string         `json:"description,omitempty"`
	Parameters  map[string]any `json:"parameters,omitempty" xorm:"json"` //模型参数,用于报警检查
	Disabled    bool           `json:"disabled,omitempty"`
	Created     time.Time      `json:"created,omitempty" xorm:"created"`

	Online bool `json:"online,omitempty" xorm:"-"`

	//通道ID
	TunnelId string         `json:"tunnel_id,omitempty" xorm:"index"`
	Station  map[string]any `json:"station,omitempty" xorm:"json"` //通道参数 保存从站号等
	// contains filtered or unexported fields
}

func Ensure

func Ensure(id string) (*Device, error)

func Get

func Get(id string) *Device

func (*Device) Push

func (d *Device) Push(values map[string]any)

func (*Device) SetAdapter added in v4.1.2

func (d *Device) SetAdapter(adapter protocol.Adapter)

func (*Device) UnWatch added in v4.0.18

func (d *Device) UnWatch(handler int)

func (*Device) Values

func (d *Device) Values() map[string]any

func (*Device) Watch added in v4.0.18

func (d *Device) Watch(fn func(map[string]any)) int

func (*Device) Write added in v4.1.2

func (d *Device) Write(point string, value any) error

func (*Device) WriteMany added in v4.0.18

func (d *Device) WriteMany(values map[string]any) error

type DeviceEvent added in v4.0.18

type DeviceEvent struct {
	Id       int64          `json:"id"`
	DeviceId string         `json:"device_id" xorm:"index"`
	Name     string         `json:"name"`
	Label    string         `json:"label"`
	Output   map[string]any `json:"output" xorm:"json"`
	Created  time.Time      `json:"created" xorm:"created"`
}

Jump to

Keyboard shortcuts

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