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
283ac935
Commit
283ac935
authored
Sep 15, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加怠速市场过长解除报警功能
parent
8d9e57c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
2 deletions
+61
-2
templates/protocolTools/report/M_carSimulater_page.html
templates/protocolTools/report/M_carSimulater_page.html
+13
-1
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 @
283ac935
...
@@ -152,6 +152,7 @@
...
@@ -152,6 +152,7 @@
<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=
"overSpeed_check"
onclick=
"eventSelect(this)"
checked
/>
超速报警
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"tiredDriving_check"
onclick=
"eventSelect(this)"
checked
/>
疲劳驾驶
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"tiredDriving_check"
onclick=
"eventSelect(this)"
checked
/>
疲劳驾驶
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"idlingOverTime_check"
onclick=
"eventSelect(this)"
checked
/>
怠速过长
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"idlingOverTime_check"
onclick=
"eventSelect(this)"
checked
/>
怠速过长
</label>
<label
style=
"padding: 0px 10px;"
><input
type=
"checkbox"
id=
"idlingOverTimeOver_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>
...
@@ -169,7 +170,8 @@
...
@@ -169,7 +170,8 @@
<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=
"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>
<span
id=
"tiredDriving_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendTiredDrivingAlarmEvent(this)"
>
疲劳驾驶
</button></label></span>
<span
id=
"idlingOverTime_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendIdlingOverTimeEvent(this)"
>
怠速过长
</button></label></span>
<span
id=
"idlingOverTime_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendIdlingOverTimeEvent(this)"
title=
"300秒,300毫升"
>
怠速过长
</button></label></span>
<span
id=
"idlingOverTimeOver_button"
style=
"display:inline;"
><button
type=
"button"
class=
"btn btn-primary"
onclick=
"sendIdlingOverTimeOverEvent(this)"
title=
"500秒,500毫升"
>
怠速过长(解除)
</button></label></span>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -767,6 +769,8 @@ function eventSelect(e){
...
@@ -767,6 +769,8 @@ function eventSelect(e){
$
(
"
#tiredDriving_button
"
).
css
(
"
display
"
,
"
inline
"
)
$
(
"
#tiredDriving_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
idlingOverTime_check
"
){
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
idlingOverTime_check
"
){
$
(
"
#idlingOverTime_button
"
).
css
(
"
display
"
,
"
inline
"
)
$
(
"
#idlingOverTime_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
idlingOverTimeOver_check
"
){
$
(
"
#idlingOverTimeOver_button
"
).
css
(
"
display
"
,
"
inline
"
)
}
}
}
else
{
}
else
{
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
insertAlarm_check
"
){
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
insertAlarm_check
"
){
...
@@ -801,6 +805,8 @@ function eventSelect(e){
...
@@ -801,6 +805,8 @@ function eventSelect(e){
$
(
"
#tiredDriving_button
"
).
css
(
"
display
"
,
"
none
"
)
$
(
"
#tiredDriving_button
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
idlingOverTime_check
"
){
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
idlingOverTime_check
"
){
$
(
"
#idlingOverTime_button
"
).
css
(
"
display
"
,
"
none
"
)
$
(
"
#idlingOverTime_button
"
).
css
(
"
display
"
,
"
none
"
)
}
else
if
(
$
(
e
).
attr
(
"
id
"
)
==
"
idlingOverTimeOver_check
"
){
$
(
"
#idlingOverTimeOver_button
"
).
css
(
"
display
"
,
"
none
"
)
}
}
}
}
}
}
...
@@ -900,6 +906,12 @@ function sendIdlingOverTimeEvent(){
...
@@ -900,6 +906,12 @@ function sendIdlingOverTimeEvent(){
url
=
"
/protocolTools/M_carSimulater_process/sendIdlingOverTimeEvent
"
;
url
=
"
/protocolTools/M_carSimulater_process/sendIdlingOverTimeEvent
"
;
sendjson
(
data
,
url
);
sendjson
(
data
,
url
);
}
}
//怠速过长报警(解除)
function
sendIdlingOverTimeOverEvent
(){
var
data
=
getPageData
()
url
=
"
/protocolTools/M_carSimulater_process/sendIdlingOverTimeOverEvent
"
;
sendjson
(
data
,
url
);
}
// -------------------------------- 实时控制js代码-------------------------------------------
// -------------------------------- 实时控制js代码-------------------------------------------
//设置隐藏或显示实时控制区域
//设置隐藏或显示实时控制区域
...
...
views/protocolTools/M_carSimulater_process.py
View file @
283ac935
...
@@ -1179,7 +1179,7 @@ def sendIdlingOverTimeEvent():
...
@@ -1179,7 +1179,7 @@ def sendIdlingOverTimeEvent():
"totalTime"
:
"2020002"
,
"GPSTimestamp"
:
"1588229973"
},
"totalTime"
:
"2020002"
,
"GPSTimestamp"
:
"1588229973"
},
"securityData"
:
{
"securityStatus"
:
107
,
"doorStatus"
:
0
,
"lockStatus"
:
0
,
"windowStatus"
:
0
,
"securityData"
:
{
"securityStatus"
:
107
,
"doorStatus"
:
0
,
"lockStatus"
:
0
,
"windowStatus"
:
0
,
"lightStatus"
:
0
,
"onoffStatusA"
:
0
,
"onoffStatusB"
:
112
,
"dataByte"
:
249
},
"event"
:
{
"lightStatus"
:
0
,
"onoffStatusA"
:
0
,
"onoffStatusB"
:
112
,
"dataByte"
:
249
},
"event"
:
{
"0032"
:
{
"alarmType"
:
"1"
,
"durationTime"
:
"
11
00"
,
"oilExpend"
:
"300"
}}}
"0032"
:
{
"alarmType"
:
"1"
,
"durationTime"
:
"
3
00"
,
"oilExpend"
:
"300"
}}}
jdata
[
"DEV_ID"
]
=
params
[
"carId"
]
jdata
[
"DEV_ID"
]
=
params
[
"carId"
]
obj
=
EventReport_protocol
(
data
=
jdata
)
obj
=
EventReport_protocol
(
data
=
jdata
)
gpsData
=
service
.
genGPSData2
()
gpsData
=
service
.
genGPSData2
()
...
@@ -1197,6 +1197,53 @@ def sendIdlingOverTimeEvent():
...
@@ -1197,6 +1197,53 @@ def sendIdlingOverTimeEvent():
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
(
"/sendIdlingOverTimeOverEvent"
,
methods
=
[
'POST'
])
def
sendIdlingOverTimeOverEvent
():
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"
:
{
"0032"
:
{
"alarmType"
:
"0"
,
"durationTime"
:
"500"
,
"oilExpend"
:
"500"
}}}
jdata
[
"DEV_ID"
]
=
params
[
"carId"
]
obj
=
EventReport_protocol
(
data
=
jdata
)
gpsData
=
service
.
genGPSData2
()
obj
.
setGPSPkg
(
gpsData
)
obj
.
setEventType
(
"0032"
)
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