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
ab3a26b9
Commit
ab3a26b9
authored
Jun 16, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车安优模拟器OBD 增加了一个670b OBd中里程信息
parent
bd8a4961
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
69 additions
and
25 deletions
+69
-25
data/m300Tools/carData/M202003060518.json
data/m300Tools/carData/M202003060518.json
+1
-1
data/messageTools/carData/012201500010.json
data/messageTools/carData/012201500010.json
+1
-1
data/protocolTools/carData/M202003060520.json
data/protocolTools/carData/M202003060520.json
+1
-1
lib/protocol/message/Location_msg.py
lib/protocol/message/Location_msg.py
+1
-0
lib/protocol/message/TerminalVersionInfo_msg.py
lib/protocol/message/TerminalVersionInfo_msg.py
+6
-5
lib/protocol/message/data/SaloonCarOBD_data.py
lib/protocol/message/data/SaloonCarOBD_data.py
+11
-2
lib/socket/messageTest.py
lib/socket/messageTest.py
+5
-5
lib/socket/service/MessageSimulaterService.py
lib/socket/service/MessageSimulaterService.py
+13
-8
templates/base.html
templates/base.html
+1
-0
templates/messageTools/message/location_msg_page.html
templates/messageTools/message/location_msg_page.html
+10
-0
templates/messageTools/message/terminalVersionInfoUpload_msg_page.html
...sageTools/message/terminalVersionInfoUpload_msg_page.html
+14
-0
views/messageTools/message_process.py
views/messageTools/message_process.py
+5
-2
No files found.
data/m300Tools/carData/M202003060518.json
View file @
ab3a26b9
{
"time"
:
{
"dateTime"
:
"2020-06-05 11:21:47"
,
"date"
:
"2020-06-05"
,
"time"
:
"11:21:47"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
4095
,
"todayTotalOil"
:
330
,
"todayTotalTime"
:
251
,
"theMilleage"
:
1088
,
"theOil"
:
68
,
"theTime"
:
68
},
"travelData"
:
{
"totalMilleage"
:
4925
,
"totalOil"
:
410
,
"totalTime"
:
301
},
"event"
:
{
"threeRapid"
:
{
"totalRapidlyAccelerate"
:
5
,
"totalSharpSlowdown"
:
2
,
"totalSharpTurn"
:
0
}}}
\ No newline at end of file
{
"time"
:
{
"dateTime"
:
"2020-06-15 16:35:22"
,
"date"
:
"2020-06-15"
,
"time"
:
"16:35:22"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
2096
,
"todayTotalOil"
:
191
,
"todayTotalTime"
:
127
,
"theMilleage"
:
2096
,
"theOil"
:
191
,
"theTime"
:
127
},
"travelData"
:
{
"totalMilleage"
:
7021
,
"totalOil"
:
601
,
"totalTime"
:
428
},
"event"
:
{
"threeRapid"
:
{
"totalRapidlyAccelerate"
:
6
,
"totalSharpSlowdown"
:
4
,
"totalSharpTurn"
:
0
}}}
\ No newline at end of file
data/messageTools/carData/012201500010.json
View file @
ab3a26b9
{
"time"
:
{
"dateTime"
:
"2020-06-09 17:48:22"
,
"date"
:
"2020-06-09"
,
"time"
:
"17:48:22"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
6947
,
"todayTotalOil"
:
632
,
"todayTotalTime"
:
421
,
"theMilleage"
:
6947
,
"theOil"
:
632
,
"theTime"
:
421
},
"travelData"
:
{
"totalMilleage"
:
40571
,
"totalOil"
:
3729
,
"totalTime"
:
2527
}}
\ No newline at end of file
{
"time"
:
{
"dateTime"
:
"2020-06-16 09:52:28"
,
"date"
:
"2020-06-16"
,
"time"
:
"09:52:28"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
13350
,
"todayTotalOil"
:
1215
,
"todayTotalTime"
:
809
,
"theMilleage"
:
4785
,
"theOil"
:
435
,
"theTime"
:
290
},
"travelData"
:
{
"totalMilleage"
:
90056
,
"totalOil"
:
8109
,
"totalTime"
:
5534
}}
\ No newline at end of file
data/protocolTools/carData/M202003060520.json
View file @
ab3a26b9
{
"time"
:
{
"dateTime"
:
"2020-06-11 11:33:44"
,
"date"
:
"2020-06-11"
,
"time"
:
"11:33:44"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
7469
,
"todayTotalOil"
:
629
,
"todayTotalTime"
:
456
,
"theMilleage"
:
640
,
"theOil"
:
40
,
"theTime"
:
40
},
"travelData"
:
{
"totalMilleage"
:
374385
,
"totalOil"
:
35025
,
"totalTime"
:
22280
},
"event"
:
{
"threeRapid"
:
{
"totalRapidlyAccelerate"
:
23
,
"totalSharpSlowdown"
:
20
,
"totalSharpTurn"
:
21
}}}
\ No newline at end of file
{
"time"
:
{
"dateTime"
:
"2020-06-16 13:13:58"
,
"date"
:
"2020-06-16"
,
"time"
:
"13:13:58"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
7802
,
"todayTotalOil"
:
752
,
"todayTotalTime"
:
470
,
"theMilleage"
:
7802
,
"theOil"
:
752
,
"theTime"
:
470
},
"travelData"
:
{
"totalMilleage"
:
387499
,
"totalOil"
:
36289
,
"totalTime"
:
23070
},
"event"
:
{
"threeRapid"
:
{
"totalRapidlyAccelerate"
:
23
,
"totalSharpSlowdown"
:
20
,
"totalSharpTurn"
:
21
}}}
\ No newline at end of file
lib/protocol/message/Location_msg.py
View file @
ab3a26b9
...
...
@@ -178,6 +178,7 @@ class Location_msg(MessageBase):
extra_FA
=
"FA"
+
self
.
int2hexStringByBytes
(
int
(
len
(
AlarmEvent_data
()
.
generateAlarmEvent_data
())
/
2
))
+
AlarmEvent_data
()
.
generateAlarmEvent_data
()
data
=
extra_01
+
extra_02
+
extra_11
+
extra_31
+
extra_EA
+
extra_EB
# data = extra_11 + extra_31 + extra_EA + extra_EB + extra_FA
# data = extra_11 + extra_31 + extra_EA + extra_FA
# data = extra_EB + extra_FA
...
...
lib/protocol/message/TerminalVersionInfo_msg.py
View file @
ab3a26b9
...
...
@@ -30,10 +30,10 @@ class TerminalVersionInfo_msg(MessageBase):
def
generateMsg_GUI
(
self
,
msgID
=
"0205"
,
phoneNum
=
"13146201119"
,
msgWaterCode
=
1
,
encryptionType
=
0
,
subPkg
=
0
,
\
softwareVersion
=
"KZP200_V201001"
,
softwareVersionDate
=
"2020-02-10"
,
CPUId
=
"CPU-12345678"
,
GMSType
=
"GMS-TYPE-123456"
,
\
GMS_IMEI
=
"GMS_IMEI_123456"
,
SIM_IMSI
=
"SIM_13146201119"
,
SIM_ICCID
=
"SIM_ICCID13146201119"
,
carType
=
22
,
VIN
=
"VIN_1234567891234"
,
\
totalMileage
=
389000
,
totalOilExpend
=
420000
,
displacement
=
1500
,
oilDensity
=
80
):
totalMileage
=
389000
,
totalOilExpend
=
420000
,
displacement
=
1500
,
oilDensity
=
80
,
OBDSerial
=
257
,
oilCalculateType
=
"01"
):
msg
=
""
msgBody
=
self
.
getMsgBody_GUI
(
softwareVersion
,
softwareVersionDate
,
CPUId
,
GMSType
,
GMS_IMEI
,
SIM_IMSI
,
SIM_ICCID
,
carType
,
VIN
,
\
totalMileage
,
totalOilExpend
,
displacement
,
oilDensity
)
totalMileage
,
totalOilExpend
,
displacement
,
oilDensity
,
OBDSerial
,
oilCalculateType
)
msgHeader
=
self
.
getMsgHeader_GUI
(
msgID
,
phoneNum
,
msgWaterCode
,
encryptionType
,
subPkg
,
msgBody
)
checkCode
=
self
.
getCheckCode
(
msgHeader
+
msgBody
)
msg
=
msg
+
self
.
IDENTIFY
...
...
@@ -98,6 +98,7 @@ class TerminalVersionInfo_msg(MessageBase):
OBDSerial
=
"0101"
#OBD协议编号
oilCalculateType
=
"01"
#油耗计算方式
msg
=
msg
+
softwareVersion
+
softwareVersionDate
+
CPUId
+
GSMType
+
GSM_IMEI
msg
=
msg
+
SIM_IMSI
+
SIM_ICCID
+
carType
+
VIN
+
totalMileage
msg
=
msg
+
totalOilExpend
+
displacement
+
oilDensity
+
OBDSerial
+
oilCalculateType
...
...
@@ -106,7 +107,7 @@ class TerminalVersionInfo_msg(MessageBase):
# 生成一条完整的消息,针对图形界面,可传递参数
def
getMsgBody_GUI
(
self
,
softwareVersion
=
"KZP200_V201001"
,
softwareVersionDate
=
"2020-02-10"
,
CPUId
=
"CPU-12345678"
,
GMSType
=
"GMS-TYPE-123456"
,
\
GMS_IMEI
=
"GMS_IMEI_123456"
,
SIM_IMSI
=
"SIM_13146201119"
,
SIM_ICCID
=
"SIM_ICCID13146201119"
,
carType
=
22
,
VIN
=
"VIN_1234567891234"
,
\
totalMileage
=
389000
,
totalOilExpend
=
420000
,
displacement
=
1500
,
oilDensity
=
92
,
OBDSerial
=
"0101"
,
oilCalculateType
=
"01"
):
totalMileage
=
389000
,
totalOilExpend
=
420000
,
displacement
=
1500
,
oilDensity
=
92
,
OBDSerial
=
257
,
oilCalculateType
=
"01"
):
msg
=
""
softwareVersion
=
self
.
GBKString2Hex
(
softwareVersion
)
#软件版本号
softwareVersionDate
=
self
.
GBKString2Hex
(
softwareVersionDate
)
#终端版本日期
...
...
@@ -121,7 +122,7 @@ class TerminalVersionInfo_msg(MessageBase):
totalOilExpend
=
self
.
int2hexStringByBytes
(
totalOilExpend
,
4
)
#装上终端后车辆累计总耗油量(ml)
displacement
=
self
.
int2hexStringByBytes
(
displacement
,
2
)
#排量
oilDensity
=
self
.
int2hexStringByBytes
(
oilDensity
,
2
)
#油密度
OBDSerial
=
OBDSerial
#OBD协议编号
OBDSerial
=
self
.
int2hexStringByBytes
(
OBDSerial
,
2
)
#OBD协议编号
oilCalculateType
=
oilCalculateType
#油耗计算方式
msg
=
msg
+
softwareVersion
+
softwareVersionDate
+
CPUId
+
GMSType
+
GMS_IMEI
...
...
lib/protocol/message/data/SaloonCarOBD_data.py
View file @
ab3a26b9
...
...
@@ -74,13 +74,16 @@ class SaloonCarOBD_data(MessageBase):
runTotalTime
=
"6709"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
7200000
,
4
)
#总耗油量
totalOilExpend
=
"670a"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
3700000
,
4
)
#OBD 累计里程,不支持 OBD 时,为基于 GPS 车速统计的车辆累计行驶总里程
OBDTotalMileage
=
"670b"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
123000
,
4
)
data
=
data
+
engineSpeed
+
carSpeed
+
surplusOil
+
coolingLiquidTemperature
+
airInletTemperature
data
=
data
+
intakeManifoldPressure
+
atmosphericPressure
+
envTemperature
+
acceleratorLocation
+
oilPressure
data
=
data
+
troubleCodeStatus
+
troubleCodeNum
+
airFlow
+
valveLocation
+
engineRunTime
data
=
data
+
troubleMileage
+
calculateLoadValue
+
fuelTrim
+
fireAngle
+
frontBrakeBlockAbrasion
data
=
data
+
backBrakeBlockAbrasion
+
brakeFluidLocation
+
engineOilLocation
+
tirePressureAlarm
+
coolingLiquidLocation
data
=
data
+
enduranceMileage
+
dashboardMileage
+
runTotalTime
+
totalOilExpend
data
=
data
+
enduranceMileage
+
dashboardMileage
+
runTotalTime
+
totalOilExpend
+
OBDTotalMileage
return
data
def
generateSaloonCarOBDData_GUI
(
self
,
data
):
dataHex
=
""
...
...
@@ -200,6 +203,10 @@ class SaloonCarOBD_data(MessageBase):
#总耗油量
totalOilExpend
=
"670a"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
int
(
data
[
"670a"
]),
4
)
dataHex
=
dataHex
+
totalOilExpend
if
(
"670b"
in
data
.
keys
()):
#OBD 累计里程
OBDTotalMileage
=
"670b"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
int
(
data
[
"670b"
]),
4
)
dataHex
=
dataHex
+
OBDTotalMileage
return
dataHex
def
generateSaloonCarOBDData_random
(
self
):
data
=
""
...
...
@@ -261,13 +268,15 @@ class SaloonCarOBD_data(MessageBase):
runTotalTime
=
"6709"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
self
.
getRandomNum
(
0
,
7200000
),
4
)
#总耗油量
totalOilExpend
=
"670a"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
self
.
getRandomNum
(
0
,
3700000
),
4
)
#OBD 累计里程
OBDTotalMileage
=
"670b"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
self
.
getRandomNum
(
0
,
3700000
),
4
)
data
=
data
+
engineSpeed
+
carSpeed
+
surplusOil
+
coolingLiquidTemperature
+
airInletTemperature
data
=
data
+
intakeManifoldPressure
+
atmosphericPressure
+
envTemperature
+
acceleratorLocation
+
oilPressure
data
=
data
+
troubleCodeStatus
+
troubleCodeNum
+
airFlow
+
valveLocation
+
engineRunTime
data
=
data
+
troubleMileage
+
calculateLoadValue
+
fuelTrim
+
fireAngle
+
frontBrakeBlockAbrasion
data
=
data
+
backBrakeBlockAbrasion
+
brakeFluidLocation
+
engineOilLocation
+
tirePressureAlarm
+
coolingLiquidLocation
data
=
data
+
enduranceMileage
+
dashboardMileage
+
runTotalTime
+
totalOilExpend
data
=
data
+
enduranceMileage
+
dashboardMileage
+
runTotalTime
+
totalOilExpend
+
OBDTotalMileage
return
data
#####################################################
...
...
lib/socket/messageTest.py
View file @
ab3a26b9
...
...
@@ -29,10 +29,10 @@ port = 9001
# msg = TerminalRegister_msg().generateMsg() #终端注册
# msg = TerminalCancle_msg().generateMsg() #终端注销
# msg = TerminalAuthenticate_msg().generateMsg() #终端鉴权
msg
=
TerminalVersionInfo_msg
()
.
generateMsg
()
#终端版本信息上报
#
msg = TerminalVersionInfo_msg().generateMsg() #终端版本信息上报
# msg = QueryTerminalParam_res().generateMsg() #查询终端参数应答
# msg = QueryTerminalProperty_res().generateMsg() #查询终端属性应答消息
#
msg = Location_msg().generateMsg() #位置信息汇报
msg
=
Location_msg
()
.
generateMsg
()
#位置信息汇报
# msg = DataUpstreamTransport_msg().generateMsg() #数据上行透传消息
# msg = TerminalUpdataResult_msg().generateMsg() #终端升级结果通知
# msg = LocationDataBatchUpdate_msg().generateMsg() #定位数据批量上传
...
...
@@ -67,9 +67,9 @@ def sendSingleMsg(msg):
return
print
(
data
)
print
(
PlatformCommon_res
(
data
)
.
getOriginalMsg
())
print
(
PlatformCommon_res
(
data
)
.
getMsg
())
#解析平台通用应答消息
print
(
TerminalRegister_res
(
data
)
.
getMsg
())
#解析终端注册应答消息
print
(
PlatefromVersionInfo_res
(
data
)
.
getMsg
())
#解析平台版本信息包上传应答
#
print(PlatformCommon_res(data).getMsg()) #解析平台通用应答消息
#
print(TerminalRegister_res(data).getMsg()) #解析终端注册应答消息
#
print(PlatefromVersionInfo_res(data).getMsg()) #解析平台版本信息包上传应答
client
.
close
()
def
closeSocket
(
soc
):
...
...
lib/socket/service/MessageSimulaterService.py
View file @
ab3a26b9
...
...
@@ -49,7 +49,7 @@ class MessageSimulaterService():
"6210"
:
"4508"
,
"6330"
:
"28"
,
"6460"
:
"65"
,
"6490"
:
"32"
,
"6701"
:
"0"
,
"6702"
:
"0"
,
"6703"
:
"1"
,
"6704"
:
"505"
,
"6705"
:
"1"
,
"6706"
:
"505"
,
"6707"
:
"505"
,
"6708"
:
"3500"
,
"6709"
:
"7200000"
,
"60C0"
:
"3000"
,
"60D0"
:
"60"
,
"62f0"
:
"801"
,
"60F0"
:
"88"
,
"60B0"
:
"20"
,
"60A0"
:
"276"
,
"61F0"
:
"3700"
,
"60E0"
:
"154"
,
"670a"
:
"3700000"
}}}
"61F0"
:
"3700"
,
"60E0"
:
"154"
,
"670a"
:
"3700000"
,
"670b"
:
"123000"
}}}
# 定义初始的obd数据,与上面的OBD数据保持一致,主要用于汽车行驶过程中数据变化量的计算
self
.
OBDdataOri
=
{
"msgID"
:
"0200"
,
"phoneNum"
:
"13146201119"
,
"msgWaterCode"
:
"1"
,
"encryptionType"
:
"0"
,
"subPkg"
:
"0"
,
"pkgCounts"
:
"0"
,
"baseInfo"
:
{
"alarmFlag"
:
0
,
"status"
:
262402
,
"latitude"
:
29.569133
,
"longtitude"
:
106.586571
,
...
...
@@ -59,7 +59,7 @@ class MessageSimulaterService():
"6210"
:
"4508"
,
"6330"
:
"28"
,
"6460"
:
"65"
,
"6490"
:
"32"
,
"6701"
:
"0"
,
"6702"
:
"0"
,
"6703"
:
"1"
,
"6704"
:
"505"
,
"6705"
:
"1"
,
"6706"
:
"505"
,
"6707"
:
"505"
,
"6708"
:
"3500"
,
"6709"
:
"7200000"
,
"60C0"
:
"3000"
,
"60D0"
:
"60"
,
"62f0"
:
"801"
,
"60F0"
:
"88"
,
"60B0"
:
"20"
,
"60A0"
:
"276"
,
"61F0"
:
"3700"
,
"60E0"
:
"154"
,
"670a"
:
"3700000"
}}}
"61F0"
:
"3700"
,
"60E0"
:
"154"
,
"670a"
:
"3700000"
,
"670b"
:
"123000"
}}}
def
getSn
(
self
):
...
...
@@ -217,11 +217,12 @@ class MessageSimulaterService():
self
.
OBDdata
[
"baseInfo"
][
"latitude"
]
=
self
.
gpsLine
[
self
.
gpsLineIndex
][
"lat"
]
self
.
OBDdata
[
"baseInfo"
][
"longtitude"
]
=
self
.
gpsLine
[
self
.
gpsLineIndex
][
"lng"
]
self
.
OBDdata
[
"baseInfo"
][
"directionAngle"
]
=
self
.
getDirAngle
()
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"60C0"
]
=
0
#发动机转速
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"60D0"
]
=
0
#车速
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"670a"
]
=
self
.
carData
[
"travelData"
][
"totalOil"
]
#总油耗
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"6709"
]
=
self
.
carData
[
"travelData"
][
"totalTime"
]
#总运行时间
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
=
self
.
carData
[
"travelData"
][
"totalMilleage"
]
#总里程
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"60C0"
]
=
0
# 发动机转速
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"60D0"
]
=
0
# 车速
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"670a"
]
=
self
.
carData
[
"travelData"
][
"totalOil"
]
# 总油耗
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"6709"
]
=
self
.
carData
[
"travelData"
][
"totalTime"
]
# 总运行时间
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
=
self
.
carData
[
"travelData"
][
"totalMilleage"
]
# 总里程
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"670b"
]
=
self
.
carData
[
"travelData"
][
"totalMilleage"
]
# OBD 累计里程
obdMsg
=
msgObj
.
generateMsg_GUI
(
self
.
OBDdata
)
self
.
sendMsg
(
obdMsg
)
type
=
self
.
getMsgFunId
(
obdMsg
)
...
...
@@ -296,6 +297,8 @@ class MessageSimulaterService():
plusMilleage
=
plusMilleage
+
int
(
self
.
sendDur
*
(
speed
*
1000
/
3600
))
plusMilleage2
=
int
(
self
.
sendDur
*
(
speed
*
1000
/
3600
))
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
=
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
+
int
(
plusMilleage
/
100
)
# 总里程
# OBD 累计里程,如果有该字段,则里程的计算方式使用该字段,如果没有,里程计算方式使用的是总里程字段
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"670b"
]
=
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"670b"
]
+
int
(
plusMilleage2
)
plusMilleage
=
plusMilleage
-
int
(
plusMilleage
/
100
)
*
100
obdObj
=
Location_msg
()
obdMsg
=
obdObj
.
generateMsg_GUI
(
self
.
OBDdata
)
...
...
@@ -351,6 +354,8 @@ class MessageSimulaterService():
plusMilleage
=
plusMilleage
+
int
(
self
.
sendDur
*
(
speed
*
1000
/
3600
))
plusMilleage2
=
int
(
self
.
sendDur
*
(
speed
*
1000
/
3600
))
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
=
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
+
int
(
plusMilleage
/
100
)
# 总里程
# OBD 累计里程,如果有该字段,则里程的计算方式使用该字段,如果没有,里程计算方式使用的是总里程字段
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"670b"
]
=
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"670b"
]
+
int
(
plusMilleage2
)
plusMilleage
=
plusMilleage
-
int
(
plusMilleage
/
100
)
*
100
obdObj
=
Location_msg
()
obdMsg
=
obdObj
.
generateMsg_GUI
(
self
.
OBDdata
)
...
...
templates/base.html
View file @
ab3a26b9
...
...
@@ -25,6 +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>-->
</ul>
</div>
</div>
...
...
templates/messageTools/message/location_msg_page.html
View file @
ab3a26b9
...
...
@@ -623,6 +623,7 @@
<span
style=
"margin-right:15px;"
><label><input
type=
"checkbox"
checked=
checked
id=
"dashboardMileage_checkbutton"
onclick=
"OBDIndoSelect(this)"
/>
仪表里程
</label>
</span>
<span
style=
"margin-right:15px;"
><label><input
type=
"checkbox"
checked=
checked
id=
"runTotalTime_checkbutton"
onclick=
"OBDIndoSelect(this)"
/>
车辆总运行时间
</label>
</span>
<span
style=
"margin-right:15px;"
><label><input
type=
"checkbox"
checked=
checked
id=
"totalOilExpend_checkbutton"
onclick=
"OBDIndoSelect(this)"
/>
总耗油量
</label>
</span>
<span
style=
"margin-right:15px;"
><label><input
type=
"checkbox"
checked=
checked
id=
"OBDTotalMileage_checkbutton"
onclick=
"OBDIndoSelect(this)"
/>
OBD累计里程
</label>
</span>
</div>
<ul
class=
"protocol_content"
style=
"padding:0px;"
>
<li
id=
"engineSpeed_li"
><label>
发动机转速:
</label><input
id=
"engineSpeed"
type=
"text"
class=
"form-control"
value=
"3000"
></li>
...
...
@@ -658,6 +659,7 @@
<li
id=
"dashboardMileage_li"
><label>
仪表里程:
</label><input
id=
"dashboardMileage"
type=
"text"
class=
"form-control"
value=
"3500"
></li>
<li
id=
"runTotalTime_li"
><label
style=
"word-break:break-all;font-size:10px;"
>
车辆总运行时间:
</label><input
id=
"runTotalTime"
type=
"text"
class=
"form-control"
value=
"7200000"
></li>
<li
id=
"totalOilExpend_li"
><label>
总耗油量:
</label><input
id=
"totalOilExpend"
type=
"text"
class=
"form-control"
value=
"3700000"
></li>
<li
id=
"OBDTotalMileage_li"
><label
style=
"word-break:break-all;font-size:10px;"
>
OBD累计里程:
</label><input
id=
"OBDTotalMileage"
type=
"text"
class=
"form-control"
value=
"123000"
></li>
</ul>
</div>
<div
id=
"div_ext_FA"
style=
"display:none;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;margin-top:5px;padding-left:10px;padding-right:10px;"
>
...
...
@@ -1220,6 +1222,7 @@ function getExtra_EB(){
var
dashboardMileage
=
$
(
"
#dashboardMileage
"
).
val
();
var
runTotalTime
=
$
(
"
#runTotalTime
"
).
val
();
var
totalOilExpend
=
$
(
"
#totalOilExpend
"
).
val
();
var
OBDTotalMileage
=
$
(
"
#OBDTotalMileage
"
).
val
();
if
(
$
(
"
#engineSpeed_checkbutton
"
).
is
(
'
:checked
'
)){
data
[
"
60C0
"
]
=
engineSpeed
;
...
...
@@ -1308,6 +1311,9 @@ function getExtra_EB(){
if
(
$
(
"
#totalOilExpend_checkbutton
"
).
is
(
'
:checked
'
)){
data
[
"
670a
"
]
=
totalOilExpend
;
}
if
(
$
(
"
#OBDTotalMileage_checkbutton
"
).
is
(
'
:checked
'
)){
data
[
"
670b
"
]
=
OBDTotalMileage
;
}
return
data
;
}
...
...
@@ -1689,6 +1695,8 @@ function OBDIndoSelect(e){
$
(
"
#runTotalTime_li
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
totalOilExpend_checkbutton
"
){
$
(
"
#totalOilExpend_li
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
OBDTotalMileage_checkbutton
"
){
$
(
"
#OBDTotalMileage_li
"
).
css
(
"
display
"
,
"
inline
"
)
}
}
else
{
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
engineSpeed_checkbutton
"
){
...
...
@@ -1749,6 +1757,8 @@ function OBDIndoSelect(e){
$
(
"
#runTotalTime_li
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
totalOilExpend_checkbutton
"
){
$
(
"
#totalOilExpend_li
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
OBDTotalMileage_checkbutton
"
){
$
(
"
#OBDTotalMileage_li
"
).
css
(
"
display
"
,
"
none
"
)
}
}
}
...
...
templates/messageTools/message/terminalVersionInfoUpload_msg_page.html
View file @
ab3a26b9
...
...
@@ -32,6 +32,16 @@
<li><label
style=
"word-break:break-all;font-size:12px;"
>
装上终端后车辆累计总耗油:
</label><input
id=
"totalOilExpend"
type=
"text"
class=
"form-control"
value=
"420000"
></li>
<li><label
style=
"word-break:break-all;font-size:12px;"
>
排量:
</label><input
id=
"displacement"
type=
"text"
class=
"form-control"
value=
"1500"
></li>
<li><label
style=
"word-break:break-all;font-size:12px;"
>
油密度:
</label><input
id=
"oilDensity"
type=
"text"
class=
"form-control"
value=
"92"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
OBD协议编号:
</label><input
id=
"OBDSerial"
type=
"text"
class=
"form-control"
value=
"257"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
油耗计算方式:
</label><select
id=
"oilCalculateType"
class=
"form-control"
>
<option
value=
"01"
>
J1939 油耗算法 1
</option>
<option
value=
"02"
>
J1939 油耗算法 2
</option>
<option
value=
"03"
>
J1939 油耗算法 3
</option>
<option
value=
"04"
>
J1939 油耗算法 4
</option>
<option
value=
"05"
>
J1939 油耗算法 5
</option>
<option
value=
"0B"
>
OBD 油耗算法 1
</option>
<option
value=
"0C"
>
OBD 油耗算法 2
</option>
</select></li>
</ul>
<H3
style=
"border-bottom: 1px solid #eee;"
>
控制:
</H3>
<div
style=
"width:100%;padding:5px;margin-top:10px;"
>
...
...
@@ -71,6 +81,8 @@ $("#sendMsgBtn").click(function(){
var
totalOilExpend
=
$
(
"
#totalOilExpend
"
).
val
();
var
displacement
=
$
(
"
#displacement
"
).
val
();
var
oilDensity
=
$
(
"
#oilDensity
"
).
val
();
var
OBDSerial
=
$
(
"
#OBDSerial
"
).
val
();
var
oilCalculateType
=
$
(
"
#oilCalculateType
"
).
val
();
var
data
=
{};
data
[
"
msgID
"
]
=
msgID
;
...
...
@@ -93,6 +105,8 @@ $("#sendMsgBtn").click(function(){
data
[
"
totalOilExpend
"
]
=
totalOilExpend
;
data
[
"
displacement
"
]
=
displacement
;
data
[
"
oilDensity
"
]
=
oilDensity
;
data
[
"
OBDSerial
"
]
=
OBDSerial
;
data
[
"
oilCalculateType
"
]
=
oilCalculateType
;
var
host
=
window
.
location
.
host
;
$
(
"
#showFeedback
"
).
val
(
""
)
...
...
views/messageTools/message_process.py
View file @
ab3a26b9
...
...
@@ -183,12 +183,15 @@ def porcessTerminalVersionInfoUploadMsg():
totalOilExpend
=
int
(
request
.
form
.
get
(
"totalOilExpend"
))
displacement
=
int
(
request
.
form
.
get
(
"displacement"
))
oilDensity
=
int
(
request
.
form
.
get
(
"oilDensity"
))
OBDSerial
=
int
(
request
.
form
.
get
(
"OBDSerial"
))
oilCalculateType
=
request
.
form
.
get
(
"oilCalculateType"
)
data
=
{}
if
(
msgID
==
None
or
phoneNum
==
None
or
msgWaterCode
==
None
or
encryptionType
==
None
or
subPkg
==
None
\
or
pkgCounts
==
None
or
softwareVersion
==
None
or
softwareVersionDate
==
None
or
CPUId
==
None
or
\
GMSType
==
None
or
GMS_IMEI
==
None
or
SIM_IMSI
==
None
or
SIM_ICCID
==
None
or
carType
==
None
\
or
VIN
==
None
or
totalMileage
==
None
or
totalOilExpend
==
None
or
displacement
==
None
or
oilDensity
==
None
):
or
VIN
==
None
or
totalMileage
==
None
or
totalOilExpend
==
None
or
displacement
==
None
\
or
oilDensity
==
None
or
OBDSerial
==
None
or
oilCalculateType
==
None
):
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Info: 请检查是否传入了空数据!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
...
...
@@ -201,7 +204,7 @@ def porcessTerminalVersionInfoUploadMsg():
terminalVersionInfoObj
=
TerminalVersionInfo_msg
()
msg
=
terminalVersionInfoObj
.
generateMsg_GUI
(
msgID
,
phoneNum
,
msgWaterCode
,
encryptionType
,
subPkg
,
softwareVersion
,
\
softwareVersionDate
,
CPUId
,
GMSType
,
GMS_IMEI
,
SIM_IMSI
,
SIM_ICCID
,
carType
,
VIN
,
\
totalMileage
,
totalOilExpend
,
displacement
,
oilDensity
)
totalMileage
,
totalOilExpend
,
displacement
,
oilDensity
,
OBDSerial
,
oilCalculateType
)
cliSocket
.
send
(
msg
)
socRecv_1
=
cliSocket
.
receive
()
socRecv_2
=
str
(
socRecv_1
)
...
...
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