types

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bit added in v0.1.5

type Bit struct {
	Name string `json:"name"` //名称
	Bit  int    `json:"bit"`  //偏移
}

type Device

type Device struct {
	Id          string    `json:"id,omitempty" xorm:"pk"`
	ProductId   string    `json:"product_id" xorm:"index"`
	Name        string    `json:"name,omitempty"`
	Description string    `json:"description,omitempty"`
	Disabled    bool      `json:"disabled,omitempty"` //禁用
	Created     time.Time `json:"created,omitempty" xorm:"created"`
}

type Point added in v0.1.5

type Point interface {
	Encode(data any) ([]byte, error)
	Parse(address uint16, buf []byte) (any, error)
}

type PointBit added in v0.1.5

type PointBit struct {
	Name    string `json:"name"`    //名称
	Address uint16 `json:"address"` //偏移
}

func (*PointBit) Encode added in v0.1.5

func (p *PointBit) Encode(data any) ([]byte, error)

func (*PointBit) Parse added in v0.1.5

func (p *PointBit) Parse(address uint16, buf []byte) (any, error)

type PointWord added in v0.1.5

type PointWord struct {
	Name      string  `json:"name"`              //名称
	Type      string  `json:"type"`              //类型
	Address   uint16  `json:"address"`           //偏移
	BigEndian bool    `json:"be,omitempty"`      //大端模式
	Rate      float64 `json:"rate,omitempty"`    //倍率
	Correct   float64 `json:"correct,omitempty"` //纠正
	Bits      []*Bit  `json:"bits,omitempty"`    //位,1 2 3...
}

func (*PointWord) Encode added in v0.1.5

func (p *PointWord) Encode(data any) ([]byte, error)

func (*PointWord) Parse added in v0.1.5

func (p *PointWord) Parse(address uint16, buf []byte) (any, error)

func (*PointWord) Size added in v0.1.5

func (p *PointWord) Size() int

type Product

type Product struct {
	Id          string    `json:"id,omitempty" xorm:"pk"`
	Name        string    `json:"name,omitempty"`
	Description string    `json:"description,omitempty"`
	Type        string    `json:"type,omitempty"` //类型
	Version     string    `json:"version,omitempty"`
	Disabled    bool      `json:"disabled,omitempty"` //禁用
	Created     time.Time `json:"created,omitempty" xorm:"created"`
}

type ProductConfig

type ProductConfig struct {
	Id      string    `json:"id,omitempty" xorm:"pk"`
	Name    string    `json:"name" xorm:"pk"` //双主键
	Content string    `json:"content,omitempty" xorm:"text"`
	Created time.Time `json:"created,omitempty" xorm:"created"`
}

type Property

type Property struct {
	Name      string `json:"name,omitempty"`  //变量名称
	Label     string `json:"label,omitempty"` //显示名称
	Unit      string `json:"unit,omitempty"`  //单位
	Type      string `json:"type,omitempty"`  //bool string number array object
	Precision uint8  `json:"precision,omitempty"`
	Default   any    `json:"default,omitempty"`  //默认值
	Writable  bool   `json:"writable,omitempty"` //是否可写
	History   bool   `json:"history,omitempty"`  //是否保存历史
}

Property 属性

Jump to

Keyboard shortcuts

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