Documentation ¶
Index ¶
- type ChildDeviceMessage
- type ChildDeviceMessageReply
- type Command
- type Common
- type DataPoint
- type DataType
- func (dt *DataType) Decode(buf []byte, le bool, precision int) (val interface{}, err error)
- func (dt *DataType) Default() interface{}
- func (dt *DataType) Encode(value interface{}, le bool, precision int) []byte
- func (dt *DataType) MarshalJSON() ([]byte, error)
- func (dt *DataType) Normalize(val interface{}) interface{}
- func (dt *DataType) Parse(tp string) error
- func (dt *DataType) Size() int
- func (dt *DataType) String() string
- func (dt *DataType) UnmarshalJSON(buf []byte) error
- type DefaultDevice
- type DefaultMessageType
- type DefaultReportFormate
- type DerivedMetadataMessage
- type Device
- type DeviceOfflineMessage
- type DeviceOnlineMessage
- type DeviceRegisterMessage
- type Directive
- type EventMessage
- type FunctionInvokeMessage
- type FunctionInvokeMessageReply
- type FunctionParameter
- type Header
- type HeartBeatPacket
- type Message
- type Point
- type Poller
- type Product
- type Protocol
- type ReadPropertyMessage
- type ReadPropertyMessageReply
- type RegisterPacket
- type ReportPropertyMessage
- type Retry
- type SerialOptions
- type Server
- type Tunnel
- type TunnelEx
- type UpdateTagMessage
- type UpgradeFirmwareMessage
- type UpgradeFirmwareMessageReply
- type UpgradeFirmwareProgressMessage
- type WritePropertyMessage
- type WritePropertyMessageReply
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChildDeviceMessage ¶
type ChildDeviceMessage struct { DeviceKey string Timestamp int64 ChildDeviceKey string ChildDeviceMessage Message }
子设备消息结构体
type ChildDeviceMessageReply ¶
type ChildDeviceMessageReply struct { DeviceKey string MessageId string ChildDeviceKey string ChildDeviceMessage Message }
子设备消息结构体
type Command ¶
type Command struct { Name string `json:"name"` Argument bool `json:"argument"` Directives []Directive `json:"directives"` }
Command 命令
type DataType ¶
type DataType int
DataType 数据类型
func (*DataType) UnmarshalJSON ¶
UnmarshalJSON 解析
type DefaultDevice ¶
type DefaultMessageType ¶
type DefaultMessageType struct { ReturnTime string `json:"return_time"` DataType string `json:"data_type"` DeviceKey string `json:"device_key"` Data map[string]any `json:"data"` }
设备上报的报文解析为平台统一的消息,消息体结构如下
type DefaultReportFormate ¶
type DerivedMetadataMessage ¶
设备元信息相关结构体
type Device ¶
type Device struct { Id uint64 `json:"id"` TunnelId uint64 `json:"tunnel_id" boltholdIndex:"TunnelId"` ProductId string `json:"product_id"` Name string `json:"name"` Station int `json:"station"` Disabled bool `json:"disabled"` Created time.Time `json:"created" xorm:"created"` }
Device 设备
type DeviceOfflineMessage ¶
设备上线下线结构体
type DeviceOnlineMessage ¶
设备上线下线结构体
type DeviceRegisterMessage ¶
type Directive ¶
type Directive struct { Point string `json:"point"` Value float64 `json:"value"` Delay int64 `json:"delay"` //使用表达式 Expression string `json:"expression,omitempty"` }
Directive 指令
type FunctionInvokeMessage ¶
type FunctionInvokeMessage struct { Common FunctionId string Inputs []FunctionParameter }
功能消息结构体
type FunctionInvokeMessageReply ¶
功能消息结构体
type Header ¶
type Header struct { Async bool `json:"async" desc:"是否异步"` Timeout int `json:"timeout" desc:"超时时间,单位为毫秒"` FragMsgId int `json:"fragMsgId" desc:"分片主消息ID,为平台下发消息时的消息ID(messageId"` FragNum int `json:"fragNum" desc:"分片总数"` FragPart int `json:"fragPart" desc:"当前分片索引"` FragLast int `` /* 184-byte string literal not displayed */ KeepOnline int `` /* 144-byte string literal not displayed */ KeepOnlineTimeoutSeconds int `` /* 147-byte string literal not displayed */ IgnoreStorage int `` /* 161-byte string literal not displayed */ IgnoreLog bool `json:"ignoreLog" desc:"不记录此消息的日志。如:设置为true,将不记录此消息的日志。"` MergeLatest bool `` /* 164-byte string literal not displayed */ }
通用的结构体
type HeartBeatPacket ¶
type HeartBeatPacket struct { Enable bool `json:"enable"` Timeout int64 `json:"timeout"` Regex string `json:"regex,omitempty"` Hex string `json:"hex,omitempty"` Text string `json:"text,omitempty"` Length int `json:"length,omitempty"` // contains filtered or unexported fields }
HeartBeatPacket 心跳包
type Point ¶
type Point struct { Name string `json:"name"` Label string `json:"label"` Unit string `json:"unit"` Type DataType `json:"type"` LittleEndian bool `json:"le"` Precision int `json:"precision"` Code string `json:"code"` Address string `json:"address"` Store bool `json:"store"` }
Point 数据点
type Poller ¶
type Poller struct { Disabled bool `json:"disabled,omitempty"` Interval int `json:"interval"` Code string `json:"code"` Address string `json:"address"` Length int `json:"length"` }
Poller 采集器
type Product ¶
type Product struct { Id string `json:"id" xorm:"pk"` Name string `json:"name"` Manufacturer string `json:"manufacturer"` //厂家 Version string `json:"version"` //SEMVER Protocol Protocol `json:"protocol"` Tags []string `json:"tags,omitempty"` Pollers []*Poller `json:"pollers"` Commands []*Command `json:"commands"` Created time.Time `json:"created" xorm:"created"` }
Product 产品
type ReadPropertyMessage ¶
读取属性的消息结构体
type ReadPropertyMessageReply ¶
读取属性的消息结构体
type RegisterPacket ¶
type RegisterPacket struct { Regex string `json:"regex,omitempty"` Length int `json:"length,omitempty"` // contains filtered or unexported fields }
RegisterPacket 注册包
type ReportPropertyMessage ¶
写属性消息结构体
type SerialOptions ¶
type SerialOptions struct { Port string `json:"port"` // /dev/tty.usb.. COM1 BaudRate uint `json:"baud_rate"` //9600 ... 115200 ... DataBits uint `json:"data_bits"` //5 6 7 8 StopBits uint `json:"stop_bits"` //1 2 Parity uint `json:"parity"` // 0:NONE 1:ODD 2:EVEN }
SerialOptions 串口参数
type Server ¶
type Server struct { Id int `json:"id"` Name string `json:"name"` Type string `json:"type"` //tcp udp Addr string `json:"addr"` Register RegisterPacket `json:"register"` Heartbeat HeartBeatPacket `json:"heartbeat"` Options map[string]string `json:"options"` Protocol Protocol `json:"protocol"` Devices []DefaultDevice `json:"devices"` //默认设备 Disabled bool `json:"disabled"` Created time.Time `json:"created" xorm:"created"` }
type Tunnel ¶
type Tunnel struct { Id uint64 `json:"id"` ServerId int `json:"server_id" boltholdIndex:"ServerId"` Name string `json:"name"` SN string `json:"sn" boltholdIndex:"Addr"` Type string `json:"type"` //serial tcp-client tcp-server udp-client udp-server server-tcp server-udp Addr string `json:"addr"` Remote string `json:"remote"` Retry Retry `json:"retry"` //重试 Heartbeat HeartBeatPacket `json:"heartbeat"` // 主要是检查设备的心跳,过滤掉心跳数据 Serial SerialOptions `json:"serial"` // 串口通信配置参数 Protocol Protocol `json:"protocol"` //协议配置,包含协议名称和配置 //Devices []DefaultDevice `json:"devices"` //默认设备 Disabled bool `json:"disabled"` Last time.Time `json:"last"` Created time.Time `json:"created" xorm:"created"` }
boltholdIndex 标签是嵌入式数据库 BoltDB 上面的query layer需要的一个特殊标记
Tunnel 通道模型
type TunnelEx ¶
type UpdateTagMessage ¶
type UpdateTagMessage struct { DeviceKey string Timestamp int64 // contains filtered or unexported fields }
设备元信息相关结构体
type UpgradeFirmwareMessage ¶
type UpgradeFirmwareMessage struct { DeviceKey string Timestamp int64 Url string Version string Parameters map[string]any Sign string SignMethod string FirmwareId string Size float64 }
更新相关消息结构体
type UpgradeFirmwareMessageReply ¶
更新相关消息结构体
type UpgradeFirmwareProgressMessage ¶
type UpgradeFirmwareProgressMessage struct { DeviceKey string Progress int Complete bool Version string Success bool ErrorReason string FirmwareId string }
更新相关消息结构体
type WritePropertyMessage ¶
写属性消息结构体
Click to show internal directories.
Click to hide internal directories.