Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
new-socketemulator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李远洪
new-socketemulator
Commits
75a557c2
Commit
75a557c2
authored
Apr 08, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
m300 OBD图形操作界面开发完成
parent
87690cca
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
551 additions
and
4 deletions
+551
-4
lib/protocol/m300/OBDCAN_protocol_m300.py
lib/protocol/m300/OBDCAN_protocol_m300.py
+3
-3
static/js/m300Tools/m300.js
static/js/m300Tools/m300.js
+2
-0
templates/m300Tools/report/P_CAN_m300_page.html
templates/m300Tools/report/P_CAN_m300_page.html
+437
-0
templates/m300Tools/report/P_heartBeat_m300_page.html
templates/m300Tools/report/P_heartBeat_m300_page.html
+1
-0
views/m300Tools/P_m300Protocol_process.py
views/m300Tools/P_m300Protocol_process.py
+94
-1
views/m300Tools/P_m300Protocol_view.py
views/m300Tools/P_m300Protocol_view.py
+14
-0
No files found.
lib/protocol/m300/OBDCAN_protocol_m300.py
View file @
75a557c2
...
@@ -13,7 +13,7 @@ class OBDCAN_protocol_m300(M300Base):
...
@@ -13,7 +13,7 @@ class OBDCAN_protocol_m300(M300Base):
,
troubleCodeNum
=
2
,
engineSpeed
=
3000
,
speed
=
60
,
airInletTemperature
=
88
,
coolingLiquidTemperature
=
76
,
envTemperature
=
65
\
,
troubleCodeNum
=
2
,
engineSpeed
=
3000
,
speed
=
60
,
airInletTemperature
=
88
,
coolingLiquidTemperature
=
76
,
envTemperature
=
65
\
,
intakeManifoldPressure
=
20
,
oilPressure
=
276
,
atmosphericPressure
=
28
,
airFlow
=
550
,
valveLocation
=
51
,
acceleratorLocation
=
32
\
,
intakeManifoldPressure
=
20
,
oilPressure
=
276
,
atmosphericPressure
=
28
,
airFlow
=
550
,
valveLocation
=
51
,
acceleratorLocation
=
32
\
,
engineRunTime
=
370
,
troubleMileage
=
4508
,
surplusOil
=
801
,
engineLoad
=
52
,
fuelTrim
=
89
,
fireAngle
=
154
,
dashboardTotailMilleage
=
3000
\
,
engineRunTime
=
370
,
troubleMileage
=
4508
,
surplusOil
=
801
,
engineLoad
=
52
,
fuelTrim
=
89
,
fireAngle
=
154
,
dashboardTotailMilleage
=
3000
\
,
carTotalRunTime
=
360
,):
,
carTotalRunTime
=
360
,
tripMark
=
"0000"
):
super
()
.
__init__
()
# 不执行该方法,无法使用父类里面定义的属性
super
()
.
__init__
()
# 不执行该方法,无法使用父类里面定义的属性
self
.
waterCode
=
waterCode
#消息流水号
self
.
waterCode
=
waterCode
#消息流水号
self
.
DEV_ID
=
DEV_ID
#设备Id
self
.
DEV_ID
=
DEV_ID
#设备Id
...
@@ -60,7 +60,7 @@ class OBDCAN_protocol_m300(M300Base):
...
@@ -60,7 +60,7 @@ class OBDCAN_protocol_m300(M300Base):
self
.
dashboardTotailMilleage
=
dashboardTotailMilleage
#仪表总里程
self
.
dashboardTotailMilleage
=
dashboardTotailMilleage
#仪表总里程
self
.
carTotalRunTime
=
carTotalRunTime
#车辆总运行时间
self
.
carTotalRunTime
=
carTotalRunTime
#车辆总运行时间
self
.
retail
=
"00000000000000000000"
self
.
retail
=
"00000000000000000000"
self
.
tripMark
=
"0000"
#
驾驶循环标签
self
.
tripMark
=
tripMark
#
驾驶循环标签
#################################################
#################################################
...
@@ -234,7 +234,7 @@ class OBDCAN_protocol_m300(M300Base):
...
@@ -234,7 +234,7 @@ class OBDCAN_protocol_m300(M300Base):
dashboardData
=
0
#仪表数据,16:存在 0:不存在
dashboardData
=
0
#仪表数据,16:存在 0:不存在
engineSpeed
=
0
#发动机转速,32:存在 0:不存在
engineSpeed
=
0
#发动机转速,32:存在 0:不存在
carSpeed
=
0
#车辆速度,64:存在 0:不存在
carSpeed
=
0
#车辆速度,64:存在 0:不存在
surplueOil
=
0
#剩余油量,
64
:存在 0:不存在
surplueOil
=
0
#剩余油量,
128
:存在 0:不存在
val
=
V1N1
+
retain1
+
retain2
+
busMileage
+
dashboardData
+
engineSpeed
+
carSpeed
+
surplueOil
val
=
V1N1
+
retain1
+
retain2
+
busMileage
+
dashboardData
+
engineSpeed
+
carSpeed
+
surplueOil
hexData
=
self
.
int2hexStringByBytes
(
val
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
return
hexData
...
...
static/js/m300Tools/m300.js
View file @
75a557c2
...
@@ -12,6 +12,8 @@ function m300ProtocolManTab(e){
...
@@ -12,6 +12,8 @@ function m300ProtocolManTab(e){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/m300Tools/P_m300Protocol_view/P_login_m300_page
"
);
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/m300Tools/P_m300Protocol_view/P_login_m300_page
"
);
}
else
if
(
id
==
"
P_version_m300_msg
"
){
}
else
if
(
id
==
"
P_version_m300_msg
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/m300Tools/P_m300Protocol_view/P_version_m300_page
"
);
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/m300Tools/P_m300Protocol_view/P_version_m300_page
"
);
}
else
if
(
id
==
"
P_CAN_m300_msg
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/m300Tools/P_m300Protocol_view/P_CAN_m300_page
"
);
}
else
{
}
else
{
alert
(
id
)
alert
(
id
)
}
}
...
...
templates/m300Tools/report/P_CAN_m300_page.html
0 → 100644
View file @
75a557c2
{% extends "m300Tools/report/P_heartBeat_m300_page.html" %}
{% block title %}CAN_msg{% endblock %}
{% block content_1 %}
<div
id=
"container3"
style=
"width:100%;min-height:750px;float:left;_background:green;margin-top:10px;_border-top: 1px solid #eee;"
>
<div
style=
"width:100%;_background:green;padding:5px;padding-top:0px;"
>
<h3
style=
"border-bottom: 1px solid #eee;"
>
设置消息头:
</h3>
<label>
功能ID:
</label><input
id=
"FUNID"
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"0003"
style=
"width:80px;"
>
<label>
消息序列号:
</label><input
id=
"waterCode"
type=
"text"
class=
"form-control"
value=
"1"
style=
"width:60px;"
>
<label>
设备ID:
</label><input
id=
"DEV_ID"
type=
"text"
class=
"form-control"
value=
"M202004070000"
style=
"width:150px;"
>
<label>
是否加密:
</label><select
style=
"width:100px;"
id=
"encryptionType"
class=
"form-control"
>
<option
value=
"0"
>
不加密
</option>
<option
value=
"1024"
>
加密
</option>
</select>
</div>
<H3
style=
"border-bottom: 1px solid #eee;"
>
设置心跳消息内容:
</H3>
<ul
class=
"protocol_content"
style=
"padding:0px;"
>
<li><label>
时间:
</label><input
id=
"timeInfo"
type=
"text"
class=
"form-control"
value=
""
></li>
<li><label>
协议类别:
</label>
<select
id=
"prototolType"
class=
"form-control"
style=
"width:155px;"
>
<option
value=
"11"
>
CAN 11_500
</option>
<option
value=
"12"
>
CAN 11_250
</option>
<option
value=
"13"
>
CAN 29_500_EX
</option>
<option
value=
"14"
>
CAN 29_250_EX
</option>
<option
value=
"20"
>
KWP2000
</option>
<option
value=
"30"
>
KWP2000M
</option>
<option
value=
"40"
>
ISO9141
</option>
<option
value=
"50"
>
VPW
</option>
<option
value=
"60"
>
PWM
</option>
<option
value=
"70"
>
PRIVATE
</option>
</select>
</li>
<li
style=
"width:350px;"
><label>
状态掩码:
</label><input
style=
"width:250px;"
id=
"statusMask"
type=
"text"
class=
"form-control"
value=
"01010101010101010101"
></li>
<li
style=
"width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;"
><h4>
安全状态:
</h4>
<div
style=
"width:100%"
id=
"safeStatus"
>
<sapn><label>
ACC状态:
</label><select
style=
"width:65px;"
id=
"accStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"1"
>
是
</option></select></sapn>
<sapn><label
style=
"word-break:break-all;font-size:10px;"
>
设防撤防状态:
</label><select
style=
"width:65px;"
id=
"defenseStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"2"
>
是
</option></select></sapn>
<sapn><label>
脚刹状态:
</label><select
style=
"width:65px;"
id=
"brakeStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"4"
>
是
</option></select></sapn>
<sapn><label>
是否踩油门:
</label><select
style=
"width:65px;"
id=
"acceleratorStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"8"
>
是
</option></select></sapn>
<sapn><label>
手刹状态:
</label><select
style=
"width:65px;"
id=
"handBrakeStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"16"
>
是
</option></select></sapn>
<sapn><label
style=
"word-break:break-all;font-size:10px;"
>
主驾驶安全带:
</label><select
style=
"width:65px;"
id=
"mainSafetyBelt"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"32"
>
是
</option></select></sapn>
<sapn><label
style=
"word-break:break-all;font-size:10px;"
>
副驾驶安全带:
</label><select
style=
"width:65px;"
id=
"subSafetyBelt"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"64"
>
是
</option></select></sapn>
</div>
<li
style=
"width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;"
><h4>
门状态:
</h4>
<div
style=
"width:100%"
id=
"doorStatus"
>
<sapn><label>
左前门:
</label><select
style=
"width:65px;"
id=
"lfDoorStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"1"
>
是
</option></select></sapn>
<sapn><label>
右前门:
</label><select
style=
"width:65px;"
id=
"rfDoorStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"2"
>
是
</option></select></sapn>
<sapn><label>
左后门:
</label><select
style=
"width:65px;"
id=
"lbDoorStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"4"
>
是
</option></select></sapn>
<sapn><label>
右后门:
</label><select
style=
"width:65px;"
id=
"rbDoorStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"8"
>
是
</option></select></sapn>
<sapn><label>
后备箱:
</label><select
style=
"width:65px;"
id=
"trunk"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"16"
>
是
</option></select></sapn>
<sapn><label>
发动机盖:
</label><select
style=
"width:65px;"
id=
"enginCover"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"32"
>
是
</option></select></sapn>
</div>
</li>
<li
style=
"width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;"
><h4>
锁状态:
</h4>
<div
style=
"width:100%"
id=
"lockStatus"
>
<sapn><label
style=
"word-break:break-all;font-size:10px;"
>
左前门锁状态:
</label><select
style=
"width:65px;"
id=
"lfDoorLockStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"1"
>
是
</option></select></sapn>
<sapn><label
style=
"word-break:break-all;font-size:10px;"
>
右前门锁状态:
</label><select
style=
"width:65px;"
id=
"rfDoorLockStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"2"
>
是
</option></select></sapn>
<sapn><label
style=
"word-break:break-all;font-size:10px;"
>
左后门锁状态:
</label><select
style=
"width:65px;"
id=
"lbDoorLockStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"4"
>
是
</option></select></sapn>
<sapn><label
style=
"word-break:break-all;font-size:10px;"
>
右后门锁状态:
</label><select
style=
"width:65px;"
id=
"rbDoorLockStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"8"
>
是
</option></select></sapn>
</div>
</li>
<li
style=
"width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;"
><h4>
窗户状态:
</h4>
<div
style=
"width:100%"
id=
"windowStatus"
>
<sapn><label
style=
"width:80px;"
>
左前窗:
</label><select
style=
"width:65px;"
id=
"lfWindowStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"1"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
右前窗:
</label><select
style=
"width:65px;"
id=
"rfWindowStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"2"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
左后窗:
</label><select
style=
"width:65px;"
id=
"lbWindowStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"4"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
右后窗:
</label><select
style=
"width:65px;"
id=
"rbWindowStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"8"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
天窗开关:
</label><select
style=
"width:65px;"
id=
"topWindowStatus"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"16"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
左转向灯:
</label><select
style=
"width:65px;"
id=
"lTurnLight"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"32"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
右转向灯:
</label><select
style=
"width:65px;"
id=
"rTurnLight"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"64"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
阅读灯:
</label><select
style=
"width:65px;"
id=
"readLight"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"128"
>
是
</option></select></sapn>
</div>
</li>
<li
style=
"width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;"
><h4>
灯状态:
</h4>
<div
style=
"width:100%"
id=
"lightStatus"
>
<sapn><label
style=
"width:80px;"
>
近光灯:
</label><select
style=
"width:65px;"
id=
"lowHeadlight"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"1"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
远光灯:
</label><select
style=
"width:65px;"
id=
"highHeadlight"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"2"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
前雾灯:
</label><select
style=
"width:65px;"
id=
"ffogLight"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"4"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
后雾灯:
</label><select
style=
"width:65px;"
id=
"bfogLight"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"8"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
危险灯:
</label><select
style=
"width:65px;"
id=
"dangerLight"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"16"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
倒车灯:
</label><select
style=
"width:65px;"
id=
"backCarLight"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"32"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
auto灯:
</label><select
style=
"width:65px;"
id=
"autoLight"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"64"
>
是
</option></select></sapn>
<sapn><label
style=
"width:80px;"
>
示宽灯:
</label><select
style=
"width:65px;"
id=
"widthLight"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"128"
>
是
</option></select></sapn>
</div>
</li>
<li
style=
"width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;"
><h4>
开关状态A:
</h4>
<div
style=
"width:100%"
id=
"swichStatusA"
>
<sapn><label>
机油报警:
</label><select
style=
"width:65px;"
id=
"machineOilWarning"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"1"
>
是
</option></select></sapn>
<sapn><label>
燃油报警:
</label><select
style=
"width:65px;"
id=
"oilWarning"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"2"
>
是
</option></select></sapn>
<sapn><label>
雨刷报警:
</label><select
style=
"width:65px;"
id=
"wiperWarning"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"4"
>
是
</option></select></sapn>
<sapn><label>
喇叭报警:
</label><select
style=
"width:65px;"
id=
"loudsspeakerWaring"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"8"
>
是
</option></select></sapn>
<sapn><label>
空调:
</label><select
style=
"width:65px;"
id=
"airConditionerWaring"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"16"
>
是
</option></select></sapn>
<sapn><label>
后视镜状态:
</label><select
style=
"width:65px;"
id=
"backMirrorWaring"
class=
"form-control"
>
<option
value=
"0"
>
否
</option>
<option
value=
"32"
>
是
</option></select></sapn>
</div>
</li>
<li
style=
"width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;"
><h4>
开关状态B:
</h4>
<div
style=
"width:100%"
id=
"swichStatusB"
>
<sapn><label>
档位:
</label><select
style=
"width:100px;"
id=
"gears"
class=
"form-control"
>
<option
value=
"0"
>
P档
</option>
<option
value=
"16"
>
R档
</option>
<option
value=
"32"
>
N档
</option>
<option
value=
"48"
>
D档
</option>
<option
value=
"64"
>
1档
</option>
<option
value=
"80"
>
2档
</option>
<option
value=
"96"
>
3档
</option>
<option
value=
"112"
>
4档
</option>
<option
value=
"128"
>
5档
</option>
<option
value=
"144"
>
6档
</option>
<option
value=
"160"
>
M档
</option>
<option
value=
"176"
>
S档
</option></select></sapn>
</div>
</li>
<li
style=
"width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;"
><h4>
数据字节:
</h4>
<div
style=
"width:100%"
id=
"dataBit"
>
<sapn><label>
V1N1:
</label><select
style=
"width:90px;"
id=
"V1N1"
class=
"form-control"
>
<option
value=
"1"
>
存在
</option>
<option
value=
"0"
>
不存在
</option></select></sapn>
<sapn><label>
总线总里程:
</label><select
style=
"width:90px;"
id=
"busMileage"
class=
"form-control"
>
<option
value=
"8"
>
存在
</option>
<option
value=
"0"
>
不存在
</option></select></sapn>
<sapn><label>
仪表数据:
</label><select
style=
"width:90px;"
id=
"dashboardData"
class=
"form-control"
>
<option
value=
"16"
>
存在
</option>
<option
value=
"0"
>
不存在
</option></select></sapn>
<sapn><label>
发动机转速:
</label><select
style=
"width:90px;"
id=
"engineSpeed_dataBit"
class=
"form-control"
>
<option
value=
"32"
>
存在
</option>
<option
value=
"0"
>
不存在
</option></select></sapn>
<sapn><label>
车辆速度:
</label><select
style=
"width:90px;"
id=
"carSpeed"
class=
"form-control"
>
<option
value=
"64"
>
存在
</option>
<option
value=
"0"
>
不存在
</option></select></sapn>
<sapn><label>
剩余油量:
</label><select
style=
"width:90px;"
id=
"surplueOil"
class=
"form-control"
>
<option
value=
"128"
>
存在
</option>
<option
value=
"0"
>
不存在
</option></select></sapn>
</div>
</li>
<li><label>
数据流掩码:
</label><input
id=
"dataFlowMask"
type=
"text"
class=
"form-control"
value=
"fffffffd"
></li>
<li><label>
电瓶电压:
</label><input
id=
"votage"
type=
"text"
class=
"form-control"
value=
"360"
></li>
<li><label>
总里程类别:
</label>
<select
id=
"totalMilleageType"
class=
"form-control"
style=
"width:155px;"
>
<option
value=
"1"
>
汽车里程
</option>
<option
value=
"2"
selected=
"selected"
>
OBD里程
</option>
<option
value=
"3"
>
GPS里程
</option>
</select>
</li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
行驶里程,上传值单位为m:
</label><input
id=
"totalMilleage"
type=
"text"
class=
"form-control"
value=
"3000"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
总的燃油消耗量(毫升ml):
</label><input
id=
"totalOil"
type=
"text"
class=
"form-control"
value=
"300"
></li>
<li><label>
故障灯状态:
</label><select
style=
"width:155px;"
id=
"troubleLightStatus"
class=
"form-control"
>
<option
value=
"0"
>
关
</option>
<option
value=
"1"
>
开
</option></select></li>
<li><label>
故障码个数:
</label><input
id=
"troubleCodeNum"
type=
"text"
class=
"form-control"
value=
"2"
></li>
<li><label>
发动机转速:
</label><input
id=
"engineSpeed"
type=
"text"
class=
"form-control"
value=
"3000"
></li>
<li><label>
车辆速度:
</label><input
id=
"speed"
type=
"text"
class=
"form-control"
value=
"60"
></li>
<li><label>
进气口温度:
</label><input
id=
"airInletTemperature"
type=
"text"
class=
"form-control"
value=
"88"
></li>
<li><label>
冷却液温度:
</label><input
id=
"coolingLiquidTemperature"
type=
"text"
class=
"form-control"
value=
"76"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
车辆环境温度:
</label><input
id=
"envTemperature"
type=
"text"
class=
"form-control"
value=
"65"
></li>
<li><label>
进气歧管压力:
</label><input
id=
"intakeManifoldPressure"
type=
"text"
class=
"form-control"
value=
"20"
></li>
<li><label>
燃油压力:
</label><input
id=
"oilPressure"
type=
"text"
class=
"form-control"
value=
"276"
></li>
<li><label>
大气压力:
</label><input
id=
"atmosphericPressure"
type=
"text"
class=
"form-control"
value=
"28"
></li>
<li><label>
空气流量:
</label><input
id=
"airFlow"
type=
"text"
class=
"form-control"
value=
"550"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
气门位置传感器:
</label><input
id=
"valveLocation"
type=
"text"
class=
"form-control"
value=
"51"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
油门踏板位置:
</label><input
id=
"acceleratorLocation"
type=
"text"
class=
"form-control"
value=
"32"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
发动机运行时间:
</label><input
id=
"engineRunTime"
type=
"text"
class=
"form-control"
value=
"370"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
故障行驶里程:
</label><input
id=
"troubleMileage"
type=
"text"
class=
"form-control"
value=
"4508"
></li>
<li><label>
剩余油量:
</label><input
id=
"surplusOil"
type=
"text"
class=
"form-control"
value=
"801"
></li>
<li><label>
发动机负荷:
</label><input
id=
"engineLoad"
type=
"text"
class=
"form-control"
value=
"52"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
长期燃油修正:
</label><input
id=
"fuelTrim"
type=
"text"
class=
"form-control"
value=
"89"
></li>
<li><label>
点火提前角:
</label><input
id=
"fireAngle"
type=
"text"
class=
"form-control"
value=
"154"
></li>
<li><label>
仪表总里程:
</label><input
id=
"dashboardTotailMilleage"
type=
"text"
class=
"form-control"
value=
"3000"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
车辆总运行时间:
</label><input
id=
"carTotalRunTime"
type=
"text"
class=
"form-control"
value=
"360"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环标签:
</label><input
id=
"tripMark"
type=
"text"
class=
"form-control"
value=
"0000"
></li>
</ul>
<H3
style=
"border-bottom: 1px solid #eee;"
>
控制:
</H3>
<div
style=
"width:100%;padding:5px;margin-top:10px;"
>
<button
type=
"button"
class=
"btn btn-primary"
id=
"sendMsgBtn"
>
发送消息
</button>
</div>
<H3
style=
"border-bottom: 1px solid #eee;"
>
返回信息:
</H3>
<div
style=
"width:100%;padding:5px;margin-top:10px;"
>
<textarea
id=
"showFeedback"
style=
"width:100%;padding:5px;"
rows=
"8"
></textarea>
</div>
</div>
<script>
//发送CAN数据
$
(
"
#sendMsgBtn
"
).
click
(
function
(){
var
FUNID
=
$
(
"
#FUNID
"
).
val
();
var
waterCode
=
$
(
"
#waterCode
"
).
val
();
var
DEV_ID
=
$
(
"
#DEV_ID
"
).
val
();
var
encryptionType
=
$
(
"
#encryptionType
"
).
val
();
var
timeInfo
=
$
(
"
#timeInfo
"
).
val
();
var
prototolType
=
$
(
"
#prototolType
"
).
val
();
var
statusMask
=
$
(
"
#statusMask
"
).
val
();
var
accStatus
=
parseInt
(
$
(
"
#accStatus
"
).
val
());
var
defenseStatus
=
parseInt
(
$
(
"
#defenseStatus
"
).
val
());
var
brakeStatus
=
parseInt
(
$
(
"
#brakeStatus
"
).
val
());
var
acceleratorStatus
=
parseInt
(
$
(
"
#acceleratorStatus
"
).
val
());
var
handBrakeStatus
=
parseInt
(
$
(
"
#handBrakeStatus
"
).
val
());
var
mainSafetyBelt
=
parseInt
(
$
(
"
#mainSafetyBelt
"
).
val
());
var
subSafetyBelt
=
parseInt
(
$
(
"
#subSafetyBelt
"
).
val
());
var
safeStatus
=
accStatus
+
defenseStatus
+
brakeStatus
+
acceleratorStatus
+
handBrakeStatus
+
mainSafetyBelt
+
subSafetyBelt
var
lfDoorStatus
=
parseInt
(
$
(
"
#lfDoorStatus
"
).
val
());
var
rfDoorStatus
=
parseInt
(
$
(
"
#rfDoorStatus
"
).
val
());
var
lbDoorStatus
=
parseInt
(
$
(
"
#lbDoorStatus
"
).
val
());
var
rbDoorStatus
=
parseInt
(
$
(
"
#rbDoorStatus
"
).
val
());
var
trunk
=
parseInt
(
$
(
"
#trunk
"
).
val
());
var
enginCover
=
parseInt
(
$
(
"
#enginCover
"
).
val
());
var
doorStatus
=
lfDoorStatus
+
rfDoorStatus
+
lbDoorStatus
+
rbDoorStatus
+
trunk
+
enginCover
var
lfDoorLockStatus
=
parseInt
(
$
(
"
#lfDoorLockStatus
"
).
val
());
var
rfDoorLockStatus
=
parseInt
(
$
(
"
#rfDoorLockStatus
"
).
val
());
var
lbDoorLockStatus
=
parseInt
(
$
(
"
#lbDoorLockStatus
"
).
val
());
var
rbDoorLockStatus
=
parseInt
(
$
(
"
#rbDoorLockStatus
"
).
val
());
var
lockStatus
=
lfDoorLockStatus
+
rfDoorLockStatus
+
lbDoorLockStatus
+
rbDoorLockStatus
var
lfWindowStatus
=
parseInt
(
$
(
"
#lfWindowStatus
"
).
val
());
var
rfWindowStatus
=
parseInt
(
$
(
"
#rfWindowStatus
"
).
val
());
var
lbWindowStatus
=
parseInt
(
$
(
"
#lbWindowStatus
"
).
val
());
var
rbWindowStatus
=
parseInt
(
$
(
"
#rbWindowStatus
"
).
val
());
var
topWindowStatus
=
parseInt
(
$
(
"
#topWindowStatus
"
).
val
());
var
lTurnLight
=
parseInt
(
$
(
"
#lTurnLight
"
).
val
());
var
rTurnLight
=
parseInt
(
$
(
"
#rTurnLight
"
).
val
());
var
readLight
=
parseInt
(
$
(
"
#readLight
"
).
val
());
var
windowStatus
=
lfWindowStatus
+
rfWindowStatus
+
lbWindowStatus
+
rbWindowStatus
+
topWindowStatus
+
lTurnLight
+
rTurnLight
+
readLight
var
lowHeadlight
=
parseInt
(
$
(
"
#lowHeadlight
"
).
val
());
var
highHeadlight
=
parseInt
(
$
(
"
#highHeadlight
"
).
val
());
var
ffogLight
=
parseInt
(
$
(
"
#ffogLight
"
).
val
());
var
bfogLight
=
parseInt
(
$
(
"
#bfogLight
"
).
val
());
var
dangerLight
=
parseInt
(
$
(
"
#dangerLight
"
).
val
());
var
backCarLight
=
parseInt
(
$
(
"
#backCarLight
"
).
val
());
var
autoLight
=
parseInt
(
$
(
"
#autoLight
"
).
val
());
var
widthLight
=
parseInt
(
$
(
"
#widthLight
"
).
val
());
var
lightStatus
=
lowHeadlight
+
highHeadlight
+
ffogLight
+
bfogLight
+
dangerLight
+
backCarLight
+
autoLight
+
widthLight
var
machineOilWarning
=
parseInt
(
$
(
"
#machineOilWarning
"
).
val
());
var
oilWarning
=
parseInt
(
$
(
"
#oilWarning
"
).
val
());
var
wiperWarning
=
parseInt
(
$
(
"
#wiperWarning
"
).
val
());
var
loudsspeakerWaring
=
parseInt
(
$
(
"
#loudsspeakerWaring
"
).
val
());
var
airConditionerWaring
=
parseInt
(
$
(
"
#airConditionerWaring
"
).
val
());
var
backMirrorWaring
=
parseInt
(
$
(
"
#backMirrorWaring
"
).
val
());
var
swichStatusA
=
machineOilWarning
+
oilWarning
+
wiperWarning
+
loudsspeakerWaring
+
airConditionerWaring
+
backMirrorWaring
var
swichStatusB
=
parseInt
(
$
(
"
#gears
"
).
val
());
var
V1N1
=
parseInt
(
$
(
"
#V1N1
"
).
val
());
var
busMileage
=
parseInt
(
$
(
"
#busMileage
"
).
val
());
var
dashboardData
=
parseInt
(
$
(
"
#dashboardData
"
).
val
());
var
engineSpeed
=
parseInt
(
$
(
"
#engineSpeed_dataBit
"
).
val
());
var
carSpeed
=
parseInt
(
$
(
"
#carSpeed
"
).
val
());
var
surplueOil
=
parseInt
(
$
(
"
#surplueOil
"
).
val
());
var
dataBit
=
V1N1
+
busMileage
+
dashboardData
+
engineSpeed
+
carSpeed
+
surplueOil
var
dataFlowMask
=
$
(
"
#dataFlowMask
"
).
val
();
var
votage
=
$
(
"
#votage
"
).
val
();
var
totalMilleageType
=
$
(
"
#totalMilleageType
"
).
val
();
var
totalMilleage
=
$
(
"
#totalMilleage
"
).
val
();
var
totalOil
=
$
(
"
#totalOil
"
).
val
();
var
troubleLightStatus
=
$
(
"
#troubleLightStatus
"
).
val
();
var
troubleCodeNum
=
$
(
"
#troubleCodeNum
"
).
val
();
var
engineSpeed
=
$
(
"
#engineSpeed
"
).
val
();
var
speed
=
$
(
"
#speed
"
).
val
();
var
airInletTemperature
=
$
(
"
#airInletTemperature
"
).
val
();
var
coolingLiquidTemperature
=
$
(
"
#coolingLiquidTemperature
"
).
val
();
var
envTemperature
=
$
(
"
#envTemperature
"
).
val
();
var
intakeManifoldPressure
=
$
(
"
#intakeManifoldPressure
"
).
val
();
var
oilPressure
=
$
(
"
#oilPressure
"
).
val
();
var
atmosphericPressure
=
$
(
"
#atmosphericPressure
"
).
val
();
var
airFlow
=
$
(
"
#airFlow
"
).
val
();
var
valveLocation
=
$
(
"
#valveLocation
"
).
val
();
var
acceleratorLocation
=
$
(
"
#acceleratorLocation
"
).
val
();
var
engineRunTime
=
$
(
"
#engineRunTime
"
).
val
();
var
troubleMileage
=
$
(
"
#troubleMileage
"
).
val
();
var
surplusOil
=
$
(
"
#surplusOil
"
).
val
();
var
engineLoad
=
$
(
"
#engineLoad
"
).
val
();
var
fuelTrim
=
$
(
"
#fuelTrim
"
).
val
();
var
fireAngle
=
$
(
"
#fireAngle
"
).
val
();
var
dashboardTotailMilleage
=
$
(
"
#dashboardTotailMilleage
"
).
val
();
var
carTotalRunTime
=
$
(
"
#carTotalRunTime
"
).
val
();
var
tripMark
=
$
(
"
#tripMark
"
).
val
();
var
data
=
{};
data
[
"
FUNID
"
]
=
FUNID
;
data
[
"
waterCode
"
]
=
waterCode
;
data
[
"
DEV_ID
"
]
=
DEV_ID
;
data
[
"
encryptionType
"
]
=
encryptionType
;
data
[
"
timeInfo
"
]
=
timeInfo
;
data
[
"
prototolType
"
]
=
prototolType
;
data
[
"
statusMask
"
]
=
statusMask
;
data
[
"
safeStatus
"
]
=
safeStatus
;
data
[
"
doorStatus
"
]
=
doorStatus
;
data
[
"
lockStatus
"
]
=
lockStatus
;
data
[
"
windowStatus
"
]
=
windowStatus
;
data
[
"
lightStatus
"
]
=
lightStatus
;
data
[
"
swichStatusA
"
]
=
swichStatusA
;
data
[
"
swichStatusB
"
]
=
swichStatusB
;
data
[
"
dataBit
"
]
=
dataBit
;
data
[
"
dataFlowMask
"
]
=
dataFlowMask
;
data
[
"
votage
"
]
=
votage
;
data
[
"
totalMilleageType
"
]
=
totalMilleageType
;
data
[
"
totalMilleage
"
]
=
totalMilleage
;
data
[
"
totalOil
"
]
=
totalOil
;
data
[
"
troubleLightStatus
"
]
=
troubleLightStatus
;
data
[
"
troubleCodeNum
"
]
=
troubleCodeNum
;
data
[
"
engineSpeed
"
]
=
engineSpeed
;
data
[
"
speed
"
]
=
speed
;
data
[
"
airInletTemperature
"
]
=
airInletTemperature
;
data
[
"
coolingLiquidTemperature
"
]
=
coolingLiquidTemperature
;
data
[
"
envTemperature
"
]
=
envTemperature
;
data
[
"
intakeManifoldPressure
"
]
=
intakeManifoldPressure
;
data
[
"
oilPressure
"
]
=
oilPressure
;
data
[
"
atmosphericPressure
"
]
=
atmosphericPressure
;
data
[
"
airFlow
"
]
=
airFlow
;
data
[
"
valveLocation
"
]
=
valveLocation
;
data
[
"
acceleratorLocation
"
]
=
acceleratorLocation
;
data
[
"
engineRunTime
"
]
=
engineRunTime
;
data
[
"
troubleMileage
"
]
=
troubleMileage
;
data
[
"
surplusOil
"
]
=
surplusOil
;
data
[
"
engineLoad
"
]
=
engineLoad
;
data
[
"
fuelTrim
"
]
=
fuelTrim
;
data
[
"
fireAngle
"
]
=
fireAngle
;
data
[
"
dashboardTotailMilleage
"
]
=
dashboardTotailMilleage
;
data
[
"
carTotalRunTime
"
]
=
carTotalRunTime
;
data
[
"
tripMark
"
]
=
tripMark
;
var
host
=
window
.
location
.
host
;
$
(
"
#showFeedback
"
).
val
(
""
)
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/m300Tools/P_m300Protocol_process/porcessCANMsg
"
,
type
:
"
post
"
,
data
:
data
,
dataType
:
"
json
"
,
success
:
function
(
data
){
if
(
data
.
status
==
200
){
//window.location.reload()
var
theShow
=
"
原始数据:
"
+
data
.
msgSend
+
"
\n
"
;
theShow
=
theShow
+
"
收到数据:
"
+
data
.
result
+
"
\n
"
;
theShow
=
theShow
+
"
收到数据16进制:
"
+
data
.
rev
+
"
\n
"
;
theShow
=
theShow
+
"
解析数据:
"
+
JSON
.
stringify
(
data
.
orgRev
)
+
"
\n
"
;
$
(
"
#showFeedback
"
).
val
(
theShow
)
}
else
{
$
(
"
#showFeedback
"
).
val
(
data
.
message
)
alert
(
data
.
message
);
}
}
});
});
//设置当前时间到UTC时间输入框
(
function
(){
var
curTime
=
getCurTime
();
$
(
"
#timeInfo
"
).
val
(
curTime
);
})();
</script>
{% endblock %}
\ No newline at end of file
templates/m300Tools/report/P_heartBeat_m300_page.html
View file @
75a557c2
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
<li
role=
"presentation"
><a
id=
"P_heartBeat_m300_msg"
{%
if
arg.path[2]=
="P_heartBeat_m300_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"m300ProtocolManTab(this)"
>
心跳消息
</b></a></li>
<li
role=
"presentation"
><a
id=
"P_heartBeat_m300_msg"
{%
if
arg.path[2]=
="P_heartBeat_m300_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"m300ProtocolManTab(this)"
>
心跳消息
</b></a></li>
<li
role=
"presentation"
><a
id=
"P_login_m300_msg"
{%
if
arg.path[2]=
="P_login_m300_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"m300ProtocolManTab(this)"
>
登录消息
</b></a></li>
<li
role=
"presentation"
><a
id=
"P_login_m300_msg"
{%
if
arg.path[2]=
="P_login_m300_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"m300ProtocolManTab(this)"
>
登录消息
</b></a></li>
<li
role=
"presentation"
><a
id=
"P_version_m300_msg"
{%
if
arg.path[2]=
="P_version_m300_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"m300ProtocolManTab(this)"
>
版本消息
</b></a></li>
<li
role=
"presentation"
><a
id=
"P_version_m300_msg"
{%
if
arg.path[2]=
="P_version_m300_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"m300ProtocolManTab(this)"
>
版本消息
</b></a></li>
<li
role=
"presentation"
><a
id=
"P_CAN_m300_msg"
{%
if
arg.path[2]=
="P_CAN_m300_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"m300ProtocolManTab(this)"
>
CAN消息
</b></a></li>
</ul>
</ul>
{% endblock %}
{% endblock %}
{% block content_1 %}
{% block content_1 %}
...
...
views/m300Tools/P_m300Protocol_process.py
View file @
75a557c2
...
@@ -5,6 +5,7 @@ from configparser import ConfigParser
...
@@ -5,6 +5,7 @@ from configparser import ConfigParser
from
lib.protocol.m300.Heartbeat_protocol_300
import
Heartbeat_protocol_300
from
lib.protocol.m300.Heartbeat_protocol_300
import
Heartbeat_protocol_300
from
lib.protocol.m300.Login_protocol_m300
import
Login_protocol_m300
from
lib.protocol.m300.Login_protocol_m300
import
Login_protocol_m300
from
lib.protocol.m300.OBDCAN_protocol_m300
import
OBDCAN_protocol_m300
from
lib.protocol.m300.VersionInfo_protocol_m300
import
VersionInfo_protocol_m300
from
lib.protocol.m300.VersionInfo_protocol_m300
import
VersionInfo_protocol_m300
from
lib.protocol.m300Plateform.M300Common_res
import
M300Common_res
from
lib.protocol.m300Plateform.M300Common_res
import
M300Common_res
from
lib.protocol.m300Plateform.M300Login_res
import
M300Login_res
from
lib.protocol.m300Plateform.M300Login_res
import
M300Login_res
...
@@ -130,7 +131,7 @@ def porcessLoginMsg():
...
@@ -130,7 +131,7 @@ def porcessLoginMsg():
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
##########################################
##########################################
# 【接口类型】处理发送的
登录
上报报文
# 【接口类型】处理发送的
版本信息
上报报文
##########################################
##########################################
@
P_m300Protocol_process
.
route
(
"/porcessVersionMsg"
,
methods
=
[
'POST'
])
@
P_m300Protocol_process
.
route
(
"/porcessVersionMsg"
,
methods
=
[
'POST'
])
def
porcessVersionMsg
():
def
porcessVersionMsg
():
...
@@ -177,4 +178,96 @@ def porcessVersionMsg():
...
@@ -177,4 +178,96 @@ def porcessVersionMsg():
traceback
.
print_exc
()
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 处理失败!"
data
[
"message"
]
=
"Error: 处理失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
##########################################
# 【接口类型】处理发送的OBD CAN 信息上报报文
##########################################
@
P_m300Protocol_process
.
route
(
"/porcessCANMsg"
,
methods
=
[
'POST'
])
def
porcessCANMsg
():
FUNID
=
request
.
form
.
get
(
"FUNID"
)
waterCode
=
int
(
request
.
form
.
get
(
"waterCode"
))
DEV_ID
=
request
.
form
.
get
(
"DEV_ID"
)
encryptionType
=
int
(
request
.
form
.
get
(
"encryptionType"
))
timeInfo
=
request
.
form
.
get
(
"timeInfo"
)
prototolType
=
request
.
form
.
get
(
"prototolType"
)
statusMask
=
request
.
form
.
get
(
"statusMask"
)
safeStatus
=
int
(
request
.
form
.
get
(
"safeStatus"
))
doorStatus
=
int
(
request
.
form
.
get
(
"doorStatus"
))
lockStatus
=
int
(
request
.
form
.
get
(
"lockStatus"
))
windowStatus
=
int
(
request
.
form
.
get
(
"windowStatus"
))
lightStatus
=
int
(
request
.
form
.
get
(
"lightStatus"
))
swichStatusA
=
int
(
request
.
form
.
get
(
"swichStatusA"
))
swichStatusB
=
int
(
request
.
form
.
get
(
"swichStatusB"
))
dataBit
=
int
(
request
.
form
.
get
(
"dataBit"
))
dataFlowMask
=
request
.
form
.
get
(
"dataFlowMask"
)
votage
=
int
(
request
.
form
.
get
(
"votage"
))
totalMilleageType
=
int
(
request
.
form
.
get
(
"totalMilleageType"
))
totalMilleage
=
int
(
request
.
form
.
get
(
"totalMilleage"
))
totalOil
=
int
(
request
.
form
.
get
(
"totalOil"
))
troubleLightStatus
=
int
(
request
.
form
.
get
(
"troubleLightStatus"
))
troubleCodeNum
=
int
(
request
.
form
.
get
(
"troubleCodeNum"
))
engineSpeed
=
int
(
request
.
form
.
get
(
"engineSpeed"
))
speed
=
int
(
request
.
form
.
get
(
"speed"
))
airInletTemperature
=
int
(
request
.
form
.
get
(
"airInletTemperature"
))
coolingLiquidTemperature
=
int
(
request
.
form
.
get
(
"coolingLiquidTemperature"
))
envTemperature
=
int
(
request
.
form
.
get
(
"envTemperature"
))
intakeManifoldPressure
=
int
(
request
.
form
.
get
(
"intakeManifoldPressure"
))
oilPressure
=
int
(
request
.
form
.
get
(
"oilPressure"
))
atmosphericPressure
=
int
(
request
.
form
.
get
(
"atmosphericPressure"
))
airFlow
=
int
(
request
.
form
.
get
(
"airFlow"
))
valveLocation
=
int
(
request
.
form
.
get
(
"valveLocation"
))
acceleratorLocation
=
int
(
request
.
form
.
get
(
"acceleratorLocation"
))
engineRunTime
=
int
(
request
.
form
.
get
(
"engineRunTime"
))
troubleMileage
=
int
(
request
.
form
.
get
(
"troubleMileage"
))
surplusOil
=
int
(
request
.
form
.
get
(
"surplusOil"
))
engineLoad
=
int
(
request
.
form
.
get
(
"engineLoad"
))
fuelTrim
=
int
(
request
.
form
.
get
(
"fuelTrim"
))
fireAngle
=
int
(
request
.
form
.
get
(
"fireAngle"
))
dashboardTotailMilleage
=
int
(
request
.
form
.
get
(
"dashboardTotailMilleage"
))
carTotalRunTime
=
int
(
request
.
form
.
get
(
"carTotalRunTime"
))
tripMark
=
request
.
form
.
get
(
"tripMark"
)
data
=
{}
if
(
waterCode
==
None
or
DEV_ID
==
None
or
encryptionType
==
None
or
timeInfo
==
None
or
prototolType
==
None
or
statusMask
==
None
\
or
safeStatus
==
None
or
doorStatus
==
None
or
lockStatus
==
None
or
windowStatus
==
None
or
lightStatus
==
None
or
swichStatusA
==
None
\
or
swichStatusB
==
None
or
dataBit
==
None
or
dataFlowMask
==
None
or
votage
==
None
or
totalMilleageType
==
None
or
totalMilleage
==
None
\
or
totalOil
==
None
or
troubleLightStatus
==
None
or
troubleCodeNum
==
None
or
engineSpeed
==
None
or
speed
==
None
or
airInletTemperature
==
None
\
or
coolingLiquidTemperature
==
None
or
envTemperature
==
None
or
intakeManifoldPressure
==
None
or
oilPressure
==
None
or
atmosphericPressure
==
None
or
airFlow
==
None
\
or
valveLocation
==
None
or
acceleratorLocation
==
None
or
engineRunTime
==
None
or
troubleMileage
==
None
or
surplusOil
==
None
or
engineLoad
==
None
\
or
fuelTrim
==
None
or
fireAngle
==
None
or
dashboardTotailMilleage
==
None
or
carTotalRunTime
==
None
or
tripMark
==
None
):
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Info: 请检查是否传入了空数据!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
conf_R
=
ConfigParser
()
conf_R
.
read
(
"config/m300Tools/m300Tools.conf"
)
cliSocket
=
ClientSocket
(
conf_R
.
get
(
"socket"
,
"host"
),
conf_R
.
getint
(
"socket"
,
"port"
))
cliSocket
.
connect
()
protocolObj
=
OBDCAN_protocol_m300
(
waterCode
=
waterCode
,
DEV_ID
=
DEV_ID
,
encryptionType
=
encryptionType
,
timeInfo
=
timeInfo
,
prototolType
=
prototolType
,
statusMask
=
statusMask
\
,
safeStatus
=
safeStatus
,
doorStatus
=
doorStatus
,
lockStatus
=
lockStatus
,
windowStatus
=
windowStatus
,
lightStatus
=
lightStatus
,
swichStatusA
=
swichStatusA
\
,
swichStatusB
=
swichStatusB
,
dataBit
=
dataBit
,
dataFlowMask
=
dataFlowMask
,
votage
=
votage
,
totalMilleageType
=
totalMilleageType
,
totalMilleage
=
totalMilleage
\
,
totalOil
=
totalOil
,
troubleLightStatus
=
troubleLightStatus
,
troubleCodeNum
=
troubleCodeNum
,
engineSpeed
=
engineSpeed
,
speed
=
speed
,
airInletTemperature
=
airInletTemperature
\
,
coolingLiquidTemperature
=
coolingLiquidTemperature
,
envTemperature
=
envTemperature
,
intakeManifoldPressure
=
intakeManifoldPressure
,
oilPressure
=
oilPressure
\
,
atmosphericPressure
=
atmosphericPressure
,
airFlow
=
airFlow
,
valveLocation
=
valveLocation
,
acceleratorLocation
=
acceleratorLocation
,
engineRunTime
=
engineRunTime
,
troubleMileage
=
troubleMileage
,
surplusOil
=
surplusOil
,
engineLoad
=
engineLoad
,
fuelTrim
=
fuelTrim
,
fireAngle
=
fireAngle
,
dashboardTotailMilleage
=
dashboardTotailMilleage
\
,
carTotalRunTime
=
carTotalRunTime
,
tripMark
=
tripMark
)
msg
=
protocolObj
.
generateMsg
()
cliSocket
.
send
(
msg
)
socRecv
=
cliSocket
.
receive
()
socRecvo
=
str
(
socRecv
)
cliSocket
.
close
()
data
[
"status"
]
=
"200"
data
[
"message"
]
=
"Sucess: "
data
[
"msgSend"
]
=
msg
data
[
"result"
]
=
socRecvo
data
[
"rev"
]
=
str
(
binascii
.
b2a_hex
(
socRecv
))[
2
:][:
-
1
]
data
[
"orgRev"
]
=
json
.
loads
(
M300Common_res
(
data
[
"rev"
])
.
getMsg
())
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 处理失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
\ No newline at end of file
views/m300Tools/P_m300Protocol_view.py
View file @
75a557c2
...
@@ -66,4 +66,18 @@ def P_version_m300_page():
...
@@ -66,4 +66,18 @@ def P_version_m300_page():
arg
=
{}
arg
=
{}
path
=
"m300Tools/report/P_version_m300_page.html"
path
=
"m300Tools/report/P_version_m300_page.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
return
render_template
(
path
,
arg
=
arg
)
##########################################
# 【视图类型】访问版本协议页面
##########################################
@
P_m300Protocol_view
.
route
(
'/P_CAN_m300_page'
)
def
P_CAN_m300_page
():
#获取请求的路劲
url
=
request
.
url
reqPath
=
re
.
findall
(
"http://(.*)$"
,
url
)[
0
]
reqPath
=
re
.
findall
(
"/(.*)$"
,
reqPath
)[
0
]
arg
=
{}
path
=
"m300Tools/report/P_CAN_m300_page.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
return
render_template
(
path
,
arg
=
arg
)
return
render_template
(
path
,
arg
=
arg
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment