Commit e316dd9d authored by liyuanhong's avatar liyuanhong

修改了M500故障码上报

parent 9cf8d5a0
{"time": {"dateTime": "2020-07-14 11:09:33", "date": "2020-07-14", "time": "11:09:33"}, "curDayTravel": {"todayTotalMilleage": 3852, "todayTotalOil": 297, "todayTotalTime": 237, "theMilleage": 422, "theOil": 32, "theTime": 26}, "travelData": {"totalMilleage": 119707, "totalOil": 10670, "totalTime": 7340}}
\ No newline at end of file
{"time": {"dateTime": "2020-07-24 13:33:24", "date": "2020-07-24", "time": "13:33:24"}, "curDayTravel": {"todayTotalMilleage": 3158, "todayTotalOil": 203, "todayTotalTime": 197, "theMilleage": 3158, "theOil": 203, "theTime": 197}, "travelData": {"totalMilleage": 123527, "totalOil": 10920, "totalTime": 7578}}
\ No newline at end of file
{"time": {"dateTime": "2020-07-10 10:37:16", "date": "2020-07-10", "time": "10:37:16"}, "curDayTravel": {"todayTotalMilleage": 17293, "todayTotalOil": 1213, "todayTotalTime": 1072, "theMilleage": 1952, "theOil": 122, "theTime": 122}, "travelData": {"totalMilleage": 581717, "totalOil": 52607, "totalTime": 34930}, "event": {"threeRapid": {"totalRapidlyAccelerate": 43, "totalSharpSlowdown": 31, "totalSharpTurn": 34}}}
\ No newline at end of file
{"time": {"dateTime": "2020-07-24 10:18:22", "date": "2020-07-24", "time": "10:18:22"}, "curDayTravel": {"todayTotalMilleage": 19292, "todayTotalOil": 1217, "todayTotalTime": 1205, "theMilleage": 3008, "theOil": 188, "theTime": 188}, "travelData": {"totalMilleage": 622444, "totalOil": 55189, "totalTime": 37473}, "event": {"threeRapid": {"totalRapidlyAccelerate": 53, "totalSharpSlowdown": 42, "totalSharpTurn": 44}}}
\ No newline at end of file
......@@ -226,8 +226,10 @@ def sendMsg(msgs):
if __name__ == "__main__":
# msg = getEventPkg()
# msg = getGpsPkg()
msg = getEventPkg()
sendMsg(msg)
msg = getGpsPkg()
sendMsg(msg)
msg = getObdPkg()
sendMsg(msg)
......
......@@ -95,7 +95,8 @@ class ResponseBase(Base):
return otherStyleTime
if __name__ == "__main__":
print(ResponseBase().hexDate2date("01c329ed065"))
print(ResponseBase().hexTimestamp2date("5e60723b"))
# print(ResponseBase().hexDate2date("01c329ed065"))
# print(ResponseBase().hexTimestamp2date("5e60723b"))
print(ResponseBase().hex2string("4d3530304142303230322e303030432c3131312e31302e32342e3133312c32312c7673742c767374323031332c4d3530304142303230322e303030432e42494e2c"))
......@@ -87,7 +87,7 @@ class DataUpstreamTransport_msg(MessageBase):
data["speedOut120"],data["rapidlyAccelerateTimes"],data["rapidlySharpSlowdownTimes"],data["sharpCurveTimes"])
elif msgType == "F2":
# 故障码数据(状态改变发送)
msgContent = self.getTroubleCodeData_GUI(data["infoTime"],data["latitude"],data["longitude"],data["troubleCodeNums"])
msgContent = self.getTroubleCodeData_GUI(data["infoTime"],data["latitude"],data["longitude"],data["troubleCodeNums"],data["systemId"])
elif msgType == "F3":
# 休眠进入(进入休眠模式发送)
msgContent = self.getIntoSleepData_GUI(data["infoTime"])
......@@ -334,16 +334,20 @@ class DataUpstreamTransport_msg(MessageBase):
#故障码
troubleCode = ""
for i in range(0,troubleCodeNums):
tbc0 = self.int2hexStringByBytes(i)
tbc1 = self.int2hexStringByBytes(1)
tbc2 = self.int2hexStringByBytes(2)
tbc3 = self.int2hexStringByBytes(3)
# tbc0 = self.int2hexStringByBytes(i)
tbc0 = "00"
# tbc1 = self.int2hexStringByBytes(1)
tbc1 = self.int2hexStringByBytes(0)
# tbc2 = self.int2hexStringByBytes(2)
tbc2 = self.int2hexStringByBytes(i)
# tbc3 = self.int2hexStringByBytes(3)
tbc3 = self.int2hexStringByBytes(0)
troubleCode = troubleCode + tbc0 + tbc1 + tbc2 + tbc3
data = infoTime + latitude + longitude + troubleCodeNumsHex + troubleCode
return data
# 获取故障码数据,针对图形界面,可传递参数
def getTroubleCodeData_GUI(self,infoTime="2020-02-06 11:31:56",latitude=29.40268,longitude=106.54041,troubleCodeNums=3):
def getTroubleCodeData_GUI(self,infoTime="2020-02-06 11:31:56",latitude=29.40268,longitude=106.54041,troubleCodeNums=3,systemId="00"):
infoTime = self.getBCDTime(infoTime)
#单位:0.000001 度,Bit31=0/1 北纬/南纬
latitude = self.getLatitude(latitude)
......@@ -355,7 +359,12 @@ class DataUpstreamTransport_msg(MessageBase):
#故障码
troubleCode = ""
for i in range(0,troubleCodeNums):
troubleCode = troubleCode + self.int2hexStringByBytes(i,4)
# troubleCode = troubleCode + self.int2hexStringByBytes(i,4)
tbc0 = systemId
tbc1 = self.int2hexStringByBytes(0)
tbc2 = self.int2hexStringByBytes(i)
tbc3 = self.int2hexStringByBytes(0)
troubleCode = troubleCode + tbc0 + tbc1 + tbc2 + tbc3
data = infoTime + latitude + longitude + troubleCodeNumsHex + troubleCode
return data
#获取维度
......
......@@ -100,5 +100,5 @@ if __name__ == "__main__":
# print(ResponseBase().int2binStr(7,2))
# print(ResponseBase().getMsgId("7e0002000001314620111800065b7e"))
# print(ResponseBase().getMsgId("7e80010005013146201118e1480006000200767e"))
print(ResponseBase().hex2string("7975616e686f6e67"))
print(ResponseBase().hex2string("014c3230304142303030302c737a6c696e6779692e716963702e7669702c383838392c537a4c696e6759692c7a373254713246742c4c3230304142303130322e303030342e42494e2c2f2c"))
print(ResponseBase().hexString2int("00001f43 "))
\ No newline at end of file
......@@ -110,6 +110,6 @@ class ResponseBase(Base):
if __name__ == "__main__":
print(ResponseBase().hexDate2date("01c329ed065"))
print(ResponseBase().hexTimestamp2date("5e60723b"))
print(ResponseBase().hex2string("4d3530304142303330332e303130302c3131312e31302e32342e3133312c32312c7673742c767374323031332c4d3530304142303330332e303130302e42494e2c"))
print(ResponseBase().hex2string("312c312c767374322e76616e64796f2e636e2c383030332c302c434d4e45542c7975616e686f6e672c70617373776f72640d0a"))
......@@ -32,8 +32,8 @@ port = 9001
# msg = TerminalVersionInfo_msg().generateMsg() #终端版本信息上报
# msg = QueryTerminalParam_res().generateMsg() #查询终端参数应答
# msg = QueryTerminalProperty_res().generateMsg() #查询终端属性应答消息
msg = Location_msg().generateMsg() #位置信息汇报
# msg = DataUpstreamTransport_msg().generateMsg() #数据上行透传消息
# msg = Location_msg().generateMsg() #位置信息汇报
msg = DataUpstreamTransport_msg().generateMsg() #数据上行透传消息
# msg = TerminalUpdataResult_msg().generateMsg() #终端升级结果通知
# msg = LocationDataBatchUpdate_msg().generateMsg() #定位数据批量上传
# msg = TextInfoUpload_msg().generateMsg() #文本信息上传
......
......@@ -676,7 +676,6 @@ class ProtocolSimulaterService():
fi.write("[" + curTime +"]" + data + "\n")
if __name__ == "__main__":
ProtocolSimulaterService().getDirAngleTest()
......
......@@ -20,6 +20,8 @@ from views.messageTools.message_process import message_process
from views.messageTools.M_simulater_view import M_simulater_view
from views.messageTools.M_simulater_process import M_simulater_process
from views.otherTools.mapTools_view import mapTools_view
app = Flask(__name__)
app.register_blueprint(setting_view,url_prefix = "/protocolTools/setting_view")
app.register_blueprint(setting_process,url_prefix = "/protocolTools/setting_process")
......@@ -41,6 +43,8 @@ app.register_blueprint(message_process,url_prefix = "/messageTools/message_proce
app.register_blueprint(M_simulater_view,url_prefix = "/messageTools/M_simulater_view")
app.register_blueprint(M_simulater_process,url_prefix = "/messageTools/M_simulater_process")
app.register_blueprint(mapTools_view,url_prefix = "/otherTools/mapTools_view")
@app.route('/')
def hello():
return redirect('/messageTools/message_view/heartBeat_msg_page')
......
......@@ -9,5 +9,7 @@ function swichTap(e){
$(location).attr('href', "http://" + window.location.host + "/messageTools/message_view/heartBeat_msg_page");
}else if(id == "m300Tools"){
$(location).attr('href', "http://" + window.location.host + "/m300Tools/P_m300Protocol_view/P_heartBeat_m300_page");
}else if(id == "otherTools"){
$(location).attr('href', "http://" + window.location.host + "/otherTools/mapTools_view/maptool_page");
}
}
......@@ -25,7 +25,7 @@
<li role="presentation" {% if arg.path[0]=="protocolTools" %} class="active" {% endif %}><a onclick="swichTap(this)" id="protocolTools">M500协议工具</a></li>
<li role="presentation" {% if arg.path[0]=="m300Tools" %} class="active" {% endif %}><a onclick="swichTap(this)" id="m300Tools">M300协议工具</a></li>
<li role="presentation" {% if arg.path[0]=="messageTools" %} class="active" {% endif %}><a onclick="swichTap(this)" id="messageTools">新硬件消息工具</a></li>
<!-- <li role="presentation" {% if arg.path[0]=="otherTools" %} class="active" {% endif %}><a onclick="swichTap(this)" id="otherTools">其他工具</a></li>-->
<li role="presentation" {% if arg.path[0]=="otherTools" %} class="active" {% endif %}><a onclick="swichTap(this)" id="otherTools">其他工具</a></li>
</ul>
</div>
</div>
......
......@@ -37,6 +37,12 @@
<option value="1">西经</option>
</select></li>
<li><label>故障码个数:</label><input id="troubleCodeNums" type="text" class="form-control" value="3"></li>
<li><label>故障码类型:</label><select id="systemId" class="form-control">
<option value="00">发动机故障码</option>
<option value="01">变速箱故障码</option>
<option value="02">ABS 故障码</option>
<option value="03">安全气囊故障码</option>
</select></li>
</ul>
<H3 style="border-bottom: 1px solid #eee;">控制:</H3>
<div style="width:100%;padding:5px;margin-top:10px;">
......@@ -76,6 +82,7 @@ $("#sendMsgBtn").click(function(){
longitude = parseFloat(longitude) + 2147483648 / 1000000
}
var troubleCodeNums = $("#troubleCodeNums").val();
var systemId = $("#systemId").val();
var data = {};
data["msgID"] = msgID;
......@@ -90,6 +97,7 @@ $("#sendMsgBtn").click(function(){
data["latitude"] = latitude;
data["longitude"] = longitude;
data["troubleCodeNums"] = troubleCodeNums;
data["systemId"] = systemId;
var host = window.location.host;
$("#showFeedback").val("")
......
{% extends "base.html" %}
{% block title %}其他工具{% endblock %}
{% block content %}
<style type="text/css">
.link-tab {
background-color:#e4e2dd;
}
.active_left_tab {
background-color:#428BCA;
color:white;
}
.table>thead>tr>th,.table>tbody>tr>td{
_background-color:red;
}
</style>
<!-- 切换左边的tab -->
<script type="text/javascript">
function swichLeftTab(e){
var id = $(e).attr("id")
if(id == "mapTools"){
$(location).attr('href', "http://" + window.location.host + "/messageTools/msgSetting_view/msgSetting_page");
}
}
</script>
<!-- 左侧导航添加为可继承模块 -->
{% block leftNav %}
<div id="container1" class="col-sm-3 col-md-2 sidebar" style="margin-top:50px;width:12%;padding:0px;margin-right:15px;">
<ul class="nav nav-sidebar" style="margin-top:20px;">
<li id="maptools" onclick="swichLeftTab(this)"><a {% if arg.path[1]=="mapTools_view" %} class="active_left_tab" {% endif %}><span class="glyphicon glyphicon-hand-right" aria-hidden="true"></span></span> 地图工具(开发中)</a></li>
</ul>
</div>
{% endblock %}
{% block content_01 %}
<!-- 右边内容区域 -->
{% endblock %}
{% endblock %}
</div>
\ No newline at end of file
{% extends "otherTools/index.html" %}
{% block title %}msgSetting{% endblock %}
{% block content_01 %}
<script src="../../static/js/messageTools/setting.js"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=d96c8dc7e0d6c636d65e6f6d75b0ccb4"></script>
<style>
.nav-pills li {
margin-bottom:5px;
}
.form-control {
display:inline;
width:160px;
}
.protocol_content:after{
clear:both;
display:block;
content:" ";
}
.protocol_content li {
width:250px;
_background:yellow;
list-style:none;
margin-top:5px;
float:left;
}
.protocol_content label{
width:90px;
text-align:right;
}
</style>
<div id="container2" style="width:85%;min-height:750px;float:left;_background:pink;">
{% block content_1 %}
<div id="container3" style="width:100%;min-height:750px;float:left;_background:pink;margin-top:10px;_border-top: 1px solid #eee;">
<div class="btn-group btn-group-justified" role="group" aria-label="Justified button group" style="width:400px;height:35px;background:pink;z-index:50;position:absolute;top:120px;right:40px;border-radius:5px;">
<a href="#" class="btn btn-default" role="button" id="ctrArea1" onclick="ctrAreaShow(this)">轨迹点查询</a>
<a href="#" class="btn btn-default" role="button" id="ctrArea2" onclick="ctrAreaShow(this)">录制轨迹</a>
<a href="#" class="btn btn-default" role="button" id="ctrArea3" onclick="ctrAreaShow(this)">查询轨迹</a>
</div>
<div id="ctrArea_1" style="width:400px;height:250px;background:white;z-index:50;position:absolute;top:160px;right:40px;border-radius:5px;display:none;" class="btn-group btn-group-justified" role="group">
111
</div>
<div id="ctrArea_2" style="width:400px;height:250px;background:white;z-index:50;position:absolute;top:160px;right:40px;border-radius:5px;display:none;" class="btn-group btn-group-justified" role="group">
222
</div>
<div id="ctrArea_3" style="width:400px;height:250px;background:white;z-index:50;position:absolute;top:160px;right:40px;border-radius:5px;display:none;" class="btn-group btn-group-justified" role="group">
333
</div>
<div id="container" style="width:100%; height: 750px;">
</div>
</div>
<script>
var map = null;
var curShow = "";
//加载地图
(function(){
map = new AMap.Map('container', {
zoom:12,//级别
center: [106.587436, 29.565099]
});
})();
//处理地图点击事件
map.on('click', function(ev) {
var lnglat = ev.lnglat;
console.log(lnglat);
});
function ctrAreaShow(e){
var cliId = $(e).attr("id");
if(cliId == "ctrArea1"){
if(curShow == "ctrArea1"){
$("#ctrArea_1").css("display","none");
curShow = "";
}else{
$("#ctrArea_1").css("display","block");
$("#ctrArea_2").css("display","none");
$("#ctrArea_3").css("display","none");
curShow = "ctrArea1";
}
}else if(cliId == "ctrArea2"){
if(curShow == "ctrArea2"){
$("#ctrArea_2").css("display","none");
curShow = "";
}else{
$("#ctrArea_1").css("display","none");
$("#ctrArea_2").css("display","block");
$("#ctrArea_3").css("display","none");
curShow = "ctrArea2";
}
}else if(cliId == "ctrArea3"){
if(curShow == "ctrArea3"){
$("#ctrArea_3").css("display","none");
curShow = "";
}else{
$("#ctrArea_1").css("display","none");
$("#ctrArea_2").css("display","none");
$("#ctrArea_3").css("display","block");
curShow = "ctrArea3";
}
}
}
</script>
{% endblock %}
</div>
{% endblock %}
\ No newline at end of file
......@@ -358,10 +358,12 @@ def porcessDataUpstreamTransportMsg_F2():
latitude = float(request.form.get("latitude"))
longitude = float(request.form.get("longitude"))
troubleCodeNums = int(request.form.get("troubleCodeNums"))
systemId = request.form.get("systemId")
data = {}
if (msgID == None or phoneNum == None or msgWaterCode == None or encryptionType == None or subPkg == None \
or pkgCounts == None or infoTime == None or latitude == None or longitude == None or troubleCodeNums == None):
or pkgCounts == None or infoTime == None or latitude == None or longitude == None or troubleCodeNums == None \
or systemId == None):
data["status"] = "4003"
data["message"] = "Info: 请检查是否传入了空数据!"
return Response(json.dumps(data), mimetype='application/json')
......@@ -372,6 +374,7 @@ def porcessDataUpstreamTransportMsg_F2():
msgData["latitude"] = latitude
msgData["longitude"] = longitude
msgData["troubleCodeNums"] = troubleCodeNums
msgData["systemId"] = systemId
conf_R = ConfigParser()
conf_R.read("config/messageTools/messageTools.conf")
......
#coding:utf-8
from flask import Blueprint, render_template ,request
import re
from lib.util import fileUtil
mapTools_view = Blueprint('mapTools_view', __name__)
##########################################
# 【视图类型】访问模拟器页面
##########################################
@mapTools_view.route('/maptool_page')
def maptool_page():
#获取请求的路劲
url = request.url
reqPath = re.findall("http://(.*)$",url)[0]
reqPath = re.findall("/(.*)$", reqPath)[0]
arg = {}
path = "otherTools/maptool.html"
arg["path"] = reqPath.split("/")
return render_template(path,arg=arg)
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