jiangsu

package
v0.0.0-...-91c7ab2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CST = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func Auth

func Auth(addr, version string, devInfo model.DevInfo) (iotDeviceID string, err error)

Auth 边设备认证

Types

type App

type App struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewApp

func NewApp(edgeID string, tsr transport.Transporter) (*App, error)

func (*App) ReportEvent

func (a *App) ReportEvent(containerName, appName string, event model.EventType, msg string) error

func (*App) ReportStatus

func (a *App) ReportStatus() error

func (*App) Run

func (a *App) Run()

func (*App) Stop

func (a *App) Stop()

type Container

type Container struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewContainer

func NewContainer(edgeID string, tsr transport.Transporter) (*Container, error)

func (*Container) ReportEvent

func (conn *Container) ReportEvent(containName string, event model.EventType, msg string) error

func (*Container) ReportStatus

func (conn *Container) ReportStatus() error

func (*Container) Run

func (conn *Container) Run()

func (*Container) Stop

func (conn *Container) Stop()

type CpuLmt

type CpuLmt struct {
	Cpus int      `json:"cpus"` // CPU核数
	Lmt  model.UP `json:"lmt"`  // CPU监控阀值,百分数
}

type DiskLmt

type DiskLmt struct {
	Unit model.UM `json:"unit"` // 存储限制
	Lmt  model.UP `json:"lmt"`  // 磁盘存储监控阀值,百分数
}

type Download

type Download struct {
	buffer.Buffer
	// contains filtered or unexported fields
}

Download 下载文件

func NewDownload

func NewDownload(file File) *Download

func (*Download) GetProcess

func (d *Download) GetProcess() int

func (*Download) GetState

func (d *Download) GetState() model.UpgradeState

func (*Download) ReadAll

func (d *Download) ReadAll() ([]byte, error)

type File

type File struct {
	Name string `json:"name"`           // 文件的名字
	Url  string `json:"url,omitempty"`  // 文件的下载路径
	Size int64  `json:"size"`           // 文件的大小, 单位: k Bytes
	Md5  string `json:"md5"`            // 文件的md5值,用于校验文件
	Sign Sign   `json:"sign,omitempty"` // 文件的数字签证信息
}

type LinkState

type LinkState struct {
	Name   string           `json:"name"`
	Status model.LinkEnable `json:"status"`
}

type MemLmt

type MemLmt struct {
	Unit model.UM `json:"unit"` // 内存限制
	Lmt  model.UP `json:"lmt"`  // 内存监控阀值,百分数
}

type MemUsed

type MemUsed struct {
	Phy  model.UP `json:"phy"`            // 占用的物理内存
	Virt model.UP `json:"virt,omitempty"` // 占用的虚拟内存
}

type RepPeriod

type RepPeriod struct {
	DevPeriod int `json:"devPeriod"` // 终端状态主动上报的时间间隔,单位:秒
	ConPeriod int `json:"conPeriod"` // 容器状态主动上报的时间间隔, 单位:秒
	AppPeriod int `json:"appPeriod"` // APP状态主动上报的时间间隔, 单位:秒
}

type Request

type Request struct {
	Mid       int64             `json:"mid,omitempty"`      //在请求报文中该值为请求 ID。边设备 接入请求和上报可不携带
	DeviceID  string            `json:"deviceId,omitempty"` //设备唯一标识,涉及批量设备操作时该字段可不填写
	App       string            `json:"app,omitempty"`      //APP应用名称,涉及批量设备操作时填写该字段
	TimeStamp string            `json:"timestamp"`          //消息发送的时间戳,CST时间,精度到秒
	Expire    int               `json:"expire,omitempty"`   //此报文过期的相对时间(相对timestamp),单位秒,不包含该字段,或者该字段为-1时表示永不过期
	Type      model.MessageType `json:"type"`               //消息类型,全大写,单词中间用“_”隔开
	Param     interface{}       `json:"param"`              //报文内容,详见各报文定义
	Sign      string            `json:"sign,omitempty"`     //命令及重点信息应包含此字段,该字段为param内容的签名,具体为:对于param中的json成员(包括嵌套json成员)按照key按照字典序排列后进行签名
}

func (*Request) GetMessageType

func (r *Request) GetMessageType() model.MessageType

func (*Request) GetMid

func (r *Request) GetMid() string

func (*Request) GetTime

func (r *Request) GetTime() time.Time

type Response

type Response struct {
	Mid       int64              `json:"mid"`                //在应答报文中,该值为应答所对应请求报文的请求ID
	DeviceID  string             `json:"deviceId,omitempty"` //设备唯一标识,涉及批量设备操作时该字段可不填写
	TimeStamp string             `json:"timestamp"`          //消息发送的时间戳,CST时间,精度到秒
	Type      model.MessageType  `json:"type"`               //消息类型,全大写,单词中间用“_”隔开
	Param     interface{}        `json:"param,omitempty"`    //报文内容,详见各报文定义
	Code      model.ResponseCode `json:"code"`               //标识应答的返回码
	Msg       string             `json:"msg,omitempty"`      //应答结果描述,字符串,最大 256 字符
}

func (Response) Error

func (r Response) Error() error

func (Response) GetMessageType

func (r Response) GetMessageType() model.MessageType

func (Response) GetMid

func (r Response) GetMid() string

func (Response) GetParamPayload

func (r Response) GetParamPayload() []byte

func (Response) GetTime

func (r Response) GetTime() time.Time

func (Response) UnmarshalParam

func (r Response) UnmarshalParam(v interface{}) error

type Service

type Service struct {
	GetData func(method string) (interface{}, error)
	// contains filtered or unexported fields
}

func NewService

func NewService(edgeID string, tsr transport.Transporter) (*Service, error)

func (*Service) ReportData

func (sv *Service) ReportData(deviceID string, method string, data interface{}) error

func (*Service) ReportEvent

func (sv *Service) ReportEvent(deviceID string, method string, data interface{}) error

func (*Service) Run

func (sv *Service) Run()

func (*Service) Stop

func (sv *Service) Stop()

type Sign

type Sign struct {
	Name string `json:"name"`          // 数字证书文件名字
	Url  string `json:"url,omitempty"` // 数字证书文件下载路径
	Md5  string `json:"md5,omitempty"` // 数据证书文件的md5值,用于校验文件
}

type System

type System struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSystem

func NewSystem(tsr transport.Transporter, devInfo model.DevInfo, systemConfig model.SystemConfig, handle model.OnSysSetConfigHandler) (*System, error)

func (*System) GetIotCurTime

func (sys *System) GetIotCurTime() (time.Time, error)

func (*System) LinkDown

func (sys *System) LinkDown(reason string) error

func (*System) LinkUp

func (sys *System) LinkUp() error

func (*System) ReportEvent

func (sys *System) ReportEvent(event model.EventType, info string) error

func (*System) ReportStatus

func (sys *System) ReportStatus() error

func (*System) Run

func (sys *System) Run()

func (*System) Stop

func (sys *System) Stop()

type Topo

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

func NewTopo

func NewTopo(edgeID string, tsr transport.Transporter) (*Topo, error)

func (*Topo) AddTerminal

func (tp *Topo) AddTerminal(terminal model.TerminalInfo) (iotDeviceID string, err error)

func (*Topo) DelTerminal

func (tp *Topo) DelTerminal(deviceID string) error

func (*Topo) Run

func (tp *Topo) Run()

func (*Topo) Stop

func (tp *Topo) Stop()

func (*Topo) UpdateTerminalStatus

func (tp *Topo) UpdateTerminalStatus(deviceID string, status model.DeviceStatus) error

Jump to

Keyboard shortcuts

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