This commit is contained in:
tfl
2024-08-21 17:35:50 +08:00
parent 34ea7472b7
commit dd5b38b4e3
24 changed files with 328 additions and 133 deletions

View File

@@ -16,7 +16,9 @@ const (
TelemetryGatewayTopic = "v1/gateway/telemetry"
ConnectGatewayTopic = "v1/gateway/connect"
RpcReq = `v1/devices/me/rpc/request/(.*?)$`
RpcReq = `v1/devices/me/rpc/(.*?)/(.*?)$`
EventReq = `v1/devices/event/(.*?)$`
)
var IotHubTopic = NewIotHubTopic()
@@ -39,8 +41,11 @@ func (iht TopicMeg) GetMessageType(topic string) string {
if meg, ok := iht[topic]; ok {
return meg
}
if strings.Contains(topic, "v1/devices/me/rpc/request") {
if strings.Contains(topic, "v1/devices/me/rpc/request") || strings.Contains(topic, "v1/devices/me/rpc/response") {
return message.RpcRequestFromDevice
}
if strings.Contains(topic, "v1/devices/event") {
return message.UpEventMes
}
return ""
}