Documentation ¶
Index ¶
- Constants
- type AsyncMsg
- type AuthCheck
- type ClosedNotify
- type ConnectedNotify
- type MqttClient
- func (mc *MqttClient) Connect() error
- func (mc *MqttClient) Disconnect()
- func (mc *MqttClient) GetOpts() *mqtt.ClientOptions
- func (mc *MqttClient) OnConnectHandler(handler mqtt.OnConnectHandler) mqtt.OnConnectHandler
- func (mc *MqttClient) Publish(topic string, qos byte, retained bool, message []byte) error
- func (mc *MqttClient) SetClient(client mqtt.Client)
- func (mc *MqttClient) SetDriver(driver commons.MqttDriver)
- func (mc *MqttClient) Subscribe(topic string, qos byte, handler mqtt.MessageHandler) error
- func (mc *MqttClient) UnSubscribe(topic string) error
- type PubTopic
- type SubTopic
- type SubTopics
- type UnSubNotify
Constants ¶
View Source
const ( DriverClientPrefix = "driver-" DriverTopicPrefix = "tedge/driver/" InnerTopicPrefix = "tedge/inner/" DriverTX = "tx" DriverRX = "rx" )
同时,username 应该由驱动传入,而不是从专家模式中读取,以及配置文件中的username!!!
View Source
const ( Auth = iota + 1 // 连接鉴权 Sub // 设备订阅校验 Pub // 设备发布校验 UnSub Connected Closed )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClosedNotify ¶
ClosedNotify 三方设备或服务断开连接后通知对应驱动
type ConnectedNotify ¶
ConnectedNotify 三方设备或服务连接成功后通知对应驱动
type MqttClient ¶
type MqttClient struct {
// contains filtered or unexported fields
}
func NewMqttClient ¶
func NewMqttClient(server, username string, logger commons.TedgeLogger) (*MqttClient, error)
func (*MqttClient) Connect ¶
func (mc *MqttClient) Connect() error
func (*MqttClient) Disconnect ¶
func (mc *MqttClient) Disconnect()
func (*MqttClient) GetOpts ¶
func (mc *MqttClient) GetOpts() *mqtt.ClientOptions
func (*MqttClient) OnConnectHandler ¶
func (mc *MqttClient) OnConnectHandler(handler mqtt.OnConnectHandler) mqtt.OnConnectHandler
func (*MqttClient) SetClient ¶
func (mc *MqttClient) SetClient(client mqtt.Client)
func (*MqttClient) SetDriver ¶
func (mc *MqttClient) SetDriver(driver commons.MqttDriver)
func (*MqttClient) Subscribe ¶
func (mc *MqttClient) Subscribe(topic string, qos byte, handler mqtt.MessageHandler) error
func (*MqttClient) UnSubscribe ¶
func (mc *MqttClient) UnSubscribe(topic string) error
type UnSubNotify ¶
Click to show internal directories.
Click to hide internal directories.