You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.3 KiB
54 lines
1.3 KiB
2 weeks ago
|
package testUnit
|
||
|
|
||
|
import (
|
||
|
"goUpload/adaptors"
|
||
|
"log"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func Test_XTJC(t *testing.T) {
|
||
|
|
||
|
Msg := `
|
||
|
{
|
||
|
"dtuInfo": {
|
||
|
"id": 0,
|
||
|
"code": "COM3"
|
||
|
},
|
||
|
"sensorData": {
|
||
|
"id": 25,
|
||
|
"name": "LHTDQ-RSG-L07-003-04",
|
||
|
"module": "2942",
|
||
|
"channel": "8",
|
||
|
"factorType": 23,
|
||
|
"productCode": "MD-BM15",
|
||
|
"structId": 0,
|
||
|
"data": {
|
||
|
"RawValues": [
|
||
|
880.05609130859375,
|
||
|
17.250148773193359,
|
||
|
426.63839721679687
|
||
|
],
|
||
|
"ThemeValues": [
|
||
|
8.5109777
|
||
|
]
|
||
|
},
|
||
|
"time": "2019-03-25T10:37:17.000"
|
||
|
}
|
||
|
}
|
||
|
`
|
||
|
adp := adaptors.Adaptor_TYCJ_XTJC{
|
||
|
IdMap: map[string]int16{"LHTDQ-RSG-L07-003-04": 27005},
|
||
|
}
|
||
|
bytes := adp.Transform(Msg)
|
||
|
log.Println(bytes)
|
||
|
}
|
||
|
|
||
|
func TestQX(t *testing.T) {
|
||
|
mqttMsg := `{"dtuInfo":{"id":0,"code":"COM24"},"sensorData":{"id":88,"name":"33-QX-1","module":"2215","channel":"1","factorType":20,"productCode":"FS-MD-HGC01","structId":0,"data":{"RawValues":[0.01537999976426363,-0.13315799832344055,0.0,16.059999465942383],"ThemeValues":[0.01537999976426363,-0.13315799832344055,0.0,16.059999465942383]},"time":"2024-03-19T09:29:30.150"}}`
|
||
|
adp := adaptors.Adaptor_TYCJ_XTJC{
|
||
|
IdMap: map[string]int16{"33-QX-1": 12072},
|
||
|
}
|
||
|
bytes := adp.Transform(mqttMsg)
|
||
|
log.Println(bytes)
|
||
|
}
|