Browse Source

add header tyhpe

lijian 2 năm trước cách đây
mục cha
commit
5e2b217906
3 tập tin đã thay đổi với 8 bổ sung6 xóa
  1. 2 0
      services/controller/controller.go
  2. 4 4
      tests/device/device.go
  3. 2 2
      tests/device/main.go

+ 2 - 0
services/controller/controller.go

@@ -229,6 +229,8 @@ func (c *Controller) OnEvent(args rpcs.ArgsOnEvent, reply *rpcs.ReplyOnEvent) er
 			"tenant_id":     args.VendorId,
 			"device_id":     args.DeviceId,
 			"sub_device_id": args.SubDeviceId,
+			"type":          "EVENT",
+			"timestamp":     strconv.Itoa(int(args.TimeStamp)),
 		},
 		Originator: "device",
 	}

+ 4 - 4
tests/device/device.go

@@ -423,11 +423,11 @@ func (d *Device) doMQTTAccess() error {
 		}
 	}()
 	// 子设备上线
-	d.deviceNetConfig(c)
-	go d.subDeviceLogin(c)
-	go d.reportStatus(c)
+	//d.deviceNetConfig(c)
+	//go d.subDeviceLogin(c)
+	//go d.reportStatus(c)
 	//go d.reportStatus2(c)
-	//go d.reportEvent(c)
+	go d.reportEvent(c)
 	// we just pause here to wait for messages
 	<-make(chan int)
 

+ 2 - 2
tests/device/main.go

@@ -6,8 +6,8 @@ import (
 )
 
 var (
-	testURL        = flag.String("url", "http://192.168.0.160:8088", "login url")
-	testProductKey = flag.String("productkey", "958daf8b3a533f0d9516ac8fd17ef0cb06b439e664787a2a89608a10eeee8eb3c35c82c505d19f8a4417e530de0678fd", "product key")
+	testURL        = flag.String("url", "http://114.115.211.247:8082", "login url")
+	testProductKey = flag.String("productkey", "0aa9eab3202fc0a0940923ae02174b2334da8b2a79b45a6f37b94404ee6dd96e33057e03cd7c7030c9a215f6a22d16ca", "product key")
 	testProtocol   = flag.String("protocol", "mqtt", "access protocol")
 	testDeviceCode = flag.String("dvc", "", "device code")
 	confCAFile     = flag.String("certfile", "keys/cacert.pem", "ca-file")