Commit dc0ca6a8 authored by liyuanhong's avatar liyuanhong

M500 协议,增加了急加速、急减速、急转弯事件

parent fb0bfbbc
......@@ -134,11 +134,11 @@ class EventClass(ProtocolBase):
return data
# 0020 急加速报警附带信息
def rapidlyAccelerateExtraInfo(self):
totalRapidlyAccelerateCount = 100 #急加速总次数
totalSharpSlowdown = 200 #急减速总次数
totalSharpTurn = 50 #急转弯总次数
dataProperty = 2 #事件属性,1:表示事件发生时刻,前10秒的事件采样数据;2:表示事件发生时刻,后10秒的事件采样数据;
def rapidlyAccelerateExtraInfo(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采样数据
......
......@@ -236,6 +236,30 @@ class EventReport_protocol(ProtocolBase):
eventObj.setSecurityData(self.securityPkg)
theData = eventObj.setDownDefencesExtraInfo()
data = data + "0013" + self.int2hexStringByBytes(int((len(theData) / 2)), 2) + theData
if ("0020" in eventData.keys()): #急加速
eventObj = EventClass()
eventObj.setGPSpkg(self.GPSPkg)
eventObj.setSecurityData(self.securityPkg)
theData = eventObj.rapidlyAccelerateExtraInfo(int(eventData["0020"]["allRapidlyAccelerateCount"]),int(eventData["0020"]["allSharpSlowdownCount"]),int(eventData["0020"]["allSharpTurn"]),int(eventData["0020"]["dataProperty"]))
data = data + "0020" + self.int2hexStringByBytes(int((len(theData) / 2)), 2) + theData
if ("0021" in eventData.keys()): #急减速
eventObj = EventClass()
eventObj.setGPSpkg(self.GPSPkg)
eventObj.setSecurityData(self.securityPkg)
theData = eventObj.rapidlyAccelerateExtraInfo(int(eventData["0021"]["allRapidlyAccelerateCount"]),
int(eventData["0021"]["allSharpSlowdownCount"]),
int(eventData["0021"]["allSharpTurn"]),
int(eventData["0021"]["dataProperty"]))
data = data + "0020" + self.int2hexStringByBytes(int((len(theData) / 2)), 2) + theData
if ("0022" in eventData.keys()): #急转弯
eventObj = EventClass()
eventObj.setGPSpkg(self.GPSPkg)
eventObj.setSecurityData(self.securityPkg)
theData = eventObj.rapidlyAccelerateExtraInfo(int(eventData["0022"]["allRapidlyAccelerateCount"]),
int(eventData["0022"]["allSharpSlowdownCount"]),
int(eventData["0022"]["allSharpTurn"]),
int(eventData["0022"]["dataProperty"]))
data = data + "0020" + self.int2hexStringByBytes(int((len(theData) / 2)), 2) + theData
if ("0036" in eventData.keys()): #低档高速报警
eventObj = EventClass()
theData = eventObj.lowGearHighSpeedAlarm(int(eventData["0036"]["alarmType"]),int(eventData["0036"]["durationTime"]))
......
......@@ -115,43 +115,43 @@
<span style="margin-left:20px;"><label>当前状态:</label><input id="curStatus" value="断网" disabled="disabled" class="form-control" style="font-weight: bold;width:85px;color:red;border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px;"></span>
<span style="width:80px;padding-left:10px;"><label style="width:70px"><input type="checkbox" id="ignition" onclick="isLogShow(this)"/>隐藏日志</label> </span>
</div>
<!--<div style="display: block; width: 100%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;">
<h5><b>事件发送:</b>
<span style="border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:1px 10px;">
<label><input name="eventshow" type="radio" value="0" checked="checked" onclick="isShowEventArea(this)"/>隐藏</label>
<label style="margin-left:10px;"><input name="eventshow" type="radio" value="1" onclick="isShowEventArea(this)"/>显示</label>
</span>
</h5>
<div id="event_area" style="display:none;">
<div style="margin-top:10px;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;background:skyblue;">
<label style="padding: 0px 10px;"><input type="checkbox" id="rapidlyAccelerateEvent_check" onclick="eventSelect(this)"/>急加速 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="bbb" onclick="eventSelect(this)"/>急减速 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="ccc" onclick="eventSelect(this)"/>急转弯 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="0003" onclick="eventSelect(this)"/>汽车电瓶低电压报警 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="0004" onclick="eventSelect(this)"/>终端主电断电报警 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="0012" onclick="eventSelect(this)"/>设防 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="0013" onclick="eventSelect(this)"/>撤防 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="0036" onclick="eventSelect(this)"/>低档高速报警 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="0037" onclick="eventSelect(this)"/>高档低速报警 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="004A" onclick="eventSelect(this)"/>剩余油量异常告警 </label>
</div>
<div style="padding:10px;">
<span id="rapidlyAccelerateEvent_button" style="display:none;"><button id="a" type="button" class="btn btn-primary" onclick="sendRapidlyAccelerateEvent(this)">急加速</button></label></span>
<span><label>在线人数:</label><input disabled=disabled type="text" id="b" class="form-control" style="display:inline;width:80px;" value="1"/></span>
</div>
</div>
</div>
<div style="display: block; width: 100%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;">
<h5><b>实时控制:</b>
<span style="border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:1px 10px;">
<label><input name="realtime" type="radio" value="0" checked="checked" onclick="isShowRealTimeCtrArea(this)"/>隐藏</label>
<label style="margin-left:10px;"><input name="realtime" type="radio" value="1" onclick="isShowRealTimeCtrArea(this)"/>显示</label>
</span>
</h5>
<div id="realTimeCtl_area" style="display:none;">
实时控制
</div>
</div> -->
<!-- <div style="display: block; width: 100%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;">-->
<!-- <h5><b>事件发送:</b>-->
<!-- <span style="border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:1px 10px;">-->
<!-- <label><input name="eventshow" type="radio" value="0" checked="checked" onclick="isShowEventArea(this)"/>隐藏</label>-->
<!-- <label style="margin-left:10px;"><input name="eventshow" type="radio" value="1" onclick="isShowEventArea(this)"/>显示</label>-->
<!-- </span>-->
<!-- </h5>-->
<!-- <div id="event_area" style="display:none;">-->
<!-- <div style="margin-top:10px;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;background:skyblue;">-->
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="rapidlyAccelerateEvent_check" onclick="eventSelect(this)"/>急加速 </label>-->
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="bbb" onclick="eventSelect(this)"/>急减速 </label>-->
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="ccc" onclick="eventSelect(this)"/>急转弯 </label>-->
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0003" onclick="eventSelect(this)"/>汽车电瓶低电压报警 </label>-->
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0004" onclick="eventSelect(this)"/>终端主电断电报警 </label>-->
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0012" onclick="eventSelect(this)"/>设防 </label>-->
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0013" onclick="eventSelect(this)"/>撤防 </label>-->
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0036" onclick="eventSelect(this)"/>低档高速报警 </label>-->
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0037" onclick="eventSelect(this)"/>高档低速报警 </label>-->
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="004A" onclick="eventSelect(this)"/>剩余油量异常告警 </label>-->
<!-- </div>-->
<!-- <div style="padding:10px;">-->
<!-- <span id="rapidlyAccelerateEvent_button" style="display:none;"><button id="a" type="button" class="btn btn-primary" onclick="sendRapidlyAccelerateEvent(this)">急加速</button></label></span>-->
<!-- <span><label>在线人数:</label><input disabled=disabled type="text" id="b" class="form-control" style="display:inline;width:80px;" value="1"/></span>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div style="display: block; width: 100%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;">-->
<!-- <h5><b>实时控制:</b>-->
<!-- <span style="border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:1px 10px;">-->
<!-- <label><input name="realtime" type="radio" value="0" checked="checked" onclick="isShowRealTimeCtrArea(this)"/>隐藏</label>-->
<!-- <label style="margin-left:10px;"><input name="realtime" type="radio" value="1" onclick="isShowRealTimeCtrArea(this)"/>显示</label>-->
<!-- </span>-->
<!-- </h5>-->
<!-- <div id="realTimeCtl_area" style="display:none;">-->
<!-- 实时控制-->
<!-- </div>-->
<!-- </div>-->
<div style="width:100%;padding-bottom:60px;border-bottom: 1px solid #eee;">
<h3>日志:</h3>
<textarea id="showFeedback" style="width:100%;padding:5px;padding-bottom:60px;" rows="10"></textarea>
......
......@@ -300,9 +300,9 @@
<label style="padding: 0px 10px;"><input type="checkbox" id="0012" onclick="eventSelect(this)"/>设防 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="0013" onclick="eventSelect(this)"/>撤防 </label>
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0020" onclick="eventSelect(this)"/>急加速 </label>-->
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0021" onclick="eventSelect(this)"/>急减速 </label>-->
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0022" onclick="eventSelect(this)"/>急转弯 </label>-->
<label style="padding: 0px 10px;"><input type="checkbox" id="0020" onclick="eventSelect(this)"/>急加速 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="0021" onclick="eventSelect(this)"/>急减速 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="0022" onclick="eventSelect(this)"/>急转弯 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="0036" onclick="eventSelect(this)"/>低档高速报警 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="0037" onclick="eventSelect(this)"/>高档低速报警 </label>
......@@ -569,7 +569,6 @@ function getData(){
if($("#0013").is(':checked')){
data["event"]["0013"] = get0013(); //获取撤防事件数据
}
if($("#0020").is(':checked')){
data["event"]["0020"] = get0020(); //获取急加速事件数据
}
......@@ -579,7 +578,6 @@ function getData(){
if($("#0022").is(':checked')){
data["event"]["0022"] = get0022(); //获取急转弯事件数据
}
if($("#0036").is(':checked')){
data["event"]["0036"] = get0036(); //低档高速报警
}
......@@ -622,18 +620,18 @@ function get0020(){ //获取急加速
}
function get0021(){ //获取急减速事件数据
data = {}
data["allRapidlyAccelerateCount"] = $("#RA_allRapidlyAccelerateCount").val();
data["allSharpSlowdownCount"] = $("#RA_allSharpSlowdownCount").val();
data["allSharpTurn"] = $("#RA_allSharpTurn").val();
data["dataProperty"] = $("#RA_dataProperty").val();
data["allRapidlyAccelerateCount"] = $("#SS_allRapidlyAccelerateCount").val();
data["allSharpSlowdownCount"] = $("#SS_allSharpSlowdownCount").val();
data["allSharpTurn"] = $("#SS_allSharpTurn").val();
data["dataProperty"] = $("#SS_dataProperty").val();
return data
}
function get0022(){ //获取急转弯事件数据
data = {}
data["allRapidlyAccelerateCount"] = $("#RA_allRapidlyAccelerateCount").val();
data["allSharpSlowdownCount"] = $("#RA_allSharpSlowdownCount").val();
data["allSharpTurn"] = $("#RA_allSharpTurn").val();
data["dataProperty"] = $("#RA_dataProperty").val();
data["allRapidlyAccelerateCount"] = $("#ST_allRapidlyAccelerateCount").val();
data["allSharpSlowdownCount"] = $("#ST_allSharpSlowdownCount").val();
data["allSharpTurn"] = $("#ST_allSharpTurn").val();
data["dataProperty"] = $("#ST_dataProperty").val();
return data
}
function get0036(){ //低档高速报警
......
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