json_rpc

package
v0.0.0-...-ae4999c Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CH

type CH struct {
	UID string
	Tag string
}

type Conf

type Conf struct {
	UID              string
	Address          string
	Interval         time.Duration
	DB               string
	InfluxDBUrl      string
	InfluxDBUserName string
	InfluxDBPassword string
	CallbackURL      string
	LogLevel         string
}

type Edge

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

func New

func New(sink Sink) *Edge

func (*Edge) Active

func (e *Edge) Active(_ *http.Request, conf *Conf, _ *Result) (err error)

Active 用于激活一个设备

func (*Edge) GetBaseInfo

func (e *Edge) GetBaseInfo(_ *http.Request, uid *string, result *Result) (err error)

GetBaseInfo 获取设备基本信息

func (*Edge) GetRealtimeData

func (e *Edge) GetRealtimeData(_ *http.Request, uid *string, result *Result) (err error)

GetRealtimeData 获取设备全部的即时数据

func (*Edge) GetValue

func (e *Edge) GetValue(_ *http.Request, ch *CH, result *Result) (err error)

GetValue 获取设备的一个点位值

func (*Edge) Remove

func (e *Edge) Remove(_ *http.Request, uid *string, _ *Result) (err error)

Remove 移除一个设备,不再读取相关数据

func (*Edge) Reset

func (e *Edge) Reset(_ *http.Request, uid *string, _ *Result) (err error)

Reset 重置设备配置和数据

func (*Edge) SetValue

func (e *Edge) SetValue(_ *http.Request, val *Value, _ *Result) (err error)

SetValue 设置设备一个点位值,目前只支持DO

func (*Edge) StartInverseServer

func (e *Edge) StartInverseServer(conf *InverseConf) error

type InverseConf

type InverseConf struct {
	Address string
	Port    int
}

type Result

type Result struct {
	Code int
	Msg  string
	Data interface{}
}

type Sink

type Sink interface {
	StartInverseServer(conf *InverseConf) error
	Reset(uid string)
	GetBaseInfo(uid string) (map[string]interface{}, error)
	Remove(uid string)
	Active(conf *Conf) error
	SetValue(val *Value) error
	GetValue(ch *CH) (interface{}, error)
	GetRealtimeData(uid string) ([]map[string]interface{}, error)
}

type Value

type Value struct {
	CH
	V interface{}
}

Jump to

Keyboard shortcuts

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