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
dc0ca6a8
Commit
dc0ca6a8
authored
Apr 29, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
M500 协议,增加了急加速、急减速、急转弯事件
parent
fb0bfbbc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
55 deletions
+77
-55
lib/protocol/appendix/EventClass.py
lib/protocol/appendix/EventClass.py
+5
-5
lib/protocol/report/EventReport_protocol.py
lib/protocol/report/EventReport_protocol.py
+24
-0
templates/protocolTools/report/M_carSimulater_page.html
templates/protocolTools/report/M_carSimulater_page.html
+37
-37
templates/protocolTools/report/event_protocol_page.html
templates/protocolTools/report/event_protocol_page.html
+11
-13
No files found.
lib/protocol/appendix/EventClass.py
View file @
dc0ca6a8
...
@@ -134,11 +134,11 @@ class EventClass(ProtocolBase):
...
@@ -134,11 +134,11 @@ class EventClass(ProtocolBase):
return
data
return
data
# 0020 急加速报警附带信息
# 0020 急加速报警附带信息
def
rapidlyAccelerateExtraInfo
(
self
):
def
rapidlyAccelerateExtraInfo
(
self
,
totalRapidlyAccelerateCount
=
100
,
totalSharpSlowdown
=
200
,
totalSharpTurn
=
50
,
dataProperty
=
2
):
totalRapidlyAccelerateCount
=
100
#急加速总次数
totalRapidlyAccelerateCount
=
totalRapidlyAccelerateCount
#急加速总次数
totalSharpSlowdown
=
200
#急减速总次数
totalSharpSlowdown
=
totalSharpSlowdown
#急减速总次数
totalSharpTurn
=
50
#急转弯总次数
totalSharpTurn
=
totalSharpTurn
#急转弯总次数
dataProperty
=
2
#事件属性,1:表示事件发生时刻,前10秒的事件采样数据;2:表示事件发生时刻,后10秒的事件采样数据;
dataProperty
=
dataProperty
#事件属性,1:表示事件发生时刻,前10秒的事件采样数据;2:表示事件发生时刻,后10秒的事件采样数据;
GPSSampleData
=
self
.
GPSDataFromSeconds
(
10
)
#GPS 采样点 ,N秒内的GPS采样数据,170个字节
GPSSampleData
=
self
.
GPSDataFromSeconds
(
10
)
#GPS 采样点 ,N秒内的GPS采样数据,170个字节
CANSampleData
=
self
.
CANDataFromSeconds
(
10
)
#CAN采样点 ,N秒内的CAN采样数据,90个字节
CANSampleData
=
self
.
CANDataFromSeconds
(
10
)
#CAN采样点 ,N秒内的CAN采样数据,90个字节
SENSORSampleData
=
self
.
SENSORDataFromSeconds
(
20
)
#SENSOR采样点 ,N秒内的SENSOR采样数据
SENSORSampleData
=
self
.
SENSORDataFromSeconds
(
20
)
#SENSOR采样点 ,N秒内的SENSOR采样数据
...
...
lib/protocol/report/EventReport_protocol.py
View file @
dc0ca6a8
...
@@ -236,6 +236,30 @@ class EventReport_protocol(ProtocolBase):
...
@@ -236,6 +236,30 @@ class EventReport_protocol(ProtocolBase):
eventObj
.
setSecurityData
(
self
.
securityPkg
)
eventObj
.
setSecurityData
(
self
.
securityPkg
)
theData
=
eventObj
.
setDownDefencesExtraInfo
()
theData
=
eventObj
.
setDownDefencesExtraInfo
()
data
=
data
+
"0013"
+
self
.
int2hexStringByBytes
(
int
((
len
(
theData
)
/
2
)),
2
)
+
theData
data
=
data
+
"0013"
+
self
.
int2hexStringByBytes
(
int
((
len
(
theData
)
/
2
)),
2
)
+
theData
if
(
"0020"
in
eventData
.
keys
()):
#急加速
eventObj
=
EventClass
()
eventObj
.
setGPSpkg
(
self
.
GPSPkg
)
eventObj
.
setSecurityData
(
self
.
securityPkg
)
theData
=
eventObj
.
rapidlyAccelerateExtraInfo
(
int
(
eventData
[
"0020"
][
"allRapidlyAccelerateCount"
]),
int
(
eventData
[
"0020"
][
"allSharpSlowdownCount"
]),
int
(
eventData
[
"0020"
][
"allSharpTurn"
]),
int
(
eventData
[
"0020"
][
"dataProperty"
]))
data
=
data
+
"0020"
+
self
.
int2hexStringByBytes
(
int
((
len
(
theData
)
/
2
)),
2
)
+
theData
if
(
"0021"
in
eventData
.
keys
()):
#急减速
eventObj
=
EventClass
()
eventObj
.
setGPSpkg
(
self
.
GPSPkg
)
eventObj
.
setSecurityData
(
self
.
securityPkg
)
theData
=
eventObj
.
rapidlyAccelerateExtraInfo
(
int
(
eventData
[
"0021"
][
"allRapidlyAccelerateCount"
]),
int
(
eventData
[
"0021"
][
"allSharpSlowdownCount"
]),
int
(
eventData
[
"0021"
][
"allSharpTurn"
]),
int
(
eventData
[
"0021"
][
"dataProperty"
]))
data
=
data
+
"0020"
+
self
.
int2hexStringByBytes
(
int
((
len
(
theData
)
/
2
)),
2
)
+
theData
if
(
"0022"
in
eventData
.
keys
()):
#急转弯
eventObj
=
EventClass
()
eventObj
.
setGPSpkg
(
self
.
GPSPkg
)
eventObj
.
setSecurityData
(
self
.
securityPkg
)
theData
=
eventObj
.
rapidlyAccelerateExtraInfo
(
int
(
eventData
[
"0022"
][
"allRapidlyAccelerateCount"
]),
int
(
eventData
[
"0022"
][
"allSharpSlowdownCount"
]),
int
(
eventData
[
"0022"
][
"allSharpTurn"
]),
int
(
eventData
[
"0022"
][
"dataProperty"
]))
data
=
data
+
"0020"
+
self
.
int2hexStringByBytes
(
int
((
len
(
theData
)
/
2
)),
2
)
+
theData
if
(
"0036"
in
eventData
.
keys
()):
#低档高速报警
if
(
"0036"
in
eventData
.
keys
()):
#低档高速报警
eventObj
=
EventClass
()
eventObj
=
EventClass
()
theData
=
eventObj
.
lowGearHighSpeedAlarm
(
int
(
eventData
[
"0036"
][
"alarmType"
]),
int
(
eventData
[
"0036"
][
"durationTime"
]))
theData
=
eventObj
.
lowGearHighSpeedAlarm
(
int
(
eventData
[
"0036"
][
"alarmType"
]),
int
(
eventData
[
"0036"
][
"durationTime"
]))
...
...
templates/protocolTools/report/M_carSimulater_page.html
View file @
dc0ca6a8
...
@@ -115,43 +115,43 @@
...
@@ -115,43 +115,43 @@
<span
style=
"margin-left:20px;"
><label>
当前状态:
</label><input
id=
"curStatus"
value=
"断网"
disabled=
"disabled"
class=
"form-control"
style=
"font-weight: bold;width:85px;color:red;border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px;"
></span>
<span
style=
"margin-left:20px;"
><label>
当前状态:
</label><input
id=
"curStatus"
value=
"断网"
disabled=
"disabled"
class=
"form-control"
style=
"font-weight: bold;width:85px;color:red;border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px;"
></span>
<span
style=
"width:80px;padding-left:10px;"
><label
style=
"width:70px"
><input
type=
"checkbox"
id=
"ignition"
onclick=
"isLogShow(this)"
/>
隐藏日志
</label>
</span>
<span
style=
"width:80px;padding-left:10px;"
><label
style=
"width:70px"
><input
type=
"checkbox"
id=
"ignition"
onclick=
"isLogShow(this)"
/>
隐藏日志
</label>
</span>
</div>
</div>
<!--<div style="display: block; width: 100%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;"
>
<!-- <div style="display: block; width: 100%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;">--
>
<h5><b>事件发送:</b
>
<!-- <h5><b>事件发送:</b>--
>
<span style="border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:1px 10px;"
>
<!-- <span style="border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:1px 10px;">--
>
<label><input name="eventshow" type="radio" value="0" checked="checked" onclick="isShowEventArea(this)"/>隐藏</label
>
<!-- <label><input name="eventshow" type="radio" value="0" checked="checked" onclick="isShowEventArea(this)"/>隐藏</label>--
>
<label style="margin-left:10px;"><input name="eventshow" type="radio" value="1" onclick="isShowEventArea(this)"/>显示</label
>
<!-- <label style="margin-left:10px;"><input name="eventshow" type="radio" value="1" onclick="isShowEventArea(this)"/>显示</label>--
>
</span
>
<!-- </span>--
>
</h5
>
<!-- </h5>--
>
<div id="event_area" style="display:none;"
>
<!-- <div id="event_area" style="display:none;">--
>
<div style="margin-top:10px;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;background:skyblue;"
>
<!-- <div style="margin-top:10px;width:100%;border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:2px;background:skyblue;">--
>
<label style="padding: 0px 10px;"><input type="checkbox" id="rapidlyAccelerateEvent_check" onclick="eventSelect(this)"/>急加速 </label
>
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="rapidlyAccelerateEvent_check" onclick="eventSelect(this)"/>急加速 </label>--
>
<label style="padding: 0px 10px;"><input type="checkbox" id="bbb" onclick="eventSelect(this)"/>急减速 </label
>
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="bbb" onclick="eventSelect(this)"/>急减速 </label>--
>
<label style="padding: 0px 10px;"><input type="checkbox" id="ccc" onclick="eventSelect(this)"/>急转弯 </label
>
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="ccc" onclick="eventSelect(this)"/>急转弯 </label>--
>
<label style="padding: 0px 10px;"><input type="checkbox" id="0003" onclick="eventSelect(this)"/>汽车电瓶低电压报警 </label
>
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0003" onclick="eventSelect(this)"/>汽车电瓶低电压报警 </label>--
>
<label style="padding: 0px 10px;"><input type="checkbox" id="0004" onclick="eventSelect(this)"/>终端主电断电报警 </label
>
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0004" onclick="eventSelect(this)"/>终端主电断电报警 </label>--
>
<label style="padding: 0px 10px;"><input type="checkbox" id="0012" onclick="eventSelect(this)"/>设防 </label
>
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0012" onclick="eventSelect(this)"/>设防 </label>--
>
<label style="padding: 0px 10px;"><input type="checkbox" id="0013" onclick="eventSelect(this)"/>撤防 </label
>
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0013" 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="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="0037" onclick="eventSelect(this)"/>高档低速报警 </label>--
>
<label style="padding: 0px 10px;"><input type="checkbox" id="004A" onclick="eventSelect(this)"/>剩余油量异常告警 </label
>
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="004A" onclick="eventSelect(this)"/>剩余油量异常告警 </label>--
>
</div
>
<!-- </div>--
>
<div style="padding:10px;"
>
<!-- <div style="padding:10px;">--
>
<span id="rapidlyAccelerateEvent_button" style="display:none;"><button id="a" type="button" class="btn btn-primary" onclick="sendRapidlyAccelerateEvent(this)">急加速</button></label></span
>
<!-- <span id="rapidlyAccelerateEvent_button" style="display:none;"><button id="a" type="button" class="btn btn-primary" onclick="sendRapidlyAccelerateEvent(this)">急加速</button></label></span>--
>
<span><label>在线人数:</label><input disabled=disabled type="text" id="b" class="form-control" style="display:inline;width:80px;" value="1"/></span
>
<!-- <span><label>在线人数:</label><input disabled=disabled type="text" id="b" class="form-control" style="display:inline;width:80px;" value="1"/></span>--
>
</div
>
<!-- </div>--
>
</div
>
<!-- </div>--
>
</div
>
<!-- </div>--
>
<div style="display: block; width: 100%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;"
>
<!-- <div style="display: block; width: 100%; border-width: 1px; border-style: solid; border-color: darkgray; border-radius: 10px; padding: 2px; margin-top: 5px;">--
>
<h5><b>实时控制:</b
>
<!-- <h5><b>实时控制:</b>--
>
<span style="border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:1px 10px;"
>
<!-- <span style="border-width:1px;border-style:solid;border-color:darkgray;border-radius:10px;padding:1px 10px;">--
>
<label><input name="realtime" type="radio" value="0" checked="checked" onclick="isShowRealTimeCtrArea(this)"/>隐藏</label
>
<!-- <label><input name="realtime" type="radio" value="0" checked="checked" onclick="isShowRealTimeCtrArea(this)"/>隐藏</label>--
>
<label style="margin-left:10px;"><input name="realtime" type="radio" value="1" onclick="isShowRealTimeCtrArea(this)"/>显示</label
>
<!-- <label style="margin-left:10px;"><input name="realtime" type="radio" value="1" onclick="isShowRealTimeCtrArea(this)"/>显示</label>--
>
</span
>
<!-- </span>--
>
</h5
>
<!-- </h5>--
>
<div id="realTimeCtl_area" style="display:none;"
>
<!-- <div id="realTimeCtl_area" style="display:none;">--
>
实时控制
<!-- 实时控制-->
</div
>
<!-- </div>--
>
</div>
-->
<!-- </div>
-->
<div
style=
"width:100%;padding-bottom:60px;border-bottom: 1px solid #eee;"
>
<div
style=
"width:100%;padding-bottom:60px;border-bottom: 1px solid #eee;"
>
<h3>
日志:
</h3>
<h3>
日志:
</h3>
<textarea
id=
"showFeedback"
style=
"width:100%;padding:5px;padding-bottom:60px;"
rows=
"10"
></textarea>
<textarea
id=
"showFeedback"
style=
"width:100%;padding:5px;padding-bottom:60px;"
rows=
"10"
></textarea>
...
...
templates/protocolTools/report/event_protocol_page.html
View file @
dc0ca6a8
...
@@ -300,9 +300,9 @@
...
@@ -300,9 +300,9 @@
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"0012"
onclick=
"eventSelect(this)"
/>
设防
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"0012"
onclick=
"eventSelect(this)"
/>
设防
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"0013"
onclick=
"eventSelect(this)"
/>
撤防
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"0013"
onclick=
"eventSelect(this)"
/>
撤防
</label>
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0020" onclick="eventSelect(this)"/>急加速 </label>--
>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"0020"
onclick=
"eventSelect(this)"
/>
急加速
</label
>
<!-- <label style="padding: 0px 10px;"><input type="checkbox" id="0021" onclick="eventSelect(this)"/>急减速 </label>--
>
<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=
"0022"
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=
"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=
"0037"
onclick=
"eventSelect(this)"
/>
高档低速报警
</label>
...
@@ -569,7 +569,6 @@ function getData(){
...
@@ -569,7 +569,6 @@ function getData(){
if
(
$
(
"
#0013
"
).
is
(
'
:checked
'
)){
if
(
$
(
"
#0013
"
).
is
(
'
:checked
'
)){
data
[
"
event
"
][
"
0013
"
]
=
get0013
();
//获取撤防事件数据
data
[
"
event
"
][
"
0013
"
]
=
get0013
();
//获取撤防事件数据
}
}
if
(
$
(
"
#0020
"
).
is
(
'
:checked
'
)){
if
(
$
(
"
#0020
"
).
is
(
'
:checked
'
)){
data
[
"
event
"
][
"
0020
"
]
=
get0020
();
//获取急加速事件数据
data
[
"
event
"
][
"
0020
"
]
=
get0020
();
//获取急加速事件数据
}
}
...
@@ -579,7 +578,6 @@ function getData(){
...
@@ -579,7 +578,6 @@ function getData(){
if
(
$
(
"
#0022
"
).
is
(
'
:checked
'
)){
if
(
$
(
"
#0022
"
).
is
(
'
:checked
'
)){
data
[
"
event
"
][
"
0022
"
]
=
get0022
();
//获取急转弯事件数据
data
[
"
event
"
][
"
0022
"
]
=
get0022
();
//获取急转弯事件数据
}
}
if
(
$
(
"
#0036
"
).
is
(
'
:checked
'
)){
if
(
$
(
"
#0036
"
).
is
(
'
:checked
'
)){
data
[
"
event
"
][
"
0036
"
]
=
get0036
();
//低档高速报警
data
[
"
event
"
][
"
0036
"
]
=
get0036
();
//低档高速报警
}
}
...
@@ -622,18 +620,18 @@ function get0020(){ //获取急加速
...
@@ -622,18 +620,18 @@ function get0020(){ //获取急加速
}
}
function
get0021
(){
//获取急减速事件数据
function
get0021
(){
//获取急减速事件数据
data
=
{}
data
=
{}
data
[
"
allRapidlyAccelerateCount
"
]
=
$
(
"
#
RA
_allRapidlyAccelerateCount
"
).
val
();
data
[
"
allRapidlyAccelerateCount
"
]
=
$
(
"
#
SS
_allRapidlyAccelerateCount
"
).
val
();
data
[
"
allSharpSlowdownCount
"
]
=
$
(
"
#
RA
_allSharpSlowdownCount
"
).
val
();
data
[
"
allSharpSlowdownCount
"
]
=
$
(
"
#
SS
_allSharpSlowdownCount
"
).
val
();
data
[
"
allSharpTurn
"
]
=
$
(
"
#
RA
_allSharpTurn
"
).
val
();
data
[
"
allSharpTurn
"
]
=
$
(
"
#
SS
_allSharpTurn
"
).
val
();
data
[
"
dataProperty
"
]
=
$
(
"
#
RA
_dataProperty
"
).
val
();
data
[
"
dataProperty
"
]
=
$
(
"
#
SS
_dataProperty
"
).
val
();
return
data
return
data
}
}
function
get0022
(){
//获取急转弯事件数据
function
get0022
(){
//获取急转弯事件数据
data
=
{}
data
=
{}
data
[
"
allRapidlyAccelerateCount
"
]
=
$
(
"
#
RA
_allRapidlyAccelerateCount
"
).
val
();
data
[
"
allRapidlyAccelerateCount
"
]
=
$
(
"
#
ST
_allRapidlyAccelerateCount
"
).
val
();
data
[
"
allSharpSlowdownCount
"
]
=
$
(
"
#
RA
_allSharpSlowdownCount
"
).
val
();
data
[
"
allSharpSlowdownCount
"
]
=
$
(
"
#
ST
_allSharpSlowdownCount
"
).
val
();
data
[
"
allSharpTurn
"
]
=
$
(
"
#
RA
_allSharpTurn
"
).
val
();
data
[
"
allSharpTurn
"
]
=
$
(
"
#
ST
_allSharpTurn
"
).
val
();
data
[
"
dataProperty
"
]
=
$
(
"
#
RA
_dataProperty
"
).
val
();
data
[
"
dataProperty
"
]
=
$
(
"
#
ST
_dataProperty
"
).
val
();
return
data
return
data
}
}
function
get0036
(){
//低档高速报警
function
get0036
(){
//低档高速报警
...
...
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