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
cc33f022
Commit
cc33f022
authored
May 13, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模拟器碰撞告警开发完成
parent
7fc2340b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
1 deletion
+60
-1
templates/protocolTools/report/M_carSimulater_page.html
templates/protocolTools/report/M_carSimulater_page.html
+12
-0
views/protocolTools/M_carSimulater_process.py
views/protocolTools/M_carSimulater_process.py
+48
-1
No files found.
templates/protocolTools/report/M_carSimulater_page.html
View file @
cc33f022
...
...
@@ -129,6 +129,7 @@
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"rapidlyAccelerateEvent_check"
onclick=
"eventSelect(this)"
checked
/>
急加速
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"sharpSlowdownEvent_check"
onclick=
"eventSelect(this)"
checked
/>
急减速
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"sharpTurnEvent_check"
onclick=
"eventSelect(this)"
checked
/>
急转弯
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"collisionAlarmEvent_check"
onclick=
"eventSelect(this)"
checked
/>
碰撞报警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"setUpDefencesEvent_check"
onclick=
"eventSelect(this)"
checked
/>
设防
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"setDownDefencesEvent_check"
onclick=
"eventSelect(this)"
checked
/>
撤防
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"lowGearHighSpeed_check"
onclick=
"eventSelect(this)"
checked
/>
低档高速报警
</label>
...
...
@@ -141,6 +142,7 @@
<span
id=
"rapidlyAccelerateEvent_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendRapidlyAccelerateEvent(this)"
>
急加速
</button></label></span>
<span
id=
"sharpSlowdownEvent_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendSharpSlowdownEvent(this)"
>
急减速
</button></label></span>
<span
id=
"sharpTurnEvent_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendSharpTurnEvent(this)"
>
急转弯
</button></label></span>
<span
id=
"collisionAlarmEvent_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendCollisionAlarmEvent(this)"
>
碰撞报警
</button></label></span>
<span
id=
"setUpDefencesEvent_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendSetUpDefencesEvent(this)"
>
设防
</button></label></span>
<span
id=
"setDownDefencesEvent_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendSetDownDefencesEvent(this)"
>
撤防
</button></label></span>
<span
id=
"lowGearHighSpeed_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendLowGearHighSpeedEvent(this)"
>
低挡高速
</button></label></span>
...
...
@@ -654,6 +656,8 @@ function eventSelect(e){
$
(
"
#sharpSlowdownEvent_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
sharpTurnEvent_check
"
){
$
(
"
#sharpTurnEvent_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
collisionAlarmEvent_check
"
){
$
(
"
#collisionAlarmEvent_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
setUpDefencesEvent_check
"
){
$
(
"
#setUpDefencesEvent_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
setDownDefencesEvent_check
"
){
...
...
@@ -676,6 +680,8 @@ function eventSelect(e){
$
(
"
#sharpSlowdownEvent_button
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
sharpTurnEvent_check
"
){
$
(
"
#sharpTurnEvent_button
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
collisionAlarmEvent_check
"
){
$
(
"
#collisionAlarmEvent_button
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
setUpDefencesEvent_check
"
){
$
(
"
#setUpDefencesEvent_button
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
setDownDefencesEvent_check
"
){
...
...
@@ -719,6 +725,12 @@ function sendSharpTurnEvent(){
url
=
"
/protocolTools/M_carSimulater_process/sendSharpTurnEvent
"
;
sendjson
(
data
,
url
);
}
//发送碰撞告警事件
function
sendCollisionAlarmEvent
(){
var
data
=
getPageData
()
url
=
"
/protocolTools/M_carSimulater_process/sendCollisionAlarmEvent
"
;
sendjson
(
data
,
url
);
}
//发送设防事件消息
function
sendSetUpDefencesEvent
(){
var
data
=
getPageData
()
...
...
views/protocolTools/M_carSimulater_process.py
View file @
cc33f022
...
...
@@ -633,7 +633,54 @@ def sendSharpTurnEvent():
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 发送急转弯事件失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
\
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
##########################################
# 【接口类型】发送碰撞告警事件
##########################################
@
M_carSimulater_process
.
route
(
"/sendCollisionAlarmEvent"
,
methods
=
[
'POST'
])
def
sendCollisionAlarmEvent
():
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"
:
{
"0023"
:
{
"totalCount"
:
"5"
,
"dataProperty"
:
"1"
}}}
jdata
[
"DEV_ID"
]
=
params
[
"carId"
]
obj
=
EventReport_protocol
(
data
=
jdata
)
gpsData
=
service
.
genGPSData2
()
obj
.
setGPSPkg
(
gpsData
)
obj
.
setEventType
(
"0023"
)
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