| 1234567891011121314151617181920212223 |
- package main
- import (
- "lc/common/protocol"
- )
- type MqttOnline struct {
- }
- func (o *MqttOnline) GetOnlineMsg() (string, string) {
- //发布上线消息
- var obj protocol.Pack_IDObject
- str, err := obj.EnCode(appConfig.GID, GetNextUint64(), 0)
- if err != nil {
- return "", ""
- }
- return GetTopic(protocol.DT_GATEWAY, appConfig.GID, protocol.TP_GW_ONLINE), str
- }
- func (o *MqttOnline) GetWillMsg() (string, string) {
- payload, _ := (&protocol.Pack_IDObject{}).EnCode(appConfig.GID, GetNextUint64(), 0) //遗嘱消息
- return GetTopic(protocol.DT_GATEWAY, appConfig.GID, protocol.TP_GW_WILL), payload
- }
|