lijian 1 rok pred
rodič
commit
f53b406655
2 zmenil súbory, kde vykonal 35 pridanie a 4 odobranie
  1. 35 0
      UPDATE.md
  2. 0 4
      pkg/mqtt/connection.go

+ 35 - 0
UPDATE.md

@@ -0,0 +1,35 @@
+## V3 升级说明
+
+### 1.设备主题升级
+
+#### 1.1 设备状态上报(D->S)
+
+* 设备属性上行请求: `$thing/up/status/{productKey}/{deviceCode}`
+* 设备属性下行响应:`$thing/down/status/{productKey}/{deviceCode}`
+
+#### 1.2 请求设备上报状态(S->D)
+
+*需要主动请求设备上报的时候用以上方式请求TOPIC*
+
+* 设备属性下行请求: `$thing/down/status/{productKey}/{deviceCode}`
+* 设备属性下行响应:`$thing/up/status/{productKey}/{deviceCode}`
+
+#### 1.3 设备远程控制(S->D)
+
+*当通过云端控制设备时,设备需要订阅下发TOPIC接收云端指令*
+
+* 下发TOPIC: `$thing/down/status/{productKey}/{deviceCode}`
+* 响应TOPIC:`$thing/up/status/{productKey}/{deviceCode}`
+
+
+#### 1.4 设备事件上报(D->S)
+
+* 设备事件上行请求: `$thing/up/event/{productKey}/{deviceCode}`
+* 设备事件下行响应:`$thing/down/event/{productKey}/{deviceCode}`
+
+#### 1.5 设备指令下发(S->D)
+
+*当云端调用设备的某个指令调用时,默认TOPIC*
+
+* 下发TOPIC: `$thing/down/command/{productKey}/{deviceCode}`
+* 设备响应TOPIC: `$thing/up/command/{productKey}/{deviceCode}`

+ 0 - 4
pkg/mqtt/connection.go

@@ -3,7 +3,6 @@ package mqtt
 import (
 	"encoding/hex"
 	"errors"
-	"fmt"
 	"net"
 	"sparrow/pkg/models"
 	"sparrow/pkg/rpcs"
@@ -278,9 +277,6 @@ func (c *Connection) RcvMsgFromClient() {
 			}
 
 		case *PingReq:
-			if c.DeviceCode == "08D1F9E77840" {
-				println(fmt.Sprintf("收到ping req:%s", c.DeviceCode))
-			}
 			pingrsp := &PingResp{}
 			err := c.Mgr.Provider.OnDeviceHeartBeat(c.DeviceCode)
 			if err != nil {