Commit 2776862b authored by liyuanhong's avatar liyuanhong

M500模拟器完成了支持终端重启应答和GPSR查询参数应答功能

parent c1fd94e4
{"time": {"dateTime": "2020-05-19 11:09:47", "date": "2020-05-19", "time": "11:09:47"}, "curDayTravel": {"todayTotalMilleage": 7518, "todayTotalOil": 723, "todayTotalTime": 453, "theMilleage": 1328, "theOil": 128, "theTime": 80}, "travelData": {"totalMilleage": 291255, "totalOil": 27570, "totalTime": 17235}, "event": {"threeRapid": {"totalRapidlyAccelerate": 14, "totalSharpSlowdown": 13, "totalSharpTurn": 13}}} {"time": {"dateTime": "2020-05-19 11:09:47", "date": "2020-05-19", "time": "11:09:47"}, "curDayTravel": {"todayTotalMilleage": 40924, "todayTotalOil": 3769, "todayTotalTime": 2477, "theMilleage": 1452, "theOil": 132, "theTime": 88}, "travelData": {"totalMilleage": 324661, "totalOil": 30616, "totalTime": 19259}, "event": {"threeRapid": {"totalRapidlyAccelerate": 14, "totalSharpSlowdown": 13, "totalSharpTurn": 13}}}
\ No newline at end of file \ No newline at end of file
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
from lib.protocol.report.ProtocolBase import ProtocolBase from lib.protocol.report.ProtocolBase import ProtocolBase
class Update_response(ProtocolBase): class GPRS_response(ProtocolBase):
dataDefault = [{"serverIndex":"1","serverAddressType":0,"serverAddress":"10.100.12.31","comPort":"9008","comType":0,"APN":"tnet", \ dataDefault = [{"serverIndex":"1","serverAddressType":0,"serverAddress":"10.100.12.31","comPort":"9008","comType":0,"APN":"tnet", \
"username":"yuanhong","password":"123456"},{"serverIndex":"1","serverAddressType":0,"serverAddress":"10.100.12.31","comPort":"9008","comType":0,"APN":"tnet", \ "username":"yuanhong","password":"123456"},{"serverIndex":"1","serverAddressType":0,"serverAddress":"10.100.12.32","comPort":"9008","comType":0,"APN":"tnet", \
"username":"yuanhong","password":"123456"},{"serverIndex":"1","serverAddressType":0,"serverAddress":"10.100.12.31","comPort":"9008","comType":0,"APN":"tnet", \ "username":"yuanhong","password":"123456"},{"serverIndex":"1","serverAddressType":0,"serverAddress":"10.100.12.33","comPort":"9008","comType":0,"APN":"tnet", \
"username":"yuanhong","password":"123456"}] "username":"yuanhong","password":"123456"}]
def __init__(self,msgCount = 1,WATER_CODE = 1000,DEV_ID = "M121501010001",data=[{"serverIndex":"1","serverAddressType":0,"serverAddress":"10.100.12.31","comPort":"9008","comType":0,"APN":"tnet", \ def __init__(self,msgCount = 1,WATER_CODE = 1000,DEV_ID = "M121501010001",data=[{"serverIndex":"1","serverAddressType":0,"serverAddress":"10.100.12.31","comPort":"9008","comType":0,"APN":"tnet", \
"username":"yuanhong","password":"123456"},{"serverIndex":"2","serverAddressType":0,"serverAddress":"10.100.12.31","comPort":"9008","comType":0,"APN":"tnet", \ "username":"yuanhong","password":"123456"},{"serverIndex":"2","serverAddressType":0,"serverAddress":"10.100.12.32","comPort":"9008","comType":0,"APN":"tnet", \
"username":"yuanhong","password":"123456"},{"serverIndex":"3","serverAddressType":0,"serverAddress":"10.100.12.31","comPort":"9008","comType":0,"APN":"tnet", \ "username":"yuanhong","password":"123456"},{"serverIndex":"3","serverAddressType":0,"serverAddress":"10.100.12.33","comPort":"9008","comType":0,"APN":"tnet", \
"username":"yuanhong","password":"123456"}]): "username":"yuanhong","password":"123456"}]):
super().__init__() super().__init__()
self.msgCount = int(msgCount) self.msgCount = int(msgCount)
...@@ -30,7 +30,7 @@ class Update_response(ProtocolBase): ...@@ -30,7 +30,7 @@ class Update_response(ProtocolBase):
HEADER = "4040" #消息头 HEADER = "4040" #消息头
WATER_CODE = self.getWaterCode(self.WATER_CODE) #消息流水号 WATER_CODE = self.getWaterCode(self.WATER_CODE) #消息流水号
DEV_ID = self.devid2hexString(self.DEV_ID) #设备id DEV_ID = self.devid2hexString(self.DEV_ID) #设备id
FUN_ID = "8105" # 功能id FUN_ID = "0105" # 功能id
data = "" #数据段 data = "" #数据段
data += self.generateUpdateData() data += self.generateUpdateData()
LENGTH = self.getMsgLength(int(len(WATER_CODE + DEV_ID + FUN_ID + data)/2)) # 消息长度 LENGTH = self.getMsgLength(int(len(WATER_CODE + DEV_ID + FUN_ID + data)/2)) # 消息长度
...@@ -70,6 +70,6 @@ class Update_response(ProtocolBase): ...@@ -70,6 +70,6 @@ class Update_response(ProtocolBase):
return dataHex return dataHex
if __name__ == "__main__": if __name__ == "__main__":
print(Update_response().generateMsg()) print(GPRS_response().generateMsg())
...@@ -16,6 +16,7 @@ from lib.protocol.report.EventReport_protocol import EventReport_protocol ...@@ -16,6 +16,7 @@ from lib.protocol.report.EventReport_protocol import EventReport_protocol
from lib.protocol.report.GPSReport_protocol import GPSReport_protocol from lib.protocol.report.GPSReport_protocol import GPSReport_protocol
from lib.protocol.report.OBDReport_CAN_protocol import OBDReport_CAN_protocol from lib.protocol.report.OBDReport_CAN_protocol import OBDReport_CAN_protocol
from lib.protocol.report.response.Common_response import Common_response from lib.protocol.report.response.Common_response import Common_response
from lib.protocol.report.response.GPRS_response import GPRS_response
from lib.protocol.report.response.Update_response import Update_response from lib.protocol.report.response.Update_response import Update_response
from lib.socket.service.ProtocolSimulaterDataService import ProtocolSimulaterDataService from lib.socket.service.ProtocolSimulaterDataService import ProtocolSimulaterDataService
from lib.socket.service.websocket_service import Websocket_service from lib.socket.service.websocket_service import Websocket_service
...@@ -291,20 +292,32 @@ class ProtocolSimulaterService(): ...@@ -291,20 +292,32 @@ class ProtocolSimulaterService():
#收到 某些类型的消息后执行回复操作 #收到 某些类型的消息后执行回复操作
def doResponse(self,msg): def doResponse(self,msg):
msgFunId = self.getMsgFunId(msg) msgFunId = self.getMsgFunId(msg)
if msgFunId == "8205": if msgFunId == "8105":
msg = Common_response(resId="8205").generateCommonMsg() msg = GPRS_response(DEV_ID=self.carId).generateMsg()
self.sendMsg(msg)
self.sn = self.sn + 1
type = self.getMsgFunId(msg)
self.websocket.sendMsgToClient(type + ">>>>查询GPSR通信参数应答:" + msg,self.websocketId)
elif msgFunId == "8201":
msg = Common_response(DEV_ID=self.carId,resId="8201").generateCommonMsg()
self.sendMsg(msg)
self.sn = self.sn + 1
type = self.getMsgFunId(msg)
self.websocket.sendMsgToClient(type + ">>>>终端重启应答:" + msg,self.websocketId)
elif msgFunId == "8205":
msg = Common_response(DEV_ID=self.carId,resId="8205").generateCommonMsg()
self.sendMsg(msg) self.sendMsg(msg)
self.sn = self.sn + 1 self.sn = self.sn + 1
type = self.getMsgFunId(msg) type = self.getMsgFunId(msg)
self.websocket.sendMsgToClient(type + ">>>>设置GPSR通信参数应答:" + msg,self.websocketId) self.websocket.sendMsgToClient(type + ">>>>设置GPSR通信参数应答:" + msg,self.websocketId)
elif msgFunId == "8206": elif msgFunId == "8206":
msg = Common_response(resId="8206").generateCommonMsg() msg = Common_response(DEV_ID=self.carId,resId="8206").generateCommonMsg()
self.sendMsg(msg) self.sendMsg(msg)
self.sn = self.sn + 1 self.sn = self.sn + 1
type = self.getMsgFunId(msg) type = self.getMsgFunId(msg)
self.websocket.sendMsgToClient(type + ">>>>设置车辆OBD适配信息应答:" + msg,self.websocketId) self.websocket.sendMsgToClient(type + ">>>>设置车辆OBD适配信息应答:" + msg,self.websocketId)
elif msgFunId == "8300": elif msgFunId == "8300":
msg = Update_response().generateUpdateMsg() msg = Update_response(DEV_ID=self.carId).generateUpdateMsg()
self.sendMsg(msg) self.sendMsg(msg)
self.sn = self.sn + 1 self.sn = self.sn + 1
type = self.getMsgFunId(msg) type = self.getMsgFunId(msg)
......
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
</div> </div>
</li> </li>
</ul> </ul>
<sapn><label>报警类别:</label><input id="alarmType" type="text" class="form-control" value="0001"></sapn>
</div> </div>
<H3 style="border-bottom: 1px solid #eee;">控制:</H3> <H3 style="border-bottom: 1px solid #eee;">控制:</H3>
<div style="width:100%;padding:5px;margin-top:10px;"> <div style="width:100%;padding:5px;margin-top:10px;">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment