Documentation
¶
Index ¶
- Constants
- type AppI
- type Client
- type ContainerI
- type DevInfo
- type MessageHandler
- type Options
- type ServiceI
- type StgMqtt
- func (stg *StgMqtt) AddTerminal(info model.TerminalInfo) (iotDeviceID string, err error)
- func (stg *StgMqtt) DelTerminal(deviceSN string) error
- func (stg *StgMqtt) ReportData(deviceSN string, method string, data interface{}) error
- func (stg *StgMqtt) ReportEvent(deviceSN string, method string, data interface{}) error
- func (stg *StgMqtt) Run()
- func (stg *StgMqtt) UpdateTerminalStatus(deviceSN string, online bool) error
- type SystemConfig
- type SystemI
- type Terminal
- type TopoI
- type Version
Constants ¶
View Source
const ( Vs_Js = "jiangsu" Vs_Sc = "sichuang" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppI ¶
type AppI interface {
//Run 启动运行守护程序
Run()
//Stop 停止运行守护程序
Stop()
ReportStatus() error
ReportEvent(containerName, appName string, event model.EventType, msg string) error
}
AppI app相关的操作
type Client ¶
type Client interface {
Run()
AddTerminal(info Terminal) (iotDeviceID string, err error)
DelTerminal(deviceSN string) error
UpdateTerminalStatus(deviceSN string, online bool) error
//ReportData 业务数据
ReportData(deviceSN string, method string, data interface{}) error
//ReportEvent 业务事件
ReportEvent(deviceSN string, method string, data interface{}) error
}
func NewStgMqtt ¶
func NewStgMqtt(ops Options, handler MessageHandler) (Client, error)
type ContainerI ¶
type ContainerI interface {
//Run 启动运行守护程序
Run()
//Stop 停止运行守护程序
Stop()
ReportStatus() error
ReportEvent(containName string, event model.EventType, msg string) error
}
ContainerI 容器相关的操作
type MessageHandler ¶
type MessageHandler interface {
OnConnect()
OnConnectionLost(reason error)
OnSysSetConfig(SystemConfig) error
}
type Options ¶
type Options struct {
InstVersion Version // stgmqtt实例的版本
DevInfo DevInfo
SystemConfig SystemConfig
IotPlatformAddr string // 物联平台的地址
IotPlatformVersion string // 物联平台的版本
MqttVersion string // 物联网协议版本
MqttBrokers []string
MqttClientID string
MqttUsername string
MqttPassword string
MqttQOS uint8
MqttResponseTimeout time.Duration // 响应超时时间
StoreDir string //持久化存储目录
}
type ServiceI ¶
type ServiceI interface {
//Run 启动运行守护程序
Run()
//Stop 停止运行守护程序
Stop()
//ReportData 业务数据上报
ReportData(iotDeviceID string, method string, data interface{}) error
//ReportEvent 业务事件上报
ReportEvent(iotDeviceID string, method string, data interface{}) error
}
ServiceI 业务相关的操作
type StgMqtt ¶
type StgMqtt struct {
sync.RWMutex
SystemI
TopoI
ServiceI
AppI
ContainerI
// contains filtered or unexported fields
}
func (*StgMqtt) AddTerminal ¶
func (stg *StgMqtt) AddTerminal(info model.TerminalInfo) (iotDeviceID string, err error)
func (*StgMqtt) DelTerminal ¶
func (*StgMqtt) ReportData ¶
func (*StgMqtt) ReportEvent ¶
type SystemConfig ¶
type SystemConfig = model.SystemConfig
type SystemI ¶
type SystemI interface {
//Run 启动运行守护程序
Run()
//Stop 停止运行守护程序
Stop()
//LinkUp 设备接入
LinkUp() error
//LinkDown 设备断开
LinkDown(reason string) error
//GetIotCurTime 获取物联网平台当前时间
GetIotCurTime() (time.Time, error)
//ReportStatus 上报设备状态
ReportStatus() error
//ReportEvent 设备事件上报
ReportEvent(event model.EventType, info string) error
}
SystemI 设备、系统相关的操作
type Terminal ¶
type Terminal = model.TerminalInfo
Click to show internal directories.
Click to hide internal directories.