Commit 2b42d4f3 authored by liyuanhong's avatar liyuanhong

车安优图形模拟器增加急左变道和急右变道功能

parent e1f21335
...@@ -36,19 +36,20 @@ class AlarmEvent_data(MessageBase): ...@@ -36,19 +36,20 @@ class AlarmEvent_data(MessageBase):
fatigueDriving = "0108" + self.int2hexStringByBytes(5) + self.getFatigueDriving() fatigueDriving = "0108" + self.int2hexStringByBytes(5) + self.getFatigueDriving()
#水温报警 附带信息见 表 C6EXT4 #水温报警 附带信息见 表 C6EXT4
waterTemperatureAlarm = "0109" + self.int2hexStringByBytes(9) + self.getWaterTemperatureAlarm() waterTemperatureAlarm = "0109" + self.int2hexStringByBytes(9) + self.getWaterTemperatureAlarm()
highSpeedNeutralGear = "010A" + self.int2hexStringByBytes(0) #高速空档滑行报警 highSpeedNeutralGear = "010A" + self.int2hexStringByBytes(0) # 高速空档滑行报警
oilExpendNotSurport = "010B" +self.int2hexStringByBytes(0) #油耗不支持报警 oilExpendNotSurport = "010B" +self.int2hexStringByBytes(0) # 油耗不支持报警
OBDNotSurport = "010C" + self.int2hexStringByBytes(0) #OBD 不支持报警 OBDNotSurport = "010C" + self.int2hexStringByBytes(0) # OBD 不支持报警
lowWaterTemperatureHighSpeed = "010D" +self.int2hexStringByBytes(0) #低水温高转速 lowWaterTemperatureHighSpeed = "010D" +self.int2hexStringByBytes(0) # 低水温高转速
buslineNotSleep = "010E" + self.int2hexStringByBytes(0) #总线不睡眠报警 buslineNotSleep = "010E" + self.int2hexStringByBytes(0) # 总线不睡眠报警
illegalOpenDoor = "010f" + self.int2hexStringByBytes(0) #非法开门 illegalOpenDoor = "010f" + self.int2hexStringByBytes(0) # 非法开门
illegalFire = "0110" + self.int2hexStringByBytes(0) #非法点火 illegalFire = "0110" + self.int2hexStringByBytes(0) # 非法点火
rapidAccelerateAlarm = "0111" + self.int2hexStringByBytes(0) #急加速报警 rapidAccelerateAlarm = "0111" + self.int2hexStringByBytes(0) # 急加速报警
sharpSlowdownAlarm = "0112" + self.int2hexStringByBytes(0) #急减速报警 sharpSlowdownAlarm = "0112" + self.int2hexStringByBytes(0) # 急减速报警
sharpBendAlarm = "0113" + self.int2hexStringByBytes(0) #急左拐弯报警 sharpBendAlarm = "0113" + self.int2hexStringByBytes(0) # 急左拐弯报警
crashAlarm = "0114" + self.int2hexStringByBytes(0) #碰撞报警 crashAlarm = "0114" + self.int2hexStringByBytes(0) # 碰撞报警
rapidChangeLines = "0115" + self.int2hexStringByBytes(0) #急变道报警 rapidChangeLines = "0115" + self.int2hexStringByBytes(0) # 急左变道报警
sharpRightBendAlarm = "0117" + self.int2hexStringByBytes(0) #急右拐弯报警 rapidChangeRightLines = "0116" + self.int2hexStringByBytes(0) # 急右变道报警
sharpRightBendAlarm = "0117" + self.int2hexStringByBytes(0) # 急右拐弯报警
data = ignition data = ignition
...@@ -148,7 +149,10 @@ class AlarmEvent_data(MessageBase): ...@@ -148,7 +149,10 @@ class AlarmEvent_data(MessageBase):
crashAlarm = "0114" + self.int2hexStringByBytes(0) #碰撞报警 crashAlarm = "0114" + self.int2hexStringByBytes(0) #碰撞报警
dataHex = dataHex + crashAlarm dataHex = dataHex + crashAlarm
if ("rapidChangeLines" in data.keys()): if ("rapidChangeLines" in data.keys()):
rapidChangeLines = "0115" + self.int2hexStringByBytes(0) #急变道报警 rapidChangeLines = "0115" + self.int2hexStringByBytes(0) #急左变道报警
dataHex = dataHex + rapidChangeLines
if ("rapidChangeRightLines" in data.keys()):
rapidChangeLines = "0116" + self.int2hexStringByBytes(0) #急右变道报警
dataHex = dataHex + rapidChangeLines dataHex = dataHex + rapidChangeLines
if ("sharpRightBendAlarm" in data.keys()): if ("sharpRightBendAlarm" in data.keys()):
sharpBendAlarm = "0117" + self.int2hexStringByBytes(0) #急右拐弯报警 sharpBendAlarm = "0117" + self.int2hexStringByBytes(0) #急右拐弯报警
......
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
margin-top: 5px; margin-top: 5px;
margin-bottom: 5px; margin-bottom: 5px;
} }
button.btn.btn-primary {
margin-bottom: 2px;
}
</style> </style>
<div id="container2" style="width:83%;min-height:750px;float:left;_background:grey;margin-top:50px;"> <div id="container2" style="width:83%;min-height:750px;float:left;_background:grey;margin-top:50px;">
{% block content_02 %} {% block content_02 %}
...@@ -155,6 +158,8 @@ ...@@ -155,6 +158,8 @@
<label style="padding: 0px 10px;"><input type="checkbox" id="waterTemperatureAlarm_check" onclick="eventSelect(this)" checked />水温报警 </label> <label style="padding: 0px 10px;"><input type="checkbox" id="waterTemperatureAlarm_check" onclick="eventSelect(this)" checked />水温报警 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="highSpeedNeutralGear_check" onclick="eventSelect(this)" checked />高速空挡滑行 </label> <label style="padding: 0px 10px;"><input type="checkbox" id="highSpeedNeutralGear_check" onclick="eventSelect(this)" checked />高速空挡滑行 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="crashAlarm_check" onclick="eventSelect(this)" checked />碰撞告警 </label> <label style="padding: 0px 10px;"><input type="checkbox" id="crashAlarm_check" onclick="eventSelect(this)" checked />碰撞告警 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="rapidChangeLeftLines_check" onclick="eventSelect(this)" checked />急左变道 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="rapidChangeRightLines_check" onclick="eventSelect(this)" checked />急右变道 </label>
</div> </div>
<div style="padding:10px;"> <div style="padding:10px;">
<span id="insertAlarm_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendInsertAlarmEvent(this)">终端插入报警</button></label></span> <span id="insertAlarm_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendInsertAlarmEvent(this)">终端插入报警</button></label></span>
...@@ -171,6 +176,8 @@ ...@@ -171,6 +176,8 @@
<span id="waterTemperatureAlarm_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendWaterTemperatureAlarmEvent(this)">水温报警</button></label></span> <span id="waterTemperatureAlarm_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendWaterTemperatureAlarmEvent(this)">水温报警</button></label></span>
<span id="highSpeedNeutralGear_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendHighSpeedNeutralGearEvent(this)">高速空挡滑行</button></label></span> <span id="highSpeedNeutralGear_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendHighSpeedNeutralGearEvent(this)">高速空挡滑行</button></label></span>
<span id="crashAlarm_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendCrashAlarmEvent(this)">碰撞告警</button></label></span> <span id="crashAlarm_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendCrashAlarmEvent(this)">碰撞告警</button></label></span>
<span id="rapidChangeLeftLines_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendRapidChangeLeftLinesEvent(this)">急左变道</button></label></span>
<span id="rapidChangeRightLines_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendRapidChangeRightLinesEvent(this)">急右变道</button></label></span>
</div> </div>
</div> </div>
</div> </div>
...@@ -801,6 +808,10 @@ function eventSelect(e){ ...@@ -801,6 +808,10 @@ function eventSelect(e){
$("#highSpeedNeutralGear_button").css("display","inline") $("#highSpeedNeutralGear_button").css("display","inline")
}else if($(e).attr("id") == "crashAlarm_check"){ }else if($(e).attr("id") == "crashAlarm_check"){
$("#crashAlarm_button").css("display","inline") $("#crashAlarm_button").css("display","inline")
}else if($(e).attr("id") == "rapidChangeLeftLines_check"){
$("#rapidChangeLeftLines_button").css("display","inline")
}else if($(e).attr("id") == "rapidChangeRightLines_check"){
$("#rapidChangeRightLines_button").css("display","inline")
} }
}else{ }else{
if($(e).attr("id") == "insertAlarm_check"){ if($(e).attr("id") == "insertAlarm_check"){
...@@ -835,6 +846,10 @@ function eventSelect(e){ ...@@ -835,6 +846,10 @@ function eventSelect(e){
$("#highSpeedNeutralGear_button").css("display","none") $("#highSpeedNeutralGear_button").css("display","none")
}else if($(e).attr("id") == "crashAlarm_check"){ }else if($(e).attr("id") == "crashAlarm_check"){
$("#crashAlarm_button").css("display","none") $("#crashAlarm_button").css("display","none")
}else if($(e).attr("id") == "rapidChangeLeftLines_check"){
$("#rapidChangeLeftLines_button").css("display","none")
}else if($(e).attr("id") == "rapidChangeRightLines_check"){
$("#rapidChangeRightLines_button").css("display","none")
} }
} }
} }
...@@ -938,6 +953,20 @@ function sendCrashAlarmEvent(){ ...@@ -938,6 +953,20 @@ function sendCrashAlarmEvent(){
var url = "http://" + host + "/messageTools/M_simulater_process/sendCrashAlarmEvent"; var url = "http://" + host + "/messageTools/M_simulater_process/sendCrashAlarmEvent";
sendHttpMsg(data,url); sendHttpMsg(data,url);
} }
//发送急左变道告警消息
function sendRapidChangeLeftLinesEvent(){
var data = getPageData();
var host = window.location.host;
var url = "http://" + host + "/messageTools/M_simulater_process/sendapidChangeLeftLines";
sendHttpMsg(data,url);
}
//发送急右变道告警消息
function sendRapidChangeRightLinesEvent(){
var data = getPageData();
var host = window.location.host;
var url = "http://" + host + "/messageTools/M_simulater_process/sendapidChangeRightLines";
sendHttpMsg(data,url);
}
// -------------------------------- 实时控制js代码------------------------------------------- // -------------------------------- 实时控制js代码-------------------------------------------
//设置隐藏或显示实时控制区域 //设置隐藏或显示实时控制区域
function isShowRealTimeCtrArea(e){ function isShowRealTimeCtrArea(e){
......
...@@ -691,9 +691,11 @@ ...@@ -691,9 +691,11 @@
<li style="width:80px;"><label style="width:70px"><input type="checkbox" id="illegalFire_AE" />非法点火</label> </li> <li style="width:80px;"><label style="width:70px"><input type="checkbox" id="illegalFire_AE" />非法点火</label> </li>
<li style="width:100px;"><label style="width:90px"><input type="checkbox" id="rapidAccelerateAlarm" />急加速报警</label> </li> <li style="width:100px;"><label style="width:90px"><input type="checkbox" id="rapidAccelerateAlarm" />急加速报警</label> </li>
<li style="width:100px;"><label style="width:90px"><input type="checkbox" id="sharpSlowdownAlarm" />急减速报警</label> </li> <li style="width:100px;"><label style="width:90px"><input type="checkbox" id="sharpSlowdownAlarm" />急减速报警</label> </li>
<li style="width:100px;"><label style="width:90px"><input type="checkbox" id="sharpBendAlarm" />急拐弯报警</label> </li> <li style="width:110px;"><label style="width:100px"><input type="checkbox" id="sharpBendAlarm" />急左拐弯报警</label> </li>
<li style="width:110px;"><label style="width:100px"><input type="checkbox" id="sharpRightBendAlarm" />急右拐弯报警</label> </li>
<li style="width:80px;"><label style="width:70px"><input type="checkbox" id="crashAlarm" />碰撞报警</label> </li> <li style="width:80px;"><label style="width:70px"><input type="checkbox" id="crashAlarm" />碰撞报警</label> </li>
<li style="width:100px;"><label style="width:90px"><input type="checkbox" id="rapidChangeLines" />急变道报警</label> </li> <li style="width:110px;"><label style="width:100px"><input type="checkbox" id="rapidChangeLines" />急左变道报警</label> </li>
<li style="width:110px;"><label style="width:100px"><input type="checkbox" id="rapidChangeRightLines" />急右变道报警</label> </li>
</ul> </ul>
</div> </div>
<div id="alarm_idlingSpeedOver" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;"> <div id="alarm_idlingSpeedOver" style="display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;">
...@@ -1424,6 +1426,10 @@ function getExtra_FA(){ ...@@ -1424,6 +1426,10 @@ function getExtra_FA(){
var sharpBendAlarm = $("#sharpBendAlarm").val(); var sharpBendAlarm = $("#sharpBendAlarm").val();
data["sharpBendAlarm"] = sharpBendAlarm; data["sharpBendAlarm"] = sharpBendAlarm;
} }
if($("#sharpRightBendAlarm").is(':checked')){
var sharpRightBendAlarm = $("#sharpRightBendAlarm").val();
data["sharpRightBendAlarm"] = sharpRightBendAlarm;
}
if($("#crashAlarm").is(':checked')){ if($("#crashAlarm").is(':checked')){
var crashAlarm = $("#crashAlarm").val(); var crashAlarm = $("#crashAlarm").val();
data["crashAlarm"] = crashAlarm; data["crashAlarm"] = crashAlarm;
...@@ -1432,6 +1438,10 @@ function getExtra_FA(){ ...@@ -1432,6 +1438,10 @@ function getExtra_FA(){
var rapidChangeLines = $("#rapidChangeLines").val(); var rapidChangeLines = $("#rapidChangeLines").val();
data["rapidChangeLines"] = rapidChangeLines; data["rapidChangeLines"] = rapidChangeLines;
} }
if($("#rapidChangeRightLines").is(':checked')){
var rapidChangeRightLines = $("#rapidChangeRightLines").val();
data["rapidChangeRightLines"] = rapidChangeRightLines;
}
return data; return data;
} }
function getIdlingSpeedOver(){ //获取怠速过长附带信息 function getIdlingSpeedOver(){ //获取怠速过长附带信息
......
...@@ -506,6 +506,7 @@ ...@@ -506,6 +506,7 @@
// strokeStyle: "solid" //线样式 // strokeStyle: "solid" //线样式
}); });
map.setCenter(centerPoint); map.setCenter(centerPoint);
$("#lineData1").val(JSON.stringify(data, null, 4));
}else{ }else{
alert(data.message); alert(data.message);
} }
......
...@@ -1066,6 +1066,97 @@ def sendCrashAlarmEvent(): ...@@ -1066,6 +1066,97 @@ def sendCrashAlarmEvent():
data["status"] = "4003" data["status"] = "4003"
data["message"] = "Error: 发送碰撞告警事件失败!" data["message"] = "Error: 发送碰撞告警事件失败!"
return Response(json.dumps(data), mimetype='application/json') return Response(json.dumps(data), mimetype='application/json')
##########################################
# 【接口类型】发送急左变道告警事件
##########################################
@M_simulater_process.route("/sendapidChangeLeftLines",methods=['POST'])
def sendapidChangeLeftLines():
params = request.get_data()
params = json.loads(params.decode("utf-8"))
sessionId = params["session"]["sessionId"]
data = {}
if not sessionId in connects.keys():
data["status"] = "4003"
data["message"] = "Error: 未启动服务,不可发送急左变道告警事件!"
return Response(json.dumps(data), mimetype='application/json')
service = connects[sessionId]["service"]
try:
jdata = {"msgID": "0200", "phoneNum": "13146201119", "msgWaterCode": "1", "encryptionType": "0",
"subPkg": "0",
"pkgCounts": "0",
"baseInfo": {"alarmFlag": 0, "status": 262402, "latitude": 29.40268, "longtitude": 106.54041,
"elevation": "521", "speed": "66", "directionAngle": "59",
"infoTime": "2020-05-28 14:20:04"},
"extraInfo": {"FA": {"rapidChangeLines": "on"}}}
timeStamp = time.time()
timeArray = time.localtime(timeStamp)
curTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
jdata["phoneNum"] = params["phoneNum"]
jdata["msgWaterCode"] = service.getSn()
jdata["baseInfo"]["infoTime"] = curTime
jdata["baseInfo"]["latitude"] = service.getCurLatitude()
jdata["baseInfo"]["longtitude"] = service.getCurLongtitude()
jdata["baseInfo"]["directionAngle"] = service.getDirAngle()
msgObj = Location_msg()
msg = msgObj.generateMsg_GUI(jdata)
service.serviceSendMsg(msg)
service.setSn(service.getSn() + 1)
data["status"] = "200"
data["message"] = "发送急左变道告警事件成功!"
except BaseException as e:
# 打印异常信息
traceback.print_exc()
data["status"] = "4003"
data["message"] = "Error: 发送急左变道告警事件失败!"
return Response(json.dumps(data), mimetype='application/json')
##########################################
# 【接口类型】发送急右变道告警事件
##########################################
@M_simulater_process.route("/sendapidChangeRightLines",methods=['POST'])
def sendapidChangeRightLines():
params = request.get_data()
params = json.loads(params.decode("utf-8"))
sessionId = params["session"]["sessionId"]
data = {}
if not sessionId in connects.keys():
data["status"] = "4003"
data["message"] = "Error: 未启动服务,不可发送急右变道告警事件!"
return Response(json.dumps(data), mimetype='application/json')
service = connects[sessionId]["service"]
try:
jdata = {"msgID": "0200", "phoneNum": "13146201119", "msgWaterCode": "1", "encryptionType": "0",
"subPkg": "0",
"pkgCounts": "0",
"baseInfo": {"alarmFlag": 0, "status": 262402, "latitude": 29.40268, "longtitude": 106.54041,
"elevation": "521", "speed": "66", "directionAngle": "59",
"infoTime": "2020-05-28 14:20:04"},
"extraInfo": {"FA": {"rapidChangeRightLines": "on"}}}
timeStamp = time.time()
timeArray = time.localtime(timeStamp)
curTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
jdata["phoneNum"] = params["phoneNum"]
jdata["msgWaterCode"] = service.getSn()
jdata["baseInfo"]["infoTime"] = curTime
jdata["baseInfo"]["latitude"] = service.getCurLatitude()
jdata["baseInfo"]["longtitude"] = service.getCurLongtitude()
jdata["baseInfo"]["directionAngle"] = service.getDirAngle()
msgObj = Location_msg()
msg = msgObj.generateMsg_GUI(jdata)
service.serviceSendMsg(msg)
service.setSn(service.getSn() + 1)
data["status"] = "200"
data["message"] = "发送急右变道告警事件成功!"
except BaseException as e:
# 打印异常信息
traceback.print_exc()
data["status"] = "4003"
data["message"] = "Error: 发送急右变道告警事件失败!"
return Response(json.dumps(data), mimetype='application/json')
#--------------------------------------- 实时控制逻辑 --------------------------------------- #--------------------------------------- 实时控制逻辑 ---------------------------------------
########################################## ##########################################
# 【接口类型】改变车速 # 【接口类型】改变车速
......
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