jl-iot/mqtt/topic.go
walker 120fb4c5fb 数据包移动到dto包下
定时任务接口名称调整
新建Modbus驱采服务接口调整
添加iot驱采服务定义和启动,初步实现
2023-12-20 14:05:07 +08:00

54 lines
1.9 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package mqtt
import "fmt"
const (
// IOT服务状态主题,第一个参数为应用编号,第二个参数为客户端编号
Topic_IotServiceState string = "/%s/%s/iotss"
// IOT服务启动(请求响应)主题,第一个参数为应用编号,第二个参数为客户端编号
Topic_IotServiceStart string = "/%s/%s/iotstart"
// IOT服务停止(请求响应)主题,第一个参数为应用编号,第二个参数为客户端编号
Topic_IotServiceStop string = "/%s/%s/iotstop"
// IOT日志服务(请求响应)主题,第一个参数为应用编号,第二个参数为客户端编号
Topic_IotLog string = "/%s/%s/iotlog"
// IOT驱动数据主题第一个参数为应用编号第二个参数为客户端编号
Topic_IotQd string = "/%s/%s/iotqd"
// IOT采集数据主题第一个参数为应用编号第二个参数为客户端编号
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_IotServiceStart] = fmt.Sprintf(Topic_IotServiceStart, sysCode, iotCode)
topicMap[Topic_IotServiceStop] = fmt.Sprintf(Topic_IotServiceStop, 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 GetIotServiceStartTopic() string {
return topicMap[Topic_IotServiceStart]
}
func GetIotServiceStopTopic() string {
return topicMap[Topic_IotServiceStop]
}
func GetLogReqTopic() string {
return topicMap[Topic_IotLog]
}
func GetQdTopic() string {
return topicMap[Topic_IotQd]
}
func GetCjTopic() string {
return topicMap[Topic_IotCj]
}