Commit 2adbecfa authored by liyuanhong's avatar liyuanhong

M500 协议,修改了事件上报页面

parent dc0ca6a8
......@@ -135,9 +135,9 @@ class EventClass(ProtocolBase):
# 0020 急加速报警附带信息
def rapidlyAccelerateExtraInfo(self,totalRapidlyAccelerateCount=100,totalSharpSlowdown=200,totalSharpTurn=50,dataProperty=2):
totalRapidlyAccelerateCount = totalRapidlyAccelerateCount #急加速总次数
totalSharpSlowdown = totalSharpSlowdown #急减速总次数
totalSharpTurn = totalSharpTurn #急转弯总次数
totalRapidlyAccelerateCount = totalRapidlyAccelerateCount #急加速总次数
totalSharpSlowdown = totalSharpSlowdown #急减速总次数
totalSharpTurn = totalSharpTurn #急转弯总次数
dataProperty = dataProperty #事件属性,1:表示事件发生时刻,前10秒的事件采样数据;2:表示事件发生时刻,后10秒的事件采样数据;
GPSSampleData = self.GPSDataFromSeconds(10) #GPS 采样点 ,N秒内的GPS采样数据,170个字节
CANSampleData = self.CANDataFromSeconds(10) #CAN采样点 ,N秒内的CAN采样数据,90个字节
......@@ -150,11 +150,11 @@ class EventClass(ProtocolBase):
return data
# 0021 急减速报警附带信息
def sharpSlowdownExtraInfo(self):
totalRapidlyAccelerateCount = 100 #急加速总次数
totalSharpSlowdown = 200 #急减速总次数
totalSharpTurn = 50 #急转弯总次数
dataProperty = 2 #事件属性,1:表示事件发生时刻,前10秒的事件采样数据;2:表示事件发生时刻,后10秒的事件采样数据;
def sharpSlowdownExtraInfo(self,totalRapidlyAccelerateCount=100,totalSharpSlowdown=200,totalSharpTurn=50,dataProperty=2):
totalRapidlyAccelerateCount = totalRapidlyAccelerateCount #急加速总次数
totalSharpSlowdown = totalSharpSlowdown #急减速总次数
totalSharpTurn = totalSharpTurn #急转弯总次数
dataProperty = dataProperty #事件属性,1:表示事件发生时刻,前10秒的事件采样数据;2:表示事件发生时刻,后10秒的事件采样数据;
GPSSampleData = self.GPSDataFromSeconds(10) #GPS 采样点 ,N秒内的GPS采样数据,170个字节
CANSampleData = self.CANDataFromSeconds(10) #CAN采样点 ,N秒内的CAN采样数据,90个字节
SENSORSampleData = self.SENSORDataFromSeconds(20) #SENSOR采样点 ,N秒内的SENSOR采样数据
......@@ -166,19 +166,21 @@ class EventClass(ProtocolBase):
return data
# 0022 急转弯报警附带信息
def sharpTurnExtraInfo(self):
totalRapidlyAccelerateCount = 100 #急加速总次数
totalSharpSlowdown = 200 #急减速总次数
totalSharpTurn = 50 #急转弯总次数
dataProperty = 2 #事件属性,1:表示事件发生时刻,前10秒的事件采样数据;2:表示事件发生时刻,后10秒的事件采样数据;
def sharpTurnExtraInfo(self,totalRapidlyAccelerateCount=100,totalSharpSlowdown=200,totalSharpTurn=50,direction=0,dataProperty=2):
totalRapidlyAccelerateCount = totalRapidlyAccelerateCount #急加速总次数
totalSharpSlowdown = totalSharpSlowdown #急减速总次数
totalSharpTurn = totalSharpTurn #急转弯总次数
direction = direction #急转弯方向,0:向右转;1:向左转
dataProperty = dataProperty #事件属性,1:表示事件发生时刻,前10秒的事件采样数据;2:表示事件发生时刻,后10秒的事件采样数据;
GPSSampleData = self.GPSDataFromSeconds(10) #GPS 采样点 ,N秒内的GPS采样数据,170个字节
CANSampleData = self.CANDataFromSeconds(10) #CAN采样点 ,N秒内的CAN采样数据,90个字节
SENSORSampleData = self.SENSORDataFromSeconds(20) #SENSOR采样点 ,N秒内的SENSOR采样数据
totalRapidlyAccelerateCount = self.int2hexStringByBytes(totalRapidlyAccelerateCount,2)
totalSharpSlowdown = self.int2hexStringByBytes(totalSharpSlowdown,2)
totalSharpTurn = self.int2hexStringByBytes(totalSharpTurn,2)
direction = self.int2hexStringByBytes(direction)
dataProperty = self.int2hexStringByBytes(dataProperty,1)
data = totalRapidlyAccelerateCount + totalSharpSlowdown + totalSharpTurn + dataProperty + GPSSampleData + CANSampleData + SENSORSampleData
data = totalRapidlyAccelerateCount + totalSharpSlowdown + totalSharpTurn + direction + dataProperty + GPSSampleData + CANSampleData + SENSORSampleData
return data
#0023 碰撞报警附带信息
......
......@@ -246,7 +246,7 @@ class EventReport_protocol(ProtocolBase):
eventObj = EventClass()
eventObj.setGPSpkg(self.GPSPkg)
eventObj.setSecurityData(self.securityPkg)
theData = eventObj.rapidlyAccelerateExtraInfo(int(eventData["0021"]["allRapidlyAccelerateCount"]),
theData = eventObj.sharpSlowdownExtraInfo(int(eventData["0021"]["allRapidlyAccelerateCount"]),
int(eventData["0021"]["allSharpSlowdownCount"]),
int(eventData["0021"]["allSharpTurn"]),
int(eventData["0021"]["dataProperty"]))
......@@ -255,9 +255,10 @@ class EventReport_protocol(ProtocolBase):
eventObj = EventClass()
eventObj.setGPSpkg(self.GPSPkg)
eventObj.setSecurityData(self.securityPkg)
theData = eventObj.rapidlyAccelerateExtraInfo(int(eventData["0022"]["allRapidlyAccelerateCount"]),
theData = eventObj.sharpTurnExtraInfo(int(eventData["0022"]["allRapidlyAccelerateCount"]),
int(eventData["0022"]["allSharpSlowdownCount"]),
int(eventData["0022"]["allSharpTurn"]),
int(eventData["0022"]["direction"]),
int(eventData["0022"]["dataProperty"]))
data = data + "0020" + self.int2hexStringByBytes(int((len(theData) / 2)), 2) + theData
if ("0036" in eventData.keys()): #低档高速报警
......
......@@ -43,6 +43,9 @@ class ProtocolSimulaterDataService():
data["travelData"]["totalMilleage"] = 0 #行驶总里程
data["travelData"]["totalOil"] = 0 #行驶总油耗
data["travelData"]["totalTime"] = 0 #行驶总时间
data["event"] = {}
return data
#设今日行驶总里程,同时写入文件
......
......@@ -345,6 +345,10 @@
<span><label>急加速总次数:</label><input style="width:80px;" id="ST_allRapidlyAccelerateCount" type="text" class="form-control" value="5"></span>
<span><label>急减速总次数:</label><input style="width:80px;" id="ST_allSharpSlowdownCount" type="text" class="form-control" value="6"></span>
<span><label>急转弯总次数:</label><input style="width:80px;" id="ST_allSharpTurn" type="text" class="form-control" value="4"></span>
<span><label>急转弯方向:</label><select style="width:100px;" id="ST_direction" class="form-control">
<option value="0">向右转</option>
<option value="1">向左转</option>
</select></span>
<span><label>数据属性:</label><select style="width:200px;" id="ST_dataProperty" class="form-control">
<option value="1">前10秒的事件采样数据</option>
<option value="2">后10秒的事件采样数据</option>
......@@ -631,6 +635,7 @@ function get0022(){ //获取急转弯
data["allRapidlyAccelerateCount"] = $("#ST_allRapidlyAccelerateCount").val();
data["allSharpSlowdownCount"] = $("#ST_allSharpSlowdownCount").val();
data["allSharpTurn"] = $("#ST_allSharpTurn").val();
data["direction"] = $("#ST_direction").val();
data["dataProperty"] = $("#ST_dataProperty").val();
return data
}
......
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