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
2776862b
Commit
2776862b
authored
May 20, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
M500模拟器完成了支持终端重启应答和GPSR查询参数应答功能
parent
c1fd94e4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
22 deletions
+35
-22
data/protocolTools/carData/M202003060520.json
data/protocolTools/carData/M202003060520.json
+1
-1
lib/protocol/report/response/GPRS_response.py
lib/protocol/report/response/GPRS_response.py
+16
-16
lib/socket/service/ProtocolSimulaterService.py
lib/socket/service/ProtocolSimulaterService.py
+17
-4
templates/m300Tools/report/P_alarm_m300_page.html
templates/m300Tools/report/P_alarm_m300_page.html
+1
-1
No files found.
data/protocolTools/carData/M202003060520.json
View file @
2776862b
{
"time"
:
{
"dateTime"
:
"2020-05-19 11:09:47"
,
"date"
:
"2020-05-19"
,
"time"
:
"11:09:47"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
7518
,
"todayTotalOil"
:
723
,
"todayTotalTime"
:
453
,
"theMilleage"
:
1328
,
"theOil"
:
128
,
"theTime"
:
80
},
"travelData"
:
{
"totalMilleage"
:
291255
,
"totalOil"
:
27570
,
"totalTime"
:
17235
},
"event"
:
{
"threeRapid"
:
{
"totalRapidlyAccelerate"
:
14
,
"totalSharpSlowdown"
:
13
,
"totalSharpTurn"
:
13
}}}
\ No newline at end of file
{
"time"
:
{
"dateTime"
:
"2020-05-19 11:09:47"
,
"date"
:
"2020-05-19"
,
"time"
:
"11:09:47"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
40924
,
"todayTotalOil"
:
3769
,
"todayTotalTime"
:
2477
,
"theMilleage"
:
1452
,
"theOil"
:
132
,
"theTime"
:
88
},
"travelData"
:
{
"totalMilleage"
:
324661
,
"totalOil"
:
30616
,
"totalTime"
:
19259
},
"event"
:
{
"threeRapid"
:
{
"totalRapidlyAccelerate"
:
14
,
"totalSharpSlowdown"
:
13
,
"totalSharpTurn"
:
13
}}}
\ No newline at end of file
lib/protocol/report/response/GPRS_response.py
View file @
2776862b
...
...
@@ -6,14 +6,14 @@
from
lib.protocol.report.ProtocolBase
import
ProtocolBase
class
Update
_response
(
ProtocolBase
):
class
GPRS
_response
(
ProtocolBase
):
dataDefault
=
[{
"serverIndex"
:
"1"
,
"serverAddressType"
:
0
,
"serverAddress"
:
"10.100.12.31"
,
"comPort"
:
"9008"
,
"comType"
:
0
,
"APN"
:
"tnet"
,
\
"username"
:
"yuanhong"
,
"password"
:
"123456"
},{
"serverIndex"
:
"1"
,
"serverAddressType"
:
0
,
"serverAddress"
:
"10.100.12.3
1
"
,
"comPort"
:
"9008"
,
"comType"
:
0
,
"APN"
:
"tnet"
,
\
"username"
:
"yuanhong"
,
"password"
:
"123456"
},{
"serverIndex"
:
"1"
,
"serverAddressType"
:
0
,
"serverAddress"
:
"10.100.12.3
1
"
,
"comPort"
:
"9008"
,
"comType"
:
0
,
"APN"
:
"tnet"
,
\
"username"
:
"yuanhong"
,
"password"
:
"123456"
},{
"serverIndex"
:
"1"
,
"serverAddressType"
:
0
,
"serverAddress"
:
"10.100.12.3
2
"
,
"comPort"
:
"9008"
,
"comType"
:
0
,
"APN"
:
"tnet"
,
\
"username"
:
"yuanhong"
,
"password"
:
"123456"
},{
"serverIndex"
:
"1"
,
"serverAddressType"
:
0
,
"serverAddress"
:
"10.100.12.3
3
"
,
"comPort"
:
"9008"
,
"comType"
:
0
,
"APN"
:
"tnet"
,
\
"username"
:
"yuanhong"
,
"password"
:
"123456"
}]
def
__init__
(
self
,
msgCount
=
1
,
WATER_CODE
=
1000
,
DEV_ID
=
"M121501010001"
,
data
=
[{
"serverIndex"
:
"1"
,
"serverAddressType"
:
0
,
"serverAddress"
:
"10.100.12.31"
,
"comPort"
:
"9008"
,
"comType"
:
0
,
"APN"
:
"tnet"
,
\
"username"
:
"yuanhong"
,
"password"
:
"123456"
},{
"serverIndex"
:
"2"
,
"serverAddressType"
:
0
,
"serverAddress"
:
"10.100.12.3
1
"
,
"comPort"
:
"9008"
,
"comType"
:
0
,
"APN"
:
"tnet"
,
\
"username"
:
"yuanhong"
,
"password"
:
"123456"
},{
"serverIndex"
:
"3"
,
"serverAddressType"
:
0
,
"serverAddress"
:
"10.100.12.3
1
"
,
"comPort"
:
"9008"
,
"comType"
:
0
,
"APN"
:
"tnet"
,
\
"username"
:
"yuanhong"
,
"password"
:
"123456"
},{
"serverIndex"
:
"2"
,
"serverAddressType"
:
0
,
"serverAddress"
:
"10.100.12.3
2
"
,
"comPort"
:
"9008"
,
"comType"
:
0
,
"APN"
:
"tnet"
,
\
"username"
:
"yuanhong"
,
"password"
:
"123456"
},{
"serverIndex"
:
"3"
,
"serverAddressType"
:
0
,
"serverAddress"
:
"10.100.12.3
3
"
,
"comPort"
:
"9008"
,
"comType"
:
0
,
"APN"
:
"tnet"
,
\
"username"
:
"yuanhong"
,
"password"
:
"123456"
}]):
super
()
.
__init__
()
self
.
msgCount
=
int
(
msgCount
)
...
...
@@ -30,7 +30,7 @@ class Update_response(ProtocolBase):
HEADER
=
"4040"
#消息头
WATER_CODE
=
self
.
getWaterCode
(
self
.
WATER_CODE
)
#消息流水号
DEV_ID
=
self
.
devid2hexString
(
self
.
DEV_ID
)
#设备id
FUN_ID
=
"
8
105"
# 功能id
FUN_ID
=
"
0
105"
# 功能id
data
=
""
#数据段
data
+=
self
.
generateUpdateData
()
LENGTH
=
self
.
getMsgLength
(
int
(
len
(
WATER_CODE
+
DEV_ID
+
FUN_ID
+
data
)
/
2
))
# 消息长度
...
...
@@ -70,6 +70,6 @@ class Update_response(ProtocolBase):
return
dataHex
if
__name__
==
"__main__"
:
print
(
Update
_response
()
.
generateMsg
())
print
(
GPRS
_response
()
.
generateMsg
())
lib/socket/service/ProtocolSimulaterService.py
View file @
2776862b
...
...
@@ -16,6 +16,7 @@ from lib.protocol.report.EventReport_protocol import EventReport_protocol
from
lib.protocol.report.GPSReport_protocol
import
GPSReport_protocol
from
lib.protocol.report.OBDReport_CAN_protocol
import
OBDReport_CAN_protocol
from
lib.protocol.report.response.Common_response
import
Common_response
from
lib.protocol.report.response.GPRS_response
import
GPRS_response
from
lib.protocol.report.response.Update_response
import
Update_response
from
lib.socket.service.ProtocolSimulaterDataService
import
ProtocolSimulaterDataService
from
lib.socket.service.websocket_service
import
Websocket_service
...
...
@@ -291,20 +292,32 @@ class ProtocolSimulaterService():
#收到 某些类型的消息后执行回复操作
def
doResponse
(
self
,
msg
):
msgFunId
=
self
.
getMsgFunId
(
msg
)
if
msgFunId
==
"8205"
:
msg
=
Common_response
(
resId
=
"8205"
)
.
generateCommonMsg
()
if
msgFunId
==
"8105"
:
msg
=
GPRS_response
(
DEV_ID
=
self
.
carId
)
.
generateMsg
()
self
.
sendMsg
(
msg
)
self
.
sn
=
self
.
sn
+
1
type
=
self
.
getMsgFunId
(
msg
)
self
.
websocket
.
sendMsgToClient
(
type
+
">>>>查询GPSR通信参数应答:"
+
msg
,
self
.
websocketId
)
elif
msgFunId
==
"8201"
:
msg
=
Common_response
(
DEV_ID
=
self
.
carId
,
resId
=
"8201"
)
.
generateCommonMsg
()
self
.
sendMsg
(
msg
)
self
.
sn
=
self
.
sn
+
1
type
=
self
.
getMsgFunId
(
msg
)
self
.
websocket
.
sendMsgToClient
(
type
+
">>>>终端重启应答:"
+
msg
,
self
.
websocketId
)
elif
msgFunId
==
"8205"
:
msg
=
Common_response
(
DEV_ID
=
self
.
carId
,
resId
=
"8205"
)
.
generateCommonMsg
()
self
.
sendMsg
(
msg
)
self
.
sn
=
self
.
sn
+
1
type
=
self
.
getMsgFunId
(
msg
)
self
.
websocket
.
sendMsgToClient
(
type
+
">>>>设置GPSR通信参数应答:"
+
msg
,
self
.
websocketId
)
elif
msgFunId
==
"8206"
:
msg
=
Common_response
(
resId
=
"8206"
)
.
generateCommonMsg
()
msg
=
Common_response
(
DEV_ID
=
self
.
carId
,
resId
=
"8206"
)
.
generateCommonMsg
()
self
.
sendMsg
(
msg
)
self
.
sn
=
self
.
sn
+
1
type
=
self
.
getMsgFunId
(
msg
)
self
.
websocket
.
sendMsgToClient
(
type
+
">>>>设置车辆OBD适配信息应答:"
+
msg
,
self
.
websocketId
)
elif
msgFunId
==
"8300"
:
msg
=
Update_response
()
.
generateUpdateMsg
()
msg
=
Update_response
(
DEV_ID
=
self
.
carId
)
.
generateUpdateMsg
()
self
.
sendMsg
(
msg
)
self
.
sn
=
self
.
sn
+
1
type
=
self
.
getMsgFunId
(
msg
)
...
...
templates/m300Tools/report/P_alarm_m300_page.html
View file @
2776862b
...
...
@@ -224,7 +224,7 @@
</div>
</li>
</ul>
<sapn><label>
报警类别:
</label><input
id=
"alarmType"
type=
"text"
class=
"form-control"
value=
"0001"
></sapn>
</div>
<H3
style=
"border-bottom: 1px solid #eee;"
>
控制:
</H3>
<div
style=
"width:100%;padding:5px;margin-top:10px;"
>
...
...
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