jl-iot/mqtt/topic.go
walker 0b20dcdf7a modbus驱采映射服务功能调整重构
1,添加驱动采集获取和写入接口
2,创建服务接口调整接收驱采字节数组
mqtt客户端功能代码调整,未完
2023-12-18 15:34:10 +08:00

36 lines
876 B
Go

package mqtt
import "fmt"
const (
Topic_IotServiceState string = "/%s/%s/iotss"
Topic_IotLog string = "/%s/%s/iotlog"
Topic_IotQd string = "/%s/%s/iotqd"
Topic_IotCj string = "/%s/%s/iotcj"
)
var topicMap = make(map[string]string, 4)
func BuildTopics(sysCode, iotCode string) {
topicMap[Topic_IotServiceState] = fmt.Sprintf(Topic_IotServiceState, sysCode, iotCode)
topicMap[Topic_IotLog] = fmt.Sprintf(Topic_IotLog, sysCode, iotCode)
topicMap[Topic_IotQd] = fmt.Sprintf(Topic_IotQd, sysCode, iotCode)
topicMap[Topic_IotCj] = fmt.Sprintf(Topic_IotCj, sysCode, iotCode)
}
func GetIotServiceStateTopic() string {
return topicMap[Topic_IotServiceState]
}
func GetCmdTopic() string {
return topicMap[Topic_IotLog]
}
func GetQdTopic() string {
return topicMap[Topic_IotQd]
}
func GetCjTopic() string {
return topicMap[Topic_IotCj]
}