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
7abfb059
Commit
7abfb059
authored
Jun 10, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
M500模拟器增加了超速报警和疲劳驾驶报警功能
parent
d698737c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
177 additions
and
2 deletions
+177
-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/report/EventReport_protocol.py
lib/protocol/report/EventReport_protocol.py
+10
-0
templates/protocolTools/report/M_carSimulater_page.html
templates/protocolTools/report/M_carSimulater_page.html
+27
-0
templates/protocolTools/report/event_protocol_page.html
templates/protocolTools/report/event_protocol_page.html
+44
-0
views/protocolTools/M_carSimulater_process.py
views/protocolTools/M_carSimulater_process.py
+94
-0
No files found.
data/messageTools/carData/012201500010.json
View file @
7abfb059
{
"time"
:
{
"dateTime"
:
"2020-06-04 15:11:26"
,
"date"
:
"2020-06-04"
,
"time"
:
"15:11:26"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
8523
,
"todayTotalOil"
:
778
,
"todayTotalTime"
:
598
,
"theMilleage"
:
747
,
"theOil"
:
62
,
"theTime"
:
78
},
"travelData"
:
{
"totalMilleage"
:
33624
,
"totalOil"
:
3097
,
"totalTime"
:
2106
}}
{
"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
\ No newline at end of file
data/protocolTools/carData/M202003060520.json
View file @
7abfb059
{
"time"
:
{
"dateTime"
:
"2020-06-04 16:26:36"
,
"date"
:
"2020-06-04"
,
"time"
:
"16:26:36"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
332
,
"todayTotalOil"
:
32
,
"todayTotalTime"
:
20
,
"theMilleage"
:
332
,
"theOil"
:
32
,
"theTime"
:
20
},
"travelData"
:
{
"totalMilleage"
:
344779
,
"totalOil"
:
32374
,
"totalTime"
:
20483
},
"event"
:
{
"threeRapid"
:
{
"totalRapidlyAccelerate"
:
19
,
"totalSharpSlowdown"
:
18
,
"totalSharpTurn"
:
17
}}}
{
"time"
:
{
"dateTime"
:
"2020-06-09 15:05:39"
,
"date"
:
"2020-06-09"
,
"time"
:
"15:05:39"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
20477
,
"todayTotalOil"
:
1862
,
"todayTotalTime"
:
1241
,
"theMilleage"
:
14223
,
"theOil"
:
1293
,
"theTime"
:
862
},
"travelData"
:
{
"totalMilleage"
:
366916
,
"totalOil"
:
34396
,
"totalTime"
:
21824
},
"event"
:
{
"threeRapid"
:
{
"totalRapidlyAccelerate"
:
21
,
"totalSharpSlowdown"
:
19
,
"totalSharpTurn"
:
19
}}}
\ No newline at end of file
\ No newline at end of file
lib/protocol/report/EventReport_protocol.py
View file @
7abfb059
...
@@ -293,6 +293,16 @@ class EventReport_protocol(ProtocolBase):
...
@@ -293,6 +293,16 @@ class EventReport_protocol(ProtocolBase):
theData
=
eventObj
.
collisionAlarmExtraInfo
(
int
(
eventData
[
"0023"
][
"totalCount"
]),
theData
=
eventObj
.
collisionAlarmExtraInfo
(
int
(
eventData
[
"0023"
][
"totalCount"
]),
int
(
eventData
[
"0023"
][
"dataProperty"
]),)
int
(
eventData
[
"0023"
][
"dataProperty"
]),)
data
=
data
+
"0023"
+
self
.
int2hexStringByBytes
(
int
((
len
(
theData
)
/
2
)),
2
)
+
theData
data
=
data
+
"0023"
+
self
.
int2hexStringByBytes
(
int
((
len
(
theData
)
/
2
)),
2
)
+
theData
if
(
"0027"
in
eventData
.
keys
()):
#超速告警
eventObj
=
EventClass
()
theData
=
eventObj
.
overSpeedAlarm
(
int
(
eventData
[
"0027"
][
"alarmType"
]),
int
(
eventData
[
"0027"
][
"durTime"
]))
data
=
data
+
"0027"
+
self
.
int2hexStringByBytes
(
int
((
len
(
theData
)
/
2
)),
2
)
+
theData
if
(
"0028"
in
eventData
.
keys
()):
#疲劳驾驶告警
eventObj
=
EventClass
()
theData
=
eventObj
.
collisionAlarmExtraInfo
(
int
(
eventData
[
"0028"
][
"alarmType"
]),
int
(
eventData
[
"0028"
][
"durTime"
]),)
data
=
data
+
"0028"
+
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 @
7abfb059
...
@@ -27,6 +27,9 @@
...
@@ -27,6 +27,9 @@
width
:
90px
;
width
:
90px
;
text-align
:
right
;
text-align
:
right
;
}
}
button
.btn.btn-primary
{
margin-bottom
:
2px
;
}
</style>
</style>
<div
id=
"container2"
style=
"width:83%;min-height:750px;float:left;_background:grey;margin-top:50px;"
>
<div
id=
"container2"
style=
"width:83%;min-height:750px;float:left;_background:grey;margin-top:50px;"
>
{% block content_02 %}
{% block content_02 %}
...
@@ -136,6 +139,8 @@
...
@@ -136,6 +139,8 @@
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"lowGearHighSpeed_check"
onclick=
"eventSelect(this)"
checked
/>
低档高速报警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"lowGearHighSpeed_check"
onclick=
"eventSelect(this)"
checked
/>
低档高速报警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"highGearLowSpeed_check"
onclick=
"eventSelect(this)"
checked
/>
高档低速报警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"highGearLowSpeed_check"
onclick=
"eventSelect(this)"
checked
/>
高档低速报警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"surplusOil_check"
onclick=
"eventSelect(this)"
checked
/>
剩余油量异常告警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"surplusOil_check"
onclick=
"eventSelect(this)"
checked
/>
剩余油量异常告警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"overSpeed_check"
onclick=
"eventSelect(this)"
checked
/>
超速报警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"tiredDriving_check"
onclick=
"eventSelect(this)"
checked
/>
疲劳驾驶
</label>
</div>
</div>
<div
style=
"padding:10px;"
>
<div
style=
"padding:10px;"
>
<span
id=
"insertAlarm_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendInsertAlarmEvent(this)"
>
终端插入报警
</button></label></span>
<span
id=
"insertAlarm_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendInsertAlarmEvent(this)"
>
终端插入报警
</button></label></span>
...
@@ -150,6 +155,8 @@
...
@@ -150,6 +155,8 @@
<span
id=
"lowGearHighSpeed_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendLowGearHighSpeedEvent(this)"
>
低挡高速
</button></label></span>
<span
id=
"lowGearHighSpeed_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendLowGearHighSpeedEvent(this)"
>
低挡高速
</button></label></span>
<span
id=
"highGearLowSpeed_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendHighGearLowSpeedEvent(this)"
>
高档低速
</button></label></span>
<span
id=
"highGearLowSpeed_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendHighGearLowSpeedEvent(this)"
>
高档低速
</button></label></span>
<span
id=
"surplusOil_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendSurplusOilAlarmEvent(this)"
>
剩余油量异常
</button></label></span>
<span
id=
"surplusOil_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendSurplusOilAlarmEvent(this)"
>
剩余油量异常
</button></label></span>
<span
id=
"overSpeed_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendOverSpeedEvent(this)"
>
超速报警
</button></label></span>
<span
id=
"tiredDriving_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendTiredDrivingAlarmEvent(this)"
>
疲劳驾驶
</button></label></span>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -671,6 +678,10 @@ function eventSelect(e){
...
@@ -671,6 +678,10 @@ function eventSelect(e){
$
(
"
#highGearLowSpeed_button
"
).
css
(
"
display
"
,
"
inline
"
)
$
(
"
#highGearLowSpeed_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
surplusOil_check
"
){
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
surplusOil_check
"
){
$
(
"
#surplusOil_button
"
).
css
(
"
display
"
,
"
inline
"
)
$
(
"
#surplusOil_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
overSpeed_check
"
){
$
(
"
#overSpeed_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
tiredDriving_check
"
){
$
(
"
#tiredDriving_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
}
}
else
{
}
else
{
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
insertAlarm_check
"
){
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
insertAlarm_check
"
){
...
@@ -697,6 +708,10 @@ function eventSelect(e){
...
@@ -697,6 +708,10 @@ function eventSelect(e){
$
(
"
#highGearLowSpeed_button
"
).
css
(
"
display
"
,
"
none
"
)
$
(
"
#highGearLowSpeed_button
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
surplusOil_check
"
){
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
surplusOil_check
"
){
$
(
"
#surplusOil_button
"
).
css
(
"
display
"
,
"
none
"
)
$
(
"
#surplusOil_button
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
overSpeed_check
"
){
$
(
"
#overSpeed_button
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
tiredDriving_check
"
){
$
(
"
#tiredDriving_button
"
).
css
(
"
display
"
,
"
none
"
)
}
}
}
}
}
}
...
@@ -772,6 +787,18 @@ function sendSurplusOilAlarmEvent(){
...
@@ -772,6 +787,18 @@ function sendSurplusOilAlarmEvent(){
url
=
"
/protocolTools/M_carSimulater_process/sendSurplusOilAlarmEvent
"
;
url
=
"
/protocolTools/M_carSimulater_process/sendSurplusOilAlarmEvent
"
;
sendjson
(
data
,
url
);
sendjson
(
data
,
url
);
}
}
//发送超速告警事件消息
function
sendOverSpeedEvent
(){
var
data
=
getPageData
()
url
=
"
/protocolTools/M_carSimulater_process/sendOverSpeedAlarmEvent
"
;
sendjson
(
data
,
url
);
}
//发送疲劳驾驶告警事件消息
function
sendTiredDrivingAlarmEvent
(){
var
data
=
getPageData
()
url
=
"
/protocolTools/M_carSimulater_process/sendTiredDrivingAlarmEvent
"
;
sendjson
(
data
,
url
);
}
// -------------------------------- 实时控制js代码-------------------------------------------
// -------------------------------- 实时控制js代码-------------------------------------------
//设置隐藏或显示实时控制区域
//设置隐藏或显示实时控制区域
...
...
templates/protocolTools/report/event_protocol_page.html
View file @
7abfb059
...
@@ -306,6 +306,8 @@
...
@@ -306,6 +306,8 @@
<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=
"0023"
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=
"0027"
onclick=
"eventSelect(this)"
/>
超速告警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"0028"
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>
...
@@ -369,6 +371,22 @@
...
@@ -369,6 +371,22 @@
<option
value=
"2"
>
后10秒的事件采样数据
</option>
<option
value=
"2"
>
后10秒的事件采样数据
</option>
</select></span>
</select></span>
</div>
</div>
<div
id=
"0027_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><select
style=
"width:200px;"
id=
"0027_alarmType"
class=
"form-control"
>
<option
value=
"1"
>
报警触发
</option>
<option
value=
"0"
>
报警解除
</option>
</select></span>
<span><label>
超速持续时间(秒):
</label><input
style=
"width:80px;"
id=
"0027_durTime"
type=
"text"
class=
"form-control"
value=
"360"
></span>
</div>
<div
id=
"0028_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><select
style=
"width:200px;"
id=
"0028_alarmType"
class=
"form-control"
>
<option
value=
"1"
>
报警触发
</option>
<option
value=
"0"
>
报警解除
</option>
</select></span>
<span><label>
累计驾驶时间(秒):
</label><input
style=
"width:80px;"
id=
"0028_durTime"
type=
"text"
class=
"form-control"
value=
"11000"
></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;"
>
<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>
<h5><b>
低档高速报警:
</b></h5>
<span><label>
报警属性:
</label>
<span><label>
报警属性:
</label>
...
@@ -606,6 +624,12 @@ function getData(){
...
@@ -606,6 +624,12 @@ function getData(){
if
(
$
(
"
#0023
"
).
is
(
'
:checked
'
)){
if
(
$
(
"
#0023
"
).
is
(
'
:checked
'
)){
data
[
"
event
"
][
"
0023
"
]
=
get0023
();
//获取急转弯事件数据
data
[
"
event
"
][
"
0023
"
]
=
get0023
();
//获取急转弯事件数据
}
}
if
(
$
(
"
#0027
"
).
is
(
'
:checked
'
)){
data
[
"
event
"
][
"
0027
"
]
=
get0027
();
//获取超速报警事件数据
}
if
(
$
(
"
#0028
"
).
is
(
'
:checked
'
)){
data
[
"
event
"
][
"
0028
"
]
=
get0028
();
//获取疲劳驾驶事件数据
}
if
(
$
(
"
#0036
"
).
is
(
'
:checked
'
)){
if
(
$
(
"
#0036
"
).
is
(
'
:checked
'
)){
data
[
"
event
"
][
"
0036
"
]
=
get0036
();
//低档高速报警
data
[
"
event
"
][
"
0036
"
]
=
get0036
();
//低档高速报警
}
}
...
@@ -674,6 +698,18 @@ function get0023(){
...
@@ -674,6 +698,18 @@ function get0023(){
data
[
"
dataProperty
"
]
=
$
(
"
#0023_dataProperty
"
).
val
();
data
[
"
dataProperty
"
]
=
$
(
"
#0023_dataProperty
"
).
val
();
return
data
return
data
}
}
function
get0027
(){
data
=
{}
data
[
"
alarmType
"
]
=
$
(
"
#0027_alarmType
"
).
val
();
data
[
"
durTime
"
]
=
$
(
"
#0027_durTime
"
).
val
();
return
data
}
function
get0028
(){
data
=
{}
data
[
"
alarmType
"
]
=
$
(
"
#0028_alarmType
"
).
val
();
data
[
"
durTime
"
]
=
$
(
"
#0028_durTime
"
).
val
();
return
data
}
function
get0036
(){
//低档高速报警
function
get0036
(){
//低档高速报警
data
=
{};
data
=
{};
data
[
"
alarmType
"
]
=
$
(
"
#alarmType_1
"
).
val
();
data
[
"
alarmType
"
]
=
$
(
"
#alarmType_1
"
).
val
();
...
@@ -728,6 +764,10 @@ function eventSelect(e){
...
@@ -728,6 +764,10 @@ function eventSelect(e){
$
(
"
#0022_area
"
).
css
(
"
display
"
,
"
block
"
)
$
(
"
#0022_area
"
).
css
(
"
display
"
,
"
block
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0023
"
){
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0023
"
){
$
(
"
#0023_area
"
).
css
(
"
display
"
,
"
block
"
)
$
(
"
#0023_area
"
).
css
(
"
display
"
,
"
block
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0027
"
){
$
(
"
#0027_area
"
).
css
(
"
display
"
,
"
block
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0028
"
){
$
(
"
#0028_area
"
).
css
(
"
display
"
,
"
block
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0036
"
){
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0036
"
){
$
(
"
#0036_area
"
).
css
(
"
display
"
,
"
block
"
)
$
(
"
#0036_area
"
).
css
(
"
display
"
,
"
block
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0037
"
){
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0037
"
){
...
@@ -750,6 +790,10 @@ function eventSelect(e){
...
@@ -750,6 +790,10 @@ function eventSelect(e){
$
(
"
#0022_area
"
).
css
(
"
display
"
,
"
none
"
)
$
(
"
#0022_area
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0023
"
){
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0023
"
){
$
(
"
#0023_area
"
).
css
(
"
display
"
,
"
none
"
)
$
(
"
#0023_area
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0027
"
){
$
(
"
#0027_area
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0028
"
){
$
(
"
#0028_area
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0036
"
){
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0036
"
){
$
(
"
#0036_area
"
).
css
(
"
display
"
,
"
none
"
)
$
(
"
#0036_area
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0037
"
){
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
0037
"
){
...
...
views/protocolTools/M_carSimulater_process.py
View file @
7abfb059
...
@@ -965,6 +965,100 @@ def sendSurplusOilAlarmEvent():
...
@@ -965,6 +965,100 @@ def sendSurplusOilAlarmEvent():
data
[
"message"
]
=
"Error: 发送剩余油量异常告警事件失败!"
data
[
"message"
]
=
"Error: 发送剩余油量异常告警事件失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
##########################################
# 【接口类型】发送超速报警事件
##########################################
@
M_carSimulater_process
.
route
(
"/sendOverSpeedAlarmEvent"
,
methods
=
[
'POST'
])
def
sendOverSpeedAlarmEvent
():
params
=
request
.
get_data
()
params
=
json
.
loads
(
params
.
decode
(
"utf-8"
))
sessionId
=
params
[
"session"
][
"sessionId"
]
data
=
{}
if
not
sessionId
in
connects
.
keys
():
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 未启动服务,不可发送超速告警事件!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
service
=
connects
[
sessionId
][
"service"
]
travelStatus
=
service
.
getTravelStatus
()
#获取汽车行驶状态
if
travelStatus
==
0
or
travelStatus
==
2
:
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 汽车还未行驶,不可发送超速告警事件!"
elif
travelStatus
==
1
:
try
:
jdata
=
{
"WATER_CODE"
:
"0003"
,
"DEV_ID"
:
"M121501010001"
,
"gpsInfo"
:
{
"UTCTime"
:
"2020-04-30 14:59:33"
,
"latitude"
:
"40.22077"
,
"longitude"
:
"116.23128"
,
"speed"
:
"80.8"
,
"directionAngle"
:
"80.8"
,
"elevation"
:
"2999.9"
,
"positionStar"
:
"3"
,
"Pdop"
:
"0.3"
,
"Hdop"
:
"0.4"
,
"Vdop"
:
"0.5"
,
"statusBit"
:
162
,
"valtage"
:
"36.9"
,
"OBDSpeed"
:
"60.9"
,
"engineSpeed"
:
"3000"
,
"GPSTotalMileage"
:
"12800"
,
"totalOil"
:
"100000"
,
"totalTime"
:
"2020002"
,
"GPSTimestamp"
:
"1588229973"
},
"securityData"
:
{
"securityStatus"
:
107
,
"doorStatus"
:
0
,
"lockStatus"
:
0
,
"windowStatus"
:
0
,
"lightStatus"
:
0
,
"onoffStatusA"
:
0
,
"onoffStatusB"
:
112
,
"dataByte"
:
249
},
"event"
:
{
"0027"
:
{
"alarmType"
:
"1"
,
"durTime"
:
"360"
}}}
jdata
[
"DEV_ID"
]
=
params
[
"carId"
]
obj
=
EventReport_protocol
(
data
=
jdata
)
gpsData
=
service
.
genGPSData2
()
obj
.
setGPSPkg
(
gpsData
)
obj
.
setEventType
(
"004A"
)
msg
=
obj
.
generateEventMsg
()
service
.
serviceSendMsg
(
msg
,
"超速告警事件"
)
service
.
setSn
(
service
.
getSn
()
+
1
)
data
[
"status"
]
=
"200"
data
[
"message"
]
=
"发送超速告警事件成功!"
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 发送超速告警事件失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
##########################################
# 【接口类型】发送疲劳驾驶报警事件
##########################################
@
M_carSimulater_process
.
route
(
"/sendTiredDrivingAlarmEvent"
,
methods
=
[
'POST'
])
def
sendTiredDrivingAlarmEvent
():
params
=
request
.
get_data
()
params
=
json
.
loads
(
params
.
decode
(
"utf-8"
))
sessionId
=
params
[
"session"
][
"sessionId"
]
data
=
{}
if
not
sessionId
in
connects
.
keys
():
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 未启动服务,不可发送疲劳驾驶告警事件!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
service
=
connects
[
sessionId
][
"service"
]
travelStatus
=
service
.
getTravelStatus
()
#获取汽车行驶状态
if
travelStatus
==
0
or
travelStatus
==
2
:
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 汽车还未行驶,不可发送疲劳驾驶告警事件!"
elif
travelStatus
==
1
:
try
:
jdata
=
{
"WATER_CODE"
:
"0003"
,
"DEV_ID"
:
"M121501010001"
,
"gpsInfo"
:
{
"UTCTime"
:
"2020-04-30 14:59:33"
,
"latitude"
:
"40.22077"
,
"longitude"
:
"116.23128"
,
"speed"
:
"80.8"
,
"directionAngle"
:
"80.8"
,
"elevation"
:
"2999.9"
,
"positionStar"
:
"3"
,
"Pdop"
:
"0.3"
,
"Hdop"
:
"0.4"
,
"Vdop"
:
"0.5"
,
"statusBit"
:
162
,
"valtage"
:
"36.9"
,
"OBDSpeed"
:
"60.9"
,
"engineSpeed"
:
"3000"
,
"GPSTotalMileage"
:
"12800"
,
"totalOil"
:
"100000"
,
"totalTime"
:
"2020002"
,
"GPSTimestamp"
:
"1588229973"
},
"securityData"
:
{
"securityStatus"
:
107
,
"doorStatus"
:
0
,
"lockStatus"
:
0
,
"windowStatus"
:
0
,
"lightStatus"
:
0
,
"onoffStatusA"
:
0
,
"onoffStatusB"
:
112
,
"dataByte"
:
249
},
"event"
:
{
"0028"
:
{
"alarmType"
:
"1"
,
"durTime"
:
"1100"
}}}
jdata
[
"DEV_ID"
]
=
params
[
"carId"
]
obj
=
EventReport_protocol
(
data
=
jdata
)
gpsData
=
service
.
genGPSData2
()
obj
.
setGPSPkg
(
gpsData
)
obj
.
setEventType
(
"004A"
)
msg
=
obj
.
generateEventMsg
()
service
.
serviceSendMsg
(
msg
,
"疲劳驾驶告警事件"
)
service
.
setSn
(
service
.
getSn
()
+
1
)
data
[
"status"
]
=
"200"
data
[
"message"
]
=
"发送疲劳驾驶告警事件成功!"
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 发送疲劳驾驶告警事件失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
#--------------------------------------- 实时控制逻辑 ---------------------------------------
#--------------------------------------- 实时控制逻辑 ---------------------------------------
##########################################
##########################################
# 【接口类型】改变车速
# 【接口类型】改变车速
...
...
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