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
7fc2340b
Commit
7fc2340b
authored
May 13, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
碰撞告警图形界面开发完成
parent
2a514be0
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
52 additions
and
19 deletions
+52
-19
config/messageTools/messageTools.conf
config/messageTools/messageTools.conf
+2
-2
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/appendix/EventClass.py
lib/protocol/appendix/EventClass.py
+3
-3
lib/protocol/m300/OBDCAN_protocol_m300.py
lib/protocol/m300/OBDCAN_protocol_m300.py
+15
-8
lib/protocol/report/EventReport_protocol.py
lib/protocol/report/EventReport_protocol.py
+4
-1
lib/socket/service/websocket_service.py
lib/socket/service/websocket_service.py
+2
-2
templates/m300Tools/report/P_CAN_m300_page.html
templates/m300Tools/report/P_CAN_m300_page.html
+1
-1
templates/protocolTools/report/event_protocol_page.html
templates/protocolTools/report/event_protocol_page.html
+23
-0
No files found.
config/messageTools/messageTools.conf
View file @
7fc2340b
[
socket
]
host
=
v
.
vandyo
.
cn
port
=
90
18
host
=
10
.
100
.
11
.
20
port
=
90
01
data/messageTools/carData/012201500010.json
View file @
7fc2340b
{
"time"
:
{
"dateTime"
:
"2020-04-27 17:44:26"
,
"date"
:
"2020-04-27"
,
"time"
:
"17:44:26"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
4101
,
"todayTotalOil"
:
276
,
"todayTotalTime"
:
255
,
"theMilleage"
:
1888
,
"theOil"
:
118
,
"theTime"
:
118
},
"travelData"
:
{
"totalMilleage"
:
4101
,
"totalOil"
:
276
,
"totalTime"
:
255
}}
\ No newline at end of file
{
"time"
:
{
"dateTime"
:
"2020-05-13 16:33:29"
,
"date"
:
"2020-05-13"
,
"time"
:
"16:33:29"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
2407
,
"todayTotalOil"
:
232
,
"todayTotalTime"
:
145
,
"theMilleage"
:
1411
,
"theOil"
:
136
,
"theTime"
:
85
},
"travelData"
:
{
"totalMilleage"
:
6508
,
"totalOil"
:
508
,
"totalTime"
:
400
}}
\ No newline at end of file
data/protocolTools/carData/M202003060520.json
View file @
7fc2340b
{
"time"
:
{
"dateTime"
:
"2020-05-11 10:59:13"
,
"date"
:
"2020-05-11"
,
"time"
:
"10:59:13"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
8549
,
"todayTotalOil"
:
824
,
"todayTotalTime"
:
515
,
"theMilleage"
:
830
,
"theOil"
:
80
,
"theTime"
:
50
},
"travelData"
:
{
"totalMilleage"
:
158616
,
"totalOil"
:
15025
,
"totalTime"
:
9286
},
"event"
:
{
"threeRapid"
:
{
"totalRapidlyAccelerate"
:
8
,
"totalSharpSlowdown"
:
6
,
"totalSharpTurn"
:
9
}}}
\ No newline at end of file
{
"time"
:
{
"dateTime"
:
"2020-05-13 10:53:36"
,
"date"
:
"2020-05-13"
,
"time"
:
"10:53:36"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
24791
,
"todayTotalOil"
:
2386
,
"todayTotalTime"
:
1479
,
"theMilleage"
:
1698
,
"theOil"
:
158
,
"theTime"
:
88
},
"travelData"
:
{
"totalMilleage"
:
249738
,
"totalOil"
:
23752
,
"totalTime"
:
14743
},
"event"
:
{
"threeRapid"
:
{
"totalRapidlyAccelerate"
:
22
,
"totalSharpSlowdown"
:
19
,
"totalSharpTurn"
:
24
}}}
\ No newline at end of file
lib/protocol/appendix/EventClass.py
View file @
7fc2340b
...
...
@@ -184,15 +184,15 @@ class EventClass(ProtocolBase):
return
data
#0023 碰撞报警附带信息
def
collisionAlarmExtraInfo
(
self
):
totalCount
=
self
.
int2hexStringByBytes
(
7
,
2
)
#历史碰撞总次数
def
collisionAlarmExtraInfo
(
self
,
totalCount
=
7
,
dataProperty
=
1
):
totalCount
=
self
.
int2hexStringByBytes
(
totalCount
,
2
)
#历史碰撞总次数
# 1:表示事件发生时刻,前10秒的事件采样数据;
# [碰撞报警前后10秒采样数据附带信息]
# 2:表示事件发生时刻,后10秒的事件采样数据;
# [碰撞报警前后10秒采样数据附带信息]
# 3:表示事件发生时刻,后120秒的事件采样数据;
# [碰撞报警后120秒采样数据附带信息]
dataProperty
=
self
.
int2hexString
(
1
)
dataProperty
=
self
.
int2hexString
(
dataProperty
)
extraInfo
=
self
.
collisionSamplingData
()
#附带信息
data
=
totalCount
+
dataProperty
+
extraInfo
return
data
...
...
lib/protocol/m300/OBDCAN_protocol_m300.py
View file @
7fc2340b
...
...
@@ -7,7 +7,7 @@ from lib.protocol.m300.M300Base import M300Base
'''
class
OBDCAN_protocol_m300
(
M300Base
):
def
__init__
(
self
,
waterCode
=
3
,
DEV_ID
=
"M121501010001"
,
encryptionType
=
0
,
timeInfo
=
"2020-03-30 17:00:59"
,
prototolType
=
"11"
,
statusMask
=
"
01010101010101010101
"
\
def
__init__
(
self
,
waterCode
=
3
,
DEV_ID
=
"M121501010001"
,
encryptionType
=
0
,
timeInfo
=
"2020-03-30 17:00:59"
,
prototolType
=
"11"
,
statusMask
=
"
ffffffffffffffffffff
"
\
,
safeStatus
=
0
,
doorStatus
=
0
,
lockStatus
=
0
,
windowStatus
=
0
,
lightStatus
=
0
,
swichStatusA
=
0
,
swichStatusB
=
0
,
dataBit
=
0
\
,
dataFlowMask
=
"fffffffd"
,
votage
=
360
,
totalMilleageType
=
2
,
totalMilleage
=
3000
,
totalOil
=
300
,
troubleLightStatus
=
0
\
,
troubleCodeNum
=
2
,
engineSpeed
=
3000
,
speed
=
60
,
airInletTemperature
=
88
,
coolingLiquidTemperature
=
76
,
envTemperature
=
65
\
...
...
@@ -86,13 +86,20 @@ class OBDCAN_protocol_m300(M300Base):
dateInfo
=
self
.
getDateInfo
(
self
.
timeInfo
)
# 日期
prototolType
=
self
.
prototolType
#协议类别
statusMask
=
self
.
statusMask
#状态掩码
safeStatus
=
self
.
getSafeStatus
()
#安全状态
doorStatus
=
self
.
getDoorStatus
()
#门状态
lockStatus
=
self
.
getLockStatus
()
#锁状态
windowStatus
=
self
.
getWindowStatus
()
#窗户状态
lightStatus
=
self
.
getLightStatus
()
#灯状态
swichStatusA
=
self
.
getSwichStatusA
()
#开关状态A
swichStatusB
=
self
.
getSwichStatusB
()
# 开关状态B
# safeStatus = self.getSafeStatus() #安全状态
# doorStatus = self.getDoorStatus() #门状态
# lockStatus = self.getLockStatus() #锁状态
# windowStatus = self.getWindowStatus() #窗户状态
# lightStatus = self.getLightStatus() #灯状态
# swichStatusA = self.getSwichStatusA() #开关状态A
# swichStatusB = self.getSwichStatusB() # 开关状态B
safeStatus
=
self
.
int2hexStringByBytes
(
self
.
safeStatus
)
# 安全状态
doorStatus
=
self
.
int2hexStringByBytes
(
self
.
doorStatus
)
# 门状态
lockStatus
=
self
.
int2hexStringByBytes
(
self
.
lockStatus
)
# 锁状态
windowStatus
=
self
.
int2hexStringByBytes
(
self
.
windowStatus
)
# 窗户状态
lightStatus
=
self
.
int2hexStringByBytes
(
self
.
lightStatus
)
# 灯状态
swichStatusA
=
self
.
int2hexStringByBytes
(
self
.
swichStatusA
)
# 开关状态A
swichStatusB
=
self
.
int2hexStringByBytes
(
self
.
swichStatusB
)
# 开关状态B
dataBit
=
self
.
getDataBit
()
#数据字节
retain9
=
self
.
int2hexStringByBytes
(
self
.
retain9
)
retail10
=
self
.
int2hexStringByBytes
(
self
.
retail10
)
...
...
lib/protocol/report/EventReport_protocol.py
View file @
7fc2340b
...
...
@@ -262,7 +262,10 @@ class EventReport_protocol(ProtocolBase):
int
(
eventData
[
"0022"
][
"dataProperty"
]))
data
=
data
+
"0022"
+
self
.
int2hexStringByBytes
(
int
((
len
(
theData
)
/
2
)),
2
)
+
theData
if
(
"0023"
in
eventData
.
keys
()):
#碰撞告警
pass
eventObj
=
EventClass
()
theData
=
eventObj
.
collisionAlarmExtraInfo
(
int
(
eventData
[
"0023"
][
"totalCount"
]),
int
(
eventData
[
"0023"
][
"dataProperty"
]),)
data
=
data
+
"0023"
+
self
.
int2hexStringByBytes
(
int
((
len
(
theData
)
/
2
)),
2
)
+
theData
if
(
"0036"
in
eventData
.
keys
()):
#低档高速报警
eventObj
=
EventClass
()
theData
=
eventObj
.
lowGearHighSpeedAlarm
(
int
(
eventData
[
"0036"
][
"alarmType"
]),
int
(
eventData
[
"0036"
][
"durationTime"
]))
...
...
lib/socket/service/websocket_service.py
View file @
7fc2340b
...
...
@@ -90,14 +90,14 @@ class Websocket_service(SocketBase):
#给指定客户端发送消息
def
sendMsgToClient
(
self
,
msg
,
clientId
):
print
(
self
.
clients
)
print
(
self
.
server
)
data
=
{}
data
[
"code"
]
=
"0002"
data
[
"client"
]
=
self
.
currentClient
data
[
"msg"
]
=
"收到消息:"
+
msg
data
=
json
.
dumps
(
data
)
self
.
server
.
send_message
(
self
.
clients
[
clientId
],
data
)
print
(
self
.
clients
)
print
(
self
.
server
)
if
__name__
==
"__main__"
:
...
...
templates/m300Tools/report/P_CAN_m300_page.html
View file @
7fc2340b
...
...
@@ -30,7 +30,7 @@
<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:350px;"
><label>
状态掩码:
</label><input
style=
"width:250px;"
id=
"statusMask"
type=
"text"
class=
"form-control"
value=
"
ffffffffffffffffffff
"
></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"
>
...
...
templates/protocolTools/report/event_protocol_page.html
View file @
7fc2340b
...
...
@@ -304,6 +304,8 @@
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"0021"
onclick=
"eventSelect(this)"
/>
急减速
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"0022"
onclick=
"eventSelect(this)"
/>
急转弯
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"0023"
onclick=
"eventSelect(this)"
/>
碰撞告警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"0036"
onclick=
"eventSelect(this)"
/>
低档高速报警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"0037"
onclick=
"eventSelect(this)"
/>
高档低速报警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"004A"
onclick=
"eventSelect(this)"
/>
剩余油量异常告警
</label>
...
...
@@ -354,6 +356,14 @@
<option
value=
"2"
>
后10秒的事件采样数据
</option>
</select></span>
</div>
<div
id=
"0023_area"
style=
"display:none;margin-top:10px;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;_background:skyblue;"
>
<h5><b>
碰撞报警:
</b></h5>
<span><label>
历史碰撞总次数:
</label><input
style=
"width:80px;"
id=
"0023_totalCount"
type=
"text"
class=
"form-control"
value=
"5"
></span>
<span><label>
数据属性:
</label><select
style=
"width:200px;"
id=
"0023_dataProperty"
class=
"form-control"
>
<option
value=
"1"
>
前10秒的事件采样数据
</option>
<option
value=
"2"
>
后10秒的事件采样数据
</option>
</select></span>
</div>
<div
id=
"0036_area"
style=
"display:none;margin-top:10px;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;_background:skyblue;"
>
<h5><b>
低档高速报警:
</b></h5>
<span><label>
报警属性:
</label>
...
...
@@ -585,6 +595,9 @@ function getData(){
if
(
$
(
"
#0022
"
).
is
(
'
:checked
'
)){
data
[
"
event
"
][
"
0022
"
]
=
get0022
();
//获取急转弯事件数据
}
if
(
$
(
"
#0023
"
).
is
(
'
:checked
'
)){
data
[
"
event
"
][
"
0023
"
]
=
get0023
();
//获取急转弯事件数据
}
if
(
$
(
"
#0036
"
).
is
(
'
:checked
'
)){
data
[
"
event
"
][
"
0036
"
]
=
get0036
();
//低档高速报警
}
...
...
@@ -642,6 +655,12 @@ function get0022(){ //获取急转弯
data
[
"
dataProperty
"
]
=
$
(
"
#ST_dataProperty
"
).
val
();
return
data
}
function
get0023
(){
data
=
{}
data
[
"
totalCount
"
]
=
$
(
"
#0023_totalCount
"
).
val
();
data
[
"
dataProperty
"
]
=
$
(
"
#0023_dataProperty
"
).
val
();
return
data
}
function
get0036
(){
//低档高速报警
data
=
{};
data
[
"
alarmType
"
]
=
$
(
"
#alarmType_1
"
).
val
();
...
...
@@ -692,6 +711,8 @@ function eventSelect(e){
$
(
"
#0021_area
"
).
css
(
"
display
"
,
"
block
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0022
"
){
$
(
"
#0022_area
"
).
css
(
"
display
"
,
"
block
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0023
"
){
$
(
"
#0023_area
"
).
css
(
"
display
"
,
"
block
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0036
"
){
$
(
"
#0036_area
"
).
css
(
"
display
"
,
"
block
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0037
"
){
...
...
@@ -710,6 +731,8 @@ function eventSelect(e){
$
(
"
#0021_area
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0022
"
){
$
(
"
#0022_area
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0023
"
){
$
(
"
#0023_area
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0036
"
){
$
(
"
#0036_area
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0037
"
){
...
...
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