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
705f5da0
Commit
705f5da0
authored
Apr 24, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新车机模拟器开发完成
parent
d71af237
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
12 deletions
+23
-12
data/messageTools/carData/012201500010.json
data/messageTools/carData/012201500010.json
+1
-0
lib/socket/service/MessageSimulaterService.py
lib/socket/service/MessageSimulaterService.py
+21
-12
views/messageTools/M_simulater_process.py
views/messageTools/M_simulater_process.py
+1
-0
No files found.
data/messageTools/carData/012201500010.json
0 → 100644
View file @
705f5da0
{
"time"
:
{
"dateTime"
:
"2020-04-24 11:28:51"
,
"date"
:
"2020-04-24"
,
"time"
:
"11:28:51"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
1755
,
"todayTotalOil"
:
314
,
"todayTotalTime"
:
157
,
"theMilleage"
:
1738
,
"theOil"
:
158
,
"theTime"
:
79
},
"travelData"
:
{
"totalMilleage"
:
1755
,
"totalOil"
:
314
,
"totalTime"
:
157
}}
\ No newline at end of file
lib/socket/service/MessageSimulaterService.py
View file @
705f5da0
...
...
@@ -185,11 +185,11 @@ class MessageSimulaterService():
self
.
OBDdata
[
"baseInfo"
][
"infoTime"
]
=
curTime
self
.
OBDdata
[
"baseInfo"
][
"latitude"
]
=
self
.
gpsLine
[
self
.
gpsLineIndex
][
"lat"
]
self
.
OBDdata
[
"baseInfo"
][
"longtitude"
]
=
self
.
gpsLine
[
self
.
gpsLineIndex
][
"lng"
]
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"
]
#总里程
obdMsg
=
msgObj
.
generateMsg_GUI
(
self
.
OBDdata
)
self
.
sendMsg
(
obdMsg
)
type
=
self
.
getMsgFunId
(
obdMsg
)
...
...
@@ -201,9 +201,11 @@ class MessageSimulaterService():
#车机行驶服务
########################################################
def
serviceTrave
(
self
):
plusMilleage
=
0
#每次增加的里程数,上报的时候要除以100,因为原始文档总里程的单位是0.1km
plusMilleage2
=
0
#每次增加的里程数,用于写入文件 用,写入后置为0
while
self
.
serviceStatus
==
1
:
gpsMsg
=
""
obdMsg
=
""
obdMsg
=
""
#对比比上一次上报,所增加的里程
if
self
.
travelStatus
==
0
:
#行驶服务未启动
gpsParams
=
{
"msgID"
:
"0200"
,
"phoneNum"
:
"13146201119"
,
"msgWaterCode"
:
"1"
,
"encryptionType"
:
"0"
,
"subPkg"
:
"0"
,
"pkgCounts"
:
"0"
,
"baseInfo"
:
{
"alarmFlag"
:
0
,
"status"
:
262402
,
"latitude"
:
29.569133
,
...
...
@@ -254,7 +256,10 @@ class MessageSimulaterService():
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"60D0"
]
=
speed
# 车速
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"670a"
]
=
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"670a"
]
+
int
((
self
.
sendDur
*
(
speed
*
1000
/
3600
))
*
(
1000
/
(
oilExpend
*
1000
)))
# 总油耗
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"6709"
]
=
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"6709"
]
+
self
.
sendDur
# 总运行时间
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
=
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
+
int
(
self
.
sendDur
*
(
speed
*
1000
/
3600
))
# 总里程
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
)
# 总里程
plusMilleage
=
plusMilleage
-
int
(
plusMilleage
/
100
)
*
100
obdObj
=
Location_msg
()
obdMsg
=
obdObj
.
generateMsg_GUI
(
self
.
OBDdata
)
if
self
.
travelDirection
==
0
:
...
...
@@ -278,7 +283,8 @@ class MessageSimulaterService():
"subPkg"
:
"0"
,
"pkgCounts"
:
"0"
,
"baseInfo"
:
{
"alarmFlag"
:
0
,
"status"
:
262402
,
"latitude"
:
29.569133
,
"longtitude"
:
106.586571
,
"elevation"
:
"521"
,
"speed"
:
"0"
,
"directionAngle"
:
"59"
,
"infoTime"
:
"2020-04-21 18:09:34"
}}
"directionAngle"
:
"59"
,
"infoTime"
:
"2020-04-21 18:09:34"
},
"extraInfo"
:
{}}
timeStamp
=
time
.
time
()
timeArray
=
time
.
localtime
(
timeStamp
)
curTime
=
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
,
timeArray
)
...
...
@@ -301,12 +307,15 @@ class MessageSimulaterService():
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"60D0"
]
=
speed
# 车速
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"670a"
]
=
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"670a"
]
+
int
((
self
.
sendDur
*
(
speed
*
1000
/
3600
))
*
(
1000
/
(
oilExpend
*
1000
)))
# 总油耗
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"6709"
]
=
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"6709"
]
+
self
.
sendDur
# 总运行时间
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
=
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
+
int
(
self
.
sendDur
*
(
speed
*
1000
/
3600
))
# 总里程
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
)
# 总里程
plusMilleage
=
plusMilleage
-
int
(
plusMilleage
/
100
)
*
100
obdObj
=
Location_msg
()
obdMsg
=
obdObj
.
generateMsg_GUI
(
self
.
OBDdata
)
self
.
carDataObj
.
setTodayTotalMilleage
(
self
.
carData
[
"curDayTravel"
][
"todayTotalMilleage"
]
+
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
-
self
.
OBDdataOri
[
"extraInfo"
][
"01"
][
"extra_01"
]
)
self
.
carDataObj
.
setTheMilleage
(
self
.
carData
[
"curDayTravel"
][
"theMilleage"
]
+
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
-
self
.
OBDdataOri
[
"extraInfo"
][
"01"
][
"extra_01"
]
)
self
.
carDataObj
.
setTotalMilleage
(
self
.
carData
[
"travelData"
][
"totalMilleage"
]
+
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
-
self
.
OBDdataOri
[
"extraInfo"
][
"01"
][
"extra_01"
]
)
self
.
carDataObj
.
setTodayTotalMilleage
(
self
.
carData
[
"curDayTravel"
][
"todayTotalMilleage"
]
+
plusMilleage2
)
self
.
carDataObj
.
setTheMilleage
(
self
.
carData
[
"curDayTravel"
][
"theMilleage"
]
+
plusMilleage2
)
self
.
carDataObj
.
setTotalMilleage
(
self
.
carData
[
"travelData"
][
"totalMilleage"
]
+
plusMilleage2
)
temp
=
self
.
OBDdata
[
"extraInfo"
][
"01"
][
"extra_01"
]
self
.
OBDdataOri
[
"extraInfo"
][
"01"
][
"extra_01"
]
=
temp
self
.
carDataObj
.
setTodayTodayTotalOil
(
self
.
carData
[
"curDayTravel"
][
"todayTotalOil"
]
+
self
.
OBDdata
[
"extraInfo"
][
"EB"
][
"670a"
]
-
self
.
OBDdataOri
[
"extraInfo"
][
"EB"
][
"670a"
])
...
...
views/messageTools/M_simulater_process.py
View file @
705f5da0
...
...
@@ -69,6 +69,7 @@ def porcessConnect():
service
.
setSocket
(
cliSocket
)
service
.
setTimeout
(
int
(
params
[
"timeout"
]))
service
.
setCarId
(
params
[
"phoneNum"
])
service
.
setSendDur
(
int
(
params
[
"durTime"
]))
service
.
setData
(
params
)
#传入页面传过来的数据
service
.
startWebsocketService
()
#启动websocket服务
service
.
startReciveService
()
#接收消息的服务
...
...
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