Commit 6be4db2f authored by liyuanhong's avatar liyuanhong

车安优图形模拟器增加怠速过长解除报警功能

parent 9f8b5c4e
[socket] [socket]
host = 114.116.205.211 host = 172.19.7.13
port = 8003 port = 49008
...@@ -149,6 +149,7 @@ ...@@ -149,6 +149,7 @@
<label style="padding: 0px 10px;"><input type="checkbox" id="sharpTurnEvent_check" onclick="eventSelect(this)" checked />急左转弯 </label> <label style="padding: 0px 10px;"><input type="checkbox" id="sharpTurnEvent_check" onclick="eventSelect(this)" checked />急左转弯 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="sharpRightTurnEvent_check" onclick="eventSelect(this)" checked />急右转弯 </label> <label style="padding: 0px 10px;"><input type="checkbox" id="sharpRightTurnEvent_check" onclick="eventSelect(this)" checked />急右转弯 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="idlingSpeedOver_check" onclick="eventSelect(this)" checked />怠速过长 </label> <label style="padding: 0px 10px;"><input type="checkbox" id="idlingSpeedOver_check" onclick="eventSelect(this)" checked />怠速过长 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="UnIdlingSpeedOver_check" onclick="eventSelect(this)" checked />怠速过长(解除) </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="overspeed_check" onclick="eventSelect(this)" checked />超速报警 </label> <label style="padding: 0px 10px;"><input type="checkbox" id="overspeed_check" onclick="eventSelect(this)" checked />超速报警 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="fatigueDriving_check" onclick="eventSelect(this)" checked />疲劳驾驶 </label> <label style="padding: 0px 10px;"><input type="checkbox" id="fatigueDriving_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="waterTemperatureAlarm_check" onclick="eventSelect(this)" checked />水温报警 </label>
...@@ -164,6 +165,7 @@ ...@@ -164,6 +165,7 @@
<span id="sharpTurnEvent_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendSharpTurnEvent(this)">急左转弯</button></label></span> <span id="sharpTurnEvent_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendSharpTurnEvent(this)">急左转弯</button></label></span>
<span id="sharpRightTurnEvent_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendRightSharpTurnEvent(this)">急右转弯</button></label></span> <span id="sharpRightTurnEvent_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendRightSharpTurnEvent(this)">急右转弯</button></label></span>
<span id="idlingSpeedOver_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendIdlingSpeedOverEvent(this)">怠速过长</button></label></span> <span id="idlingSpeedOver_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendIdlingSpeedOverEvent(this)">怠速过长</button></label></span>
<span id="UnIdlingSpeedOver_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendUnIdlingSpeedOverEvent(this)">怠速过长(解除)</button></label></span>
<span id="overspeed_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendOverspeedEvent(this)">超速报警</button></label></span> <span id="overspeed_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendOverspeedEvent(this)">超速报警</button></label></span>
<span id="fatigueDriving_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendFatigueDrivingEvent(this)">疲劳驾驶</button></label></span> <span id="fatigueDriving_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendFatigueDrivingEvent(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="waterTemperatureAlarm_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendWaterTemperatureAlarmEvent(this)">水温报警</button></label></span>
...@@ -764,6 +766,8 @@ function eventSelect(e){ ...@@ -764,6 +766,8 @@ function eventSelect(e){
$("#setDownDefencesEvent_button").css("display","inline") $("#setDownDefencesEvent_button").css("display","inline")
}else if($(e).attr("id") == "idlingSpeedOver_check"){ }else if($(e).attr("id") == "idlingSpeedOver_check"){
$("#idlingSpeedOver_button").css("display","inline") $("#idlingSpeedOver_button").css("display","inline")
}else if($(e).attr("id") == "UnIdlingSpeedOver_check"){
$("#UnIdlingSpeedOver_button").css("display","inline")
}else if($(e).attr("id") == "overspeed_check"){ }else if($(e).attr("id") == "overspeed_check"){
$("#overspeed_button").css("display","inline") $("#overspeed_button").css("display","inline")
}else if($(e).attr("id") == "fatigueDriving_check"){ }else if($(e).attr("id") == "fatigueDriving_check"){
...@@ -796,6 +800,8 @@ function eventSelect(e){ ...@@ -796,6 +800,8 @@ function eventSelect(e){
$("#setDownDefencesEvent_button").css("display","none") $("#setDownDefencesEvent_button").css("display","none")
}else if($(e).attr("id") == "idlingSpeedOver_check"){ }else if($(e).attr("id") == "idlingSpeedOver_check"){
$("#idlingSpeedOver_button").css("display","none") $("#idlingSpeedOver_button").css("display","none")
}else if($(e).attr("id") == "UnIdlingSpeedOver_check"){
$("#UnIdlingSpeedOver_button").css("display","none")
}else if($(e).attr("id") == "overspeed_check"){ }else if($(e).attr("id") == "overspeed_check"){
$("#overspeed_button").css("display","none") $("#overspeed_button").css("display","none")
}else if($(e).attr("id") == "fatigueDriving_check"){ }else if($(e).attr("id") == "fatigueDriving_check"){
...@@ -867,6 +873,13 @@ function sendIdlingSpeedOverEvent(){ ...@@ -867,6 +873,13 @@ function sendIdlingSpeedOverEvent(){
var url = "http://" + host + "/messageTools/M_simulater_process/sendIdlingSpeedOverEvent"; var url = "http://" + host + "/messageTools/M_simulater_process/sendIdlingSpeedOverEvent";
sendHttpMsg(data,url); sendHttpMsg(data,url);
} }
//发送怠速过长(解除)事件消息
function sendUnIdlingSpeedOverEvent(){
var data = getPageData();
var host = window.location.host;
var url = "http://" + host + "/messageTools/M_simulater_process/sendUnIdlingSpeedOverEvent";
sendHttpMsg(data,url);
}
//发送超速报警消息 //发送超速报警消息
function sendOverspeedEvent(){ function sendOverspeedEvent(){
var data = getPageData(); var data = getPageData();
......
...@@ -763,8 +763,8 @@ def sendIdlingSpeedOverEvent(): ...@@ -763,8 +763,8 @@ def sendIdlingSpeedOverEvent():
"baseInfo": {"alarmFlag": 0, "status": 262402, "latitude": 29.40268, "longtitude": 106.54041, "baseInfo": {"alarmFlag": 0, "status": 262402, "latitude": 29.40268, "longtitude": 106.54041,
"elevation": "521", "speed": "66", "directionAngle": "59", "elevation": "521", "speed": "66", "directionAngle": "59",
"infoTime": "2020-05-28 14:20:04"}, "infoTime": "2020-05-28 14:20:04"},
"extraInfo": {"FA": {"idlingSpeedOver": {"alarmType": "1", "idlingTimeOfDuration": "600", "extraInfo": {"FA": {"idlingSpeedOver": {"alarmType": "1", "idlingTimeOfDuration": "300",
"idlingOilExpend": "1200", "idlingEngineMaxSpeed": "5000","idlingEngineMinSpeed":"500"}}}} "idlingOilExpend": "300", "idlingEngineMaxSpeed": "2000","idlingEngineMinSpeed":"1000"}}}}
timeStamp = time.time() timeStamp = time.time()
timeArray = time.localtime(timeStamp) timeArray = time.localtime(timeStamp)
curTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray) curTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
...@@ -787,6 +787,53 @@ def sendIdlingSpeedOverEvent(): ...@@ -787,6 +787,53 @@ def sendIdlingSpeedOverEvent():
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("/sendUnIdlingSpeedOverEvent",methods=['POST'])
def sendUnIdlingSpeedOverEvent():
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": {"idlingSpeedOver": {"alarmType": "0", "idlingTimeOfDuration": "500",
"idlingOilExpend": "500", "idlingEngineMaxSpeed": "2000","idlingEngineMinSpeed":"1000"}}}}
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