https://blog.csdn.net/u012377333/article/details/71123671web
1、測試環境介紹數據庫
2、測試流程&結果服務器
一、應用服務器運行webServer訂閱
啓動本地的Tomcat,加載OxygenCloud後,就會使用Id爲webServer向Mosquitto訂閱webServer主題。session
Mosquitto日誌:測試
二、命令行訂閱設備SN碼爲10013主題
#mosquitto_sub -h 60.205.148.67-t 10013 -u admin -P passwordui
Mosquitto日誌:.net
三、設備SN碼爲10013發送上傳數據到webServer
數據格式:命令行
{"msgType":"InviteUpload","pressure":"6.3","sn":"10013","flowTotal":"1677","concentrer":"96.4","flow":"58","deviceStatus":"2"}日誌
命令行:blog
# mosquitto_pub -h 60.205.148.67-t webServer -u admin -P password -m"{\"msgType\":\"InviteUpload\",\"pressure\":\"5.3\",\"sn\":\"10013\",\"flowTotal\":\"1677\",\"concentrer\":\"96.4\",\"flow\":\"58\",\"deviceStatus\":\"2\"}"
Mosquitto日誌:
Tomcat日誌:
Web界面:
MySQL數據庫:
四、設備SN碼爲10013上傳開關機受權&開關機到webServer
設備關機數據格式:
{"msgType":"InviteOpen","sn":"10013","open":"0"}
命令行:
#mosquitto_pub -h 60.205.148.67 -t webServer -u admin -P password -m"{\"msgType\":\"InviteOpen\",\"sn\":\"10013\",\"open\":\"0\"}"
Mosquitto日誌:
Tomcat日誌:
Web界面:
MySQL數據庫:
設備開關機受權數據格式:
{"openValid":"0","msgType":"InviteOpenValid","sn":"10013"}
命令行:
#mosquitto_pub -h 60.205.148.67 -t webServer -u admin -P password -m"{\"msgType\":\"InviteOpenValid\",\"sn\":\"10013\",\"openValid\":\"0\"}
Mosquitto日誌:
Tomcat日誌:
Web界面:
MySQL數據庫:
數據格式:
{"openValid":"1","msgType":"InviteOpenAll","sn":"10013","open":"1"}
命令行:
#mosquitto_pub -h 60.205.148.67 -t webServer -u admin -P password -m"{\"msgType\":\"InviteOpenAll\",\"sn\":\"10013\",\"openValid\":\"1\",\"open\":\"1\"}"
Mosquitto日誌:
Tomcat日誌:
Web界面:
MySQL數據庫:
五、設備SN碼爲10013上傳警報消息
數據格式:
{"msgType":"InviteAlert","sn":"10013","alertMsg":"濃度低"}
命令行:
#mosquitto_pub -h 60.205.148.67 -t webServer -u admin -P password -m"{\"msgType\":\"InviteAlert\",\"sn\":\"10013\",\"alertMsg\":\"濃度低\"}"
Mosquitto日誌:
Tomcat日誌:
Web界面:
MySQL數據庫:
六、webClient下發數據上傳頻率到設備
數據格式:
{"hz":"5","msgType":"InviteHz"}
Web界面操做:
用戶登陸或者用戶註銷時,或者session失效時。
Mosquitto日誌:
Tomcat日誌:
命令行接收數據:
七、webClient下發警報參數到設備
數據格式:
{"cctUpTime":"300","msgType":"InviteAlertParam","psrDwonTime":"300","cctDownTime":"300","psrUp":"95","psrUpTime":"300","cctDown":"4.0","cctUp":"5.0","psrDwon":"87"}
Web界面操做:
Mosquitto日誌:
Tomcat日誌:
命令行接收數據:
八、webClient下發開關機受權&開關機到設備
開關機受權數據格式:
{"openValid":"0","msgType":"InviteOpenValid","sn":"webServer"}
Web操做界面:
Mosquitto日誌:
Tomcat日誌:
命令行接收數據: