subDev

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionConnected    = "connected"
	ActionDisconnected = "disconnected"
)
View Source
const (
	// ShareSubTopicPrefix emqx 共享订阅前缀 参考: https://docs.emqx.com/zh/enterprise/v4.4/advanced/shared-subscriptions.html
	ShareSubTopicPrefix = "$share/dd.rpc/"
	// TopicConnectStatus emqx 客户端上下线通知 参考: https://docs.emqx.com/zh/enterprise/v4.4/advanced/system-topic.html#客户端上下线事件
	TopicConnectStatus = ShareSubTopicPrefix + "$SYS/brokers/+/clients/#"

	TopicThing   = ShareSubTopicPrefix + devices.TopicHeadThing + "/#"
	TopicOta     = ShareSubTopicPrefix + devices.TopicHeadOta + "/#"
	TopicConfig  = ShareSubTopicPrefix + devices.TopicHeadConfig + "/#"
	TopicSDKLog  = ShareSubTopicPrefix + devices.TopicHeadLog + "/#"
	TopicShadow  = ShareSubTopicPrefix + devices.TopicHeadShadow + "/#"
	TopicGateway = ShareSubTopicPrefix + devices.TopicHeadGateway + "/#"
)

Variables

This section is empty.

Functions

func Check

func Check(conf conf.DevLinkConf) error

Types

type ConnectMsg

type ConnectMsg struct {
	UserName string `json:"username"`
	Ts       int64  `json:"ts"`
	Address  string `json:"ipaddress"`
	ClientID string `json:"clientid"`
	Reason   string `json:"reason"`
}

登录登出消息

type DevSubHandle

type DevSubHandle interface {
	// Ota ota远程升级
	Ota(topic string, payload []byte) error
	// Config 设备远程配置
	Config(topic string, payload []byte) error
	// Shadow 设备影子
	Shadow(topic string, payload []byte) error
	// Log 设备调试日志
	SDKLog(topic string, payload []byte) error
	// Gateway 网关子设备
	Gateway(topic string, payload []byte) error
	// Thing 物模型消息
	Thing(topic string, payload []byte) error
	Connected(out *devices.DevConn) error
	Disconnected(out *devices.DevConn) error
}

type Handle

type Handle func(ctx context.Context) DevSubHandle

type MqttClient

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

func (*MqttClient) SubDevMsg

func (d *MqttClient) SubDevMsg(handle Handle) error

type SubDev

type SubDev interface {
	SubDevMsg(handle Handle) error
}

func NewSubDev

func NewSubDev(conf conf.DevLinkConf) (SubDev, error)

Jump to

Keyboard shortcuts

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