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
2b42d4f3
Commit
2b42d4f3
authored
Oct 16, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车安优图形模拟器增加急左变道和急右变道功能
parent
e1f21335
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
151 additions
and
16 deletions
+151
-16
lib/protocol/message/data/AlarmEvent_data.py
lib/protocol/message/data/AlarmEvent_data.py
+18
-14
templates/messageTools/message/M_simulater_page.html
templates/messageTools/message/M_simulater_page.html
+29
-0
templates/messageTools/message/location_msg_page.html
templates/messageTools/message/location_msg_page.html
+12
-2
templates/otherTools/maptool.html
templates/otherTools/maptool.html
+1
-0
views/messageTools/M_simulater_process.py
views/messageTools/M_simulater_process.py
+91
-0
No files found.
lib/protocol/message/data/AlarmEvent_data.py
View file @
2b42d4f3
...
...
@@ -36,19 +36,20 @@ class AlarmEvent_data(MessageBase):
fatigueDriving
=
"0108"
+
self
.
int2hexStringByBytes
(
5
)
+
self
.
getFatigueDriving
()
#水温报警 附带信息见 表 C6EXT4
waterTemperatureAlarm
=
"0109"
+
self
.
int2hexStringByBytes
(
9
)
+
self
.
getWaterTemperatureAlarm
()
highSpeedNeutralGear
=
"010A"
+
self
.
int2hexStringByBytes
(
0
)
#高速空档滑行报警
oilExpendNotSurport
=
"010B"
+
self
.
int2hexStringByBytes
(
0
)
#油耗不支持报警
OBDNotSurport
=
"010C"
+
self
.
int2hexStringByBytes
(
0
)
#OBD 不支持报警
lowWaterTemperatureHighSpeed
=
"010D"
+
self
.
int2hexStringByBytes
(
0
)
#低水温高转速
buslineNotSleep
=
"010E"
+
self
.
int2hexStringByBytes
(
0
)
#总线不睡眠报警
illegalOpenDoor
=
"010f"
+
self
.
int2hexStringByBytes
(
0
)
#非法开门
illegalFire
=
"0110"
+
self
.
int2hexStringByBytes
(
0
)
#非法点火
rapidAccelerateAlarm
=
"0111"
+
self
.
int2hexStringByBytes
(
0
)
#急加速报警
sharpSlowdownAlarm
=
"0112"
+
self
.
int2hexStringByBytes
(
0
)
#急减速报警
sharpBendAlarm
=
"0113"
+
self
.
int2hexStringByBytes
(
0
)
#急左拐弯报警
crashAlarm
=
"0114"
+
self
.
int2hexStringByBytes
(
0
)
#碰撞报警
rapidChangeLines
=
"0115"
+
self
.
int2hexStringByBytes
(
0
)
#急变道报警
sharpRightBendAlarm
=
"0117"
+
self
.
int2hexStringByBytes
(
0
)
#急右拐弯报警
highSpeedNeutralGear
=
"010A"
+
self
.
int2hexStringByBytes
(
0
)
# 高速空档滑行报警
oilExpendNotSurport
=
"010B"
+
self
.
int2hexStringByBytes
(
0
)
# 油耗不支持报警
OBDNotSurport
=
"010C"
+
self
.
int2hexStringByBytes
(
0
)
# OBD 不支持报警
lowWaterTemperatureHighSpeed
=
"010D"
+
self
.
int2hexStringByBytes
(
0
)
# 低水温高转速
buslineNotSleep
=
"010E"
+
self
.
int2hexStringByBytes
(
0
)
# 总线不睡眠报警
illegalOpenDoor
=
"010f"
+
self
.
int2hexStringByBytes
(
0
)
# 非法开门
illegalFire
=
"0110"
+
self
.
int2hexStringByBytes
(
0
)
# 非法点火
rapidAccelerateAlarm
=
"0111"
+
self
.
int2hexStringByBytes
(
0
)
# 急加速报警
sharpSlowdownAlarm
=
"0112"
+
self
.
int2hexStringByBytes
(
0
)
# 急减速报警
sharpBendAlarm
=
"0113"
+
self
.
int2hexStringByBytes
(
0
)
# 急左拐弯报警
crashAlarm
=
"0114"
+
self
.
int2hexStringByBytes
(
0
)
# 碰撞报警
rapidChangeLines
=
"0115"
+
self
.
int2hexStringByBytes
(
0
)
# 急左变道报警
rapidChangeRightLines
=
"0116"
+
self
.
int2hexStringByBytes
(
0
)
# 急右变道报警
sharpRightBendAlarm
=
"0117"
+
self
.
int2hexStringByBytes
(
0
)
# 急右拐弯报警
data
=
ignition
...
...
@@ -148,7 +149,10 @@ class AlarmEvent_data(MessageBase):
crashAlarm
=
"0114"
+
self
.
int2hexStringByBytes
(
0
)
#碰撞报警
dataHex
=
dataHex
+
crashAlarm
if
(
"rapidChangeLines"
in
data
.
keys
()):
rapidChangeLines
=
"0115"
+
self
.
int2hexStringByBytes
(
0
)
#急变道报警
rapidChangeLines
=
"0115"
+
self
.
int2hexStringByBytes
(
0
)
#急左变道报警
dataHex
=
dataHex
+
rapidChangeLines
if
(
"rapidChangeRightLines"
in
data
.
keys
()):
rapidChangeLines
=
"0116"
+
self
.
int2hexStringByBytes
(
0
)
#急右变道报警
dataHex
=
dataHex
+
rapidChangeLines
if
(
"sharpRightBendAlarm"
in
data
.
keys
()):
sharpBendAlarm
=
"0117"
+
self
.
int2hexStringByBytes
(
0
)
#急右拐弯报警
...
...
templates/messageTools/message/M_simulater_page.html
View file @
2b42d4f3
...
...
@@ -30,6 +30,9 @@
margin-top
:
5px
;
margin-bottom
:
5px
;
}
button
.btn.btn-primary
{
margin-bottom
:
2px
;
}
</style>
<div
id=
"container2"
style=
"width:83%;min-height:750px;float:left;_background:grey;margin-top:50px;"
>
{% block content_02 %}
...
...
@@ -155,6 +158,8 @@
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"waterTemperatureAlarm_check"
onclick=
"eventSelect(this)"
checked
/>
水温报警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"highSpeedNeutralGear_check"
onclick=
"eventSelect(this)"
checked
/>
高速空挡滑行
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"crashAlarm_check"
onclick=
"eventSelect(this)"
checked
/>
碰撞告警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"rapidChangeLeftLines_check"
onclick=
"eventSelect(this)"
checked
/>
急左变道
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"rapidChangeRightLines_check"
onclick=
"eventSelect(this)"
checked
/>
急右变道
</label>
</div>
<div
style=
"padding:10px;"
>
<span
id=
"insertAlarm_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendInsertAlarmEvent(this)"
>
终端插入报警
</button></label></span>
...
...
@@ -171,6 +176,8 @@
<span
id=
"waterTemperatureAlarm_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendWaterTemperatureAlarmEvent(this)"
>
水温报警
</button></label></span>
<span
id=
"highSpeedNeutralGear_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendHighSpeedNeutralGearEvent(this)"
>
高速空挡滑行
</button></label></span>
<span
id=
"crashAlarm_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendCrashAlarmEvent(this)"
>
碰撞告警
</button></label></span>
<span
id=
"rapidChangeLeftLines_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendRapidChangeLeftLinesEvent(this)"
>
急左变道
</button></label></span>
<span
id=
"rapidChangeRightLines_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendRapidChangeRightLinesEvent(this)"
>
急右变道
</button></label></span>
</div>
</div>
</div>
...
...
@@ -801,6 +808,10 @@ function eventSelect(e){
$
(
"
#highSpeedNeutralGear_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
crashAlarm_check
"
){
$
(
"
#crashAlarm_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
rapidChangeLeftLines_check
"
){
$
(
"
#rapidChangeLeftLines_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
rapidChangeRightLines_check
"
){
$
(
"
#rapidChangeRightLines_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
}
else
{
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
insertAlarm_check
"
){
...
...
@@ -835,6 +846,10 @@ function eventSelect(e){
$
(
"
#highSpeedNeutralGear_button
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
crashAlarm_check
"
){
$
(
"
#crashAlarm_button
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
rapidChangeLeftLines_check
"
){
$
(
"
#rapidChangeLeftLines_button
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
rapidChangeRightLines_check
"
){
$
(
"
#rapidChangeRightLines_button
"
).
css
(
"
display
"
,
"
none
"
)
}
}
}
...
...
@@ -938,6 +953,20 @@ function sendCrashAlarmEvent(){
var
url
=
"
http://
"
+
host
+
"
/messageTools/M_simulater_process/sendCrashAlarmEvent
"
;
sendHttpMsg
(
data
,
url
);
}
//发送急左变道告警消息
function
sendRapidChangeLeftLinesEvent
(){
var
data
=
getPageData
();
var
host
=
window
.
location
.
host
;
var
url
=
"
http://
"
+
host
+
"
/messageTools/M_simulater_process/sendapidChangeLeftLines
"
;
sendHttpMsg
(
data
,
url
);
}
//发送急右变道告警消息
function
sendRapidChangeRightLinesEvent
(){
var
data
=
getPageData
();
var
host
=
window
.
location
.
host
;
var
url
=
"
http://
"
+
host
+
"
/messageTools/M_simulater_process/sendapidChangeRightLines
"
;
sendHttpMsg
(
data
,
url
);
}
// -------------------------------- 实时控制js代码-------------------------------------------
//设置隐藏或显示实时控制区域
function
isShowRealTimeCtrArea
(
e
){
...
...
templates/messageTools/message/location_msg_page.html
View file @
2b42d4f3
...
...
@@ -691,9 +691,11 @@
<li
style=
"width:80px;"
><label
style=
"width:70px"
><input
type=
"checkbox"
id=
"illegalFire_AE"
/>
非法点火
</label>
</li>
<li
style=
"width:100px;"
><label
style=
"width:90px"
><input
type=
"checkbox"
id=
"rapidAccelerateAlarm"
/>
急加速报警
</label>
</li>
<li
style=
"width:100px;"
><label
style=
"width:90px"
><input
type=
"checkbox"
id=
"sharpSlowdownAlarm"
/>
急减速报警
</label>
</li>
<li
style=
"width:100px;"
><label
style=
"width:90px"
><input
type=
"checkbox"
id=
"sharpBendAlarm"
/>
急拐弯报警
</label>
</li>
<li
style=
"width:110px;"
><label
style=
"width:100px"
><input
type=
"checkbox"
id=
"sharpBendAlarm"
/>
急左拐弯报警
</label>
</li>
<li
style=
"width:110px;"
><label
style=
"width:100px"
><input
type=
"checkbox"
id=
"sharpRightBendAlarm"
/>
急右拐弯报警
</label>
</li>
<li
style=
"width:80px;"
><label
style=
"width:70px"
><input
type=
"checkbox"
id=
"crashAlarm"
/>
碰撞报警
</label>
</li>
<li
style=
"width:100px;"
><label
style=
"width:90px"
><input
type=
"checkbox"
id=
"rapidChangeLines"
/>
急变道报警
</label>
</li>
<li
style=
"width:110px;"
><label
style=
"width:100px"
><input
type=
"checkbox"
id=
"rapidChangeLines"
/>
急左变道报警
</label>
</li>
<li
style=
"width:110px;"
><label
style=
"width:100px"
><input
type=
"checkbox"
id=
"rapidChangeRightLines"
/>
急右变道报警
</label>
</li>
</ul>
</div>
<div
id=
"alarm_idlingSpeedOver"
style=
"display:none;width:100%;border-width:1px;border-style:solid;border-radius:10px;padding:2px;margin-top:5px;"
>
...
...
@@ -1424,6 +1426,10 @@ function getExtra_FA(){
var
sharpBendAlarm
=
$
(
"
#sharpBendAlarm
"
).
val
();
data
[
"
sharpBendAlarm
"
]
=
sharpBendAlarm
;
}
if
(
$
(
"
#sharpRightBendAlarm
"
).
is
(
'
:checked
'
)){
var
sharpRightBendAlarm
=
$
(
"
#sharpRightBendAlarm
"
).
val
();
data
[
"
sharpRightBendAlarm
"
]
=
sharpRightBendAlarm
;
}
if
(
$
(
"
#crashAlarm
"
).
is
(
'
:checked
'
)){
var
crashAlarm
=
$
(
"
#crashAlarm
"
).
val
();
data
[
"
crashAlarm
"
]
=
crashAlarm
;
...
...
@@ -1432,6 +1438,10 @@ function getExtra_FA(){
var
rapidChangeLines
=
$
(
"
#rapidChangeLines
"
).
val
();
data
[
"
rapidChangeLines
"
]
=
rapidChangeLines
;
}
if
(
$
(
"
#rapidChangeRightLines
"
).
is
(
'
:checked
'
)){
var
rapidChangeRightLines
=
$
(
"
#rapidChangeRightLines
"
).
val
();
data
[
"
rapidChangeRightLines
"
]
=
rapidChangeRightLines
;
}
return
data
;
}
function
getIdlingSpeedOver
(){
//获取怠速过长附带信息
...
...
templates/otherTools/maptool.html
View file @
2b42d4f3
...
...
@@ -506,6 +506,7 @@
// strokeStyle: "solid" //线样式
});
map
.
setCenter
(
centerPoint
);
$
(
"
#lineData1
"
).
val
(
JSON
.
stringify
(
data
,
null
,
4
));
}
else
{
alert
(
data
.
message
);
}
...
...
views/messageTools/M_simulater_process.py
View file @
2b42d4f3
...
...
@@ -1066,6 +1066,97 @@ def sendCrashAlarmEvent():
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 发送碰撞告警事件失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
##########################################
# 【接口类型】发送急左变道告警事件
##########################################
@
M_simulater_process
.
route
(
"/sendapidChangeLeftLines"
,
methods
=
[
'POST'
])
def
sendapidChangeLeftLines
():
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"
]
try
:
jdata
=
{
"msgID"
:
"0200"
,
"phoneNum"
:
"13146201119"
,
"msgWaterCode"
:
"1"
,
"encryptionType"
:
"0"
,
"subPkg"
:
"0"
,
"pkgCounts"
:
"0"
,
"baseInfo"
:
{
"alarmFlag"
:
0
,
"status"
:
262402
,
"latitude"
:
29.40268
,
"longtitude"
:
106.54041
,
"elevation"
:
"521"
,
"speed"
:
"66"
,
"directionAngle"
:
"59"
,
"infoTime"
:
"2020-05-28 14:20:04"
},
"extraInfo"
:
{
"FA"
:
{
"rapidChangeLines"
:
"on"
}}}
timeStamp
=
time
.
time
()
timeArray
=
time
.
localtime
(
timeStamp
)
curTime
=
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
,
timeArray
)
jdata
[
"phoneNum"
]
=
params
[
"phoneNum"
]
jdata
[
"msgWaterCode"
]
=
service
.
getSn
()
jdata
[
"baseInfo"
][
"infoTime"
]
=
curTime
jdata
[
"baseInfo"
][
"latitude"
]
=
service
.
getCurLatitude
()
jdata
[
"baseInfo"
][
"longtitude"
]
=
service
.
getCurLongtitude
()
jdata
[
"baseInfo"
][
"directionAngle"
]
=
service
.
getDirAngle
()
msgObj
=
Location_msg
()
msg
=
msgObj
.
generateMsg_GUI
(
jdata
)
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_simulater_process
.
route
(
"/sendapidChangeRightLines"
,
methods
=
[
'POST'
])
def
sendapidChangeRightLines
():
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"
]
try
:
jdata
=
{
"msgID"
:
"0200"
,
"phoneNum"
:
"13146201119"
,
"msgWaterCode"
:
"1"
,
"encryptionType"
:
"0"
,
"subPkg"
:
"0"
,
"pkgCounts"
:
"0"
,
"baseInfo"
:
{
"alarmFlag"
:
0
,
"status"
:
262402
,
"latitude"
:
29.40268
,
"longtitude"
:
106.54041
,
"elevation"
:
"521"
,
"speed"
:
"66"
,
"directionAngle"
:
"59"
,
"infoTime"
:
"2020-05-28 14:20:04"
},
"extraInfo"
:
{
"FA"
:
{
"rapidChangeRightLines"
:
"on"
}}}
timeStamp
=
time
.
time
()
timeArray
=
time
.
localtime
(
timeStamp
)
curTime
=
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
,
timeArray
)
jdata
[
"phoneNum"
]
=
params
[
"phoneNum"
]
jdata
[
"msgWaterCode"
]
=
service
.
getSn
()
jdata
[
"baseInfo"
][
"infoTime"
]
=
curTime
jdata
[
"baseInfo"
][
"latitude"
]
=
service
.
getCurLatitude
()
jdata
[
"baseInfo"
][
"longtitude"
]
=
service
.
getCurLongtitude
()
jdata
[
"baseInfo"
][
"directionAngle"
]
=
service
.
getDirAngle
()
msgObj
=
Location_msg
()
msg
=
msgObj
.
generateMsg_GUI
(
jdata
)
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