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
3001f34d
Commit
3001f34d
authored
Apr 28, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成了M300 自定义报文页面开发
parent
e46b925e
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
200 additions
and
20 deletions
+200
-20
lib/protocol/appendix/EventClass.py
lib/protocol/appendix/EventClass.py
+9
-9
static/js/m300Tools/m300.js
static/js/m300Tools/m300.js
+2
-0
templates/m300Tools/report/P_heartBeat_m300_page.html
templates/m300Tools/report/P_heartBeat_m300_page.html
+1
-0
templates/m300Tools/report/P_userDefined_m300_page.html
templates/m300Tools/report/P_userDefined_m300_page.html
+59
-0
templates/messageTools/message/M_simulater_page.html
templates/messageTools/message/M_simulater_page.html
+1
-1
templates/messageTools/message/dataUpstreamTransport_msg_f2_page.html
...ssageTools/message/dataUpstreamTransport_msg_f2_page.html
+1
-1
templates/messageTools/message/dataUpstreamTransport_msg_f3_page.html
...ssageTools/message/dataUpstreamTransport_msg_f3_page.html
+1
-1
templates/messageTools/message/dataUpstreamTransport_msg_f4_page.html
...ssageTools/message/dataUpstreamTransport_msg_f4_page.html
+1
-1
templates/messageTools/message/dataUpstreamTransport_msg_page.html
.../messageTools/message/dataUpstreamTransport_msg_page.html
+1
-1
templates/messageTools/message/heartBeat_msg_page.html
templates/messageTools/message/heartBeat_msg_page.html
+1
-1
templates/messageTools/message/location_msg_page.html
templates/messageTools/message/location_msg_page.html
+1
-1
templates/messageTools/message/terminalRegister_msg_page.html
...lates/messageTools/message/terminalRegister_msg_page.html
+1
-1
templates/messageTools/message/terminalVersionInfoUpload_msg_page.html
...sageTools/message/terminalVersionInfoUpload_msg_page.html
+1
-1
templates/protocolTools/report/M_carSimulater_page.html
templates/protocolTools/report/M_carSimulater_page.html
+69
-1
views/m300Tools/P_m300Protocol_process.py
views/m300Tools/P_m300Protocol_process.py
+37
-0
views/m300Tools/P_m300Protocol_view.py
views/m300Tools/P_m300Protocol_view.py
+14
-0
views/protocolTools/M_carSimulater_process.py
views/protocolTools/M_carSimulater_process.py
+0
-1
No files found.
lib/protocol/appendix/EventClass.py
View file @
3001f34d
...
...
@@ -17,7 +17,7 @@ class EventClass(ProtocolBase):
def
setSecurityData
(
self
,
data
):
self
.
securityData
=
data
#
3
点火事件附带信息
#
0010
点火事件附带信息
def
fireExtraInfo
(
self
):
allRapidlyAccelerateCount
=
self
.
int2hexStringByBytes
(
15
,
2
)
# 急加速总次数
allSharpSlowdownCount
=
self
.
int2hexStringByBytes
(
15
,
2
)
# 急减速总次数
...
...
@@ -32,7 +32,7 @@ class EventClass(ProtocolBase):
data
=
allRapidlyAccelerateCount
+
allSharpSlowdownCount
+
allSharpTurn
+
securityData
return
data
#
4
熄火事件附带信息
#
0011
熄火事件附带信息
def
misFireExtraInfo
(
self
):
allRapidlyAccelerateCount
=
self
.
int2hexStringByBytes
(
100
,
2
)
#急加速总次数
allSharpSlowdownCount
=
self
.
int2hexStringByBytes
(
101
,
2
)
#急减速总次数
...
...
@@ -47,7 +47,7 @@ class EventClass(ProtocolBase):
data
=
allRapidlyAccelerateCount
+
allSharpSlowdownCount
+
allSharpTurn
+
securityData
return
data
#
5
设防事件附带信息
#
0012
设防事件附带信息
def
setUpDefencesExtraInfo
(
self
):
securityObj
=
SecurityStatusReport_protocol
()
securityObj
.
setGPSPkg
(
self
.
GPSPkg
)
...
...
@@ -58,7 +58,7 @@ class EventClass(ProtocolBase):
securityData
=
self
.
securityData
return
securityData
#
6
撤防事件附带信息
#
0013
撤防事件附带信息
def
setDownDefencesExtraInfo
(
self
):
securityObj
=
SecurityStatusReport_protocol
()
securityObj
.
setGPSPkg
(
self
.
GPSPkg
)
...
...
@@ -70,27 +70,27 @@ class EventClass(ProtocolBase):
return
securityData
return
securityData
#
7
锁车未成功事件附带信息
#
0014
锁车未成功事件附带信息
def
lockCarFaillExtraInfo
(
self
):
securityData
=
SecurityStatusReport_protocol
.
generateSecurityStatusData
()
# 安防数据
return
securityData
#
8
超时未设防事件附带信息
#
0015
超时未设防事件附带信息
def
noDefencesWithTimeoutExtraInfo
(
self
):
securityData
=
SecurityStatusReport_protocol
.
generateSecurityStatusData
()
# 安防数据
return
securityData
#
9
设防玻璃未关事件附带信息
#
0016
设防玻璃未关事件附带信息
def
defencesGlassNoCloseExtraInfo
(
self
):
securityData
=
SecurityStatusReport_protocol
.
generateSecurityStatusData
()
# 安防数据
return
securityData
#
10
设防非法开门事件附带信息
#
0017
设防非法开门事件附带信息
def
defencesIllegalCloseDoorExtraInfo
(
self
):
securityData
=
SecurityStatusReport_protocol
.
generateSecurityStatusData
()
# 安防数据
return
securityData
#
11
设防非法点火事件附带信息
#
0018
设防非法点火事件附带信息
def
defencesIllegalFireExtraInfo
(
self
):
securityData
=
SecurityStatusReport_protocol
.
generateSecurityStatusData
()
# 安防数据
return
securityData
...
...
static/js/m300Tools/m300.js
View file @
3001f34d
...
...
@@ -8,6 +8,8 @@ function m300ProtocolManTab(e){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/m300Tools/P_m300Protocol_view/P_heartBeat_m300_page
"
);
}
else
if
(
id
==
"
socketSetting
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/m300Tools/P_m300Protocol_view/socketSetting_page
"
);
}
else
if
(
id
==
"
P_userDefined_m300_msg
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/m300Tools/P_m300Protocol_view/P_userDefined_m300_page
"
);
}
else
if
(
id
==
"
P_login_m300_msg
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/m300Tools/P_m300Protocol_view/P_login_m300_page
"
);
}
else
if
(
id
==
"
P_version_m300_msg
"
){
...
...
templates/m300Tools/report/P_heartBeat_m300_page.html
View file @
3001f34d
...
...
@@ -33,6 +33,7 @@
{% block content_02 %}
<ul
class=
"nav nav-pills"
style=
"font-size:14px;"
>
<li
role=
"presentation"
><a
id=
"socketSetting"
{%
if
arg.path[2]=
="socketSetting_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"m300ProtocolManTab(this)"
>
设置
</b></a></li>
<li
role=
"presentation"
><a
id=
"P_userDefined_m300_msg"
{%
if
arg.path[2]=
="P_userDefined_m300_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"m300ProtocolManTab(this)"
>
自定义消息
</b></a></li>
<li
role=
"presentation"
><a
id=
"P_heartBeat_m300_msg"
{%
if
arg.path[2]=
="P_heartBeat_m300_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"m300ProtocolManTab(this)"
>
心跳消息
</b></a></li>
<li
role=
"presentation"
><a
id=
"P_login_m300_msg"
{%
if
arg.path[2]=
="P_login_m300_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"m300ProtocolManTab(this)"
>
登录消息
</b></a></li>
<li
role=
"presentation"
><a
id=
"P_version_m300_msg"
{%
if
arg.path[2]=
="P_version_m300_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"m300ProtocolManTab(this)"
>
版本消息
</b></a></li>
...
...
templates/m300Tools/report/P_userDefined_m300_page.html
0 → 100644
View file @
3001f34d
{% extends "m300Tools/report/P_heartBeat_m300_page.html" %}
{% block title %}userDefined_msg{% endblock %}
{% block content_1 %}
<div
id=
"container3"
style=
"width:100%;min-height:750px;float:left;_background:green;margin-top:10px;_border-top: 1px solid #eee;"
>
<div>
<span>
<label>
超时时间(秒):
</label><input
id=
"timeout"
type=
"text"
class=
"form-control"
style=
"width:100px;"
value=
"1"
>
</span>
</div>
<H3
style=
"border-bottom: 1px solid #eee;"
>
输入消息内容:
</H3>
<div
style=
"width:100%;padding:5px;margin-top:10px;"
>
<textarea
id=
"msg"
style=
"width:100%;padding:5px;"
rows=
"4"
></textarea>
</div>
<H3
style=
"border-bottom: 1px solid #eee;"
>
控制:
</H3>
<div
style=
"width:100%;padding:5px;margin-top:10px;"
>
<button
type=
"button"
class=
"btn btn-primary"
id=
"sendMsgBtn"
>
发送消息
</button>
</div>
<H3
style=
"border-bottom: 1px solid #eee;"
>
返回结果:
</H3>
<div
style=
"width:100%;padding:5px;margin-top:10px;"
>
<textarea
id=
"showFeedback"
style=
"width:100%;padding:5px;"
rows=
"6"
></textarea>
</div>
</div>
<script>
//发送GPS数据
$
(
"
#sendMsgBtn
"
).
click
(
function
(){
var
msg
=
$
(
"
#msg
"
).
val
();
var
timeout
=
$
(
"
#timeout
"
).
val
();
var
data
=
{};
data
[
"
msg
"
]
=
msg
;
data
[
"
timeout
"
]
=
timeout
var
host
=
window
.
location
.
host
;
$
(
"
#showFeedback
"
).
val
(
""
)
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/m300Tools/P_m300Protocol_process/porcessUserdefinedMsg
"
,
type
:
"
post
"
,
data
:
data
,
dataType
:
"
json
"
,
success
:
function
(
data
){
if
(
data
.
status
==
200
){
//window.location.reload()
msg
=
"
发送消息:
"
+
data
.
msgSend
+
"
\n
"
msg
=
msg
+
"
收到消息:
"
+
data
.
result
+
"
\n
"
msg
=
msg
+
"
收到消息16进制:
"
+
data
.
rev
+
"
\n
"
msg
=
msg
+
"
收到消息解析结果:
"
+
JSON
.
stringify
(
data
.
orgRev
)
+
"
\n
"
$
(
"
#showFeedback
"
).
val
(
msg
)
}
else
{
$
(
"
#showFeedback
"
).
val
(
data
.
message
)
alert
(
data
.
message
);
}
}
});
});
</script>
{% endblock %}
\ No newline at end of file
templates/messageTools/message/M_simulater_page.html
View file @
3001f34d
...
...
@@ -49,7 +49,7 @@
<span><label>
在线人数:
</label><input
disabled=
disabled
type=
"text"
id=
"totalSessionNums"
class=
"form-control"
style=
"display:inline;width:80px;"
value=
"1"
/></span>
<button
id=
"sessionRefresh"
type=
"button"
class=
"btn btn-primary"
onclick=
"getAllUsers(this)"
>
刷新
</button><label
style=
"font-size:10px;width:100px;"
>
刷新后,可在控制台查看在线用户详细信息
</label>
</div>
<div
style=
"width:100%;padding-bottom:10px;border-bottom: 1px solid #eee;"
>
<div
style=
"width:100%;
_
padding-bottom:10px;border-bottom: 1px solid #eee;"
>
<h4>
点击登录按钮发送报文:
</h4>
<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>
...
...
templates/messageTools/message/dataUpstreamTransport_msg_f2_page.html
View file @
3001f34d
...
...
@@ -5,7 +5,7 @@
<div
style=
"width:100%;_background:green;padding:5px;padding-top:0px;"
>
<h3
style=
"border-bottom: 1px solid #eee;"
>
设置消息头:
</h3>
<label>
消息ID:
</label><input
id=
"msgID"
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"0900"
style=
"width:80px;"
>
<label>
终端手
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
车
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
消息流水号:
</label><input
id=
"msgWaterCode"
type=
"text"
class=
"form-control"
value=
"1"
style=
"width:60px;"
>
<label>
是否加密:
</label><select
style=
"width:100px;"
id=
"encryptionType"
class=
"form-control"
>
<option
value=
"0"
>
不加密
</option>
...
...
templates/messageTools/message/dataUpstreamTransport_msg_f3_page.html
View file @
3001f34d
...
...
@@ -5,7 +5,7 @@
<div
style=
"width:100%;_background:green;padding:5px;padding-top:0px;"
>
<h3
style=
"border-bottom: 1px solid #eee;"
>
设置消息头:
</h3>
<label>
消息ID:
</label><input
id=
"msgID"
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"0900"
style=
"width:80px;"
>
<label>
终端手
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
车
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
消息流水号:
</label><input
id=
"msgWaterCode"
type=
"text"
class=
"form-control"
value=
"1"
style=
"width:60px;"
>
<label>
是否加密:
</label><select
style=
"width:100px;"
id=
"encryptionType"
class=
"form-control"
>
<option
value=
"0"
>
不加密
</option>
...
...
templates/messageTools/message/dataUpstreamTransport_msg_f4_page.html
View file @
3001f34d
...
...
@@ -5,7 +5,7 @@
<div
style=
"width:100%;_background:green;padding:5px;padding-top:0px;"
>
<h3
style=
"border-bottom: 1px solid #eee;"
>
设置消息头:
</h3>
<label>
消息ID:
</label><input
id=
"msgID"
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"0900"
style=
"width:80px;"
>
<label>
终端手
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
车
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
消息流水号:
</label><input
id=
"msgWaterCode"
type=
"text"
class=
"form-control"
value=
"1"
style=
"width:60px;"
>
<label>
是否加密:
</label><select
style=
"width:100px;"
id=
"encryptionType"
class=
"form-control"
>
<option
value=
"0"
>
不加密
</option>
...
...
templates/messageTools/message/dataUpstreamTransport_msg_page.html
View file @
3001f34d
...
...
@@ -5,7 +5,7 @@
<div
style=
"width:100%;_background:green;padding:5px;padding-top:0px;"
>
<h3
style=
"border-bottom: 1px solid #eee;"
>
设置消息头:
</h3>
<label>
消息ID:
</label><input
id=
"msgID"
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"0900"
style=
"width:80px;"
>
<label>
终端手
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
车
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
消息流水号:
</label><input
id=
"msgWaterCode"
type=
"text"
class=
"form-control"
value=
"1"
style=
"width:60px;"
>
<label>
是否加密:
</label><select
style=
"width:100px;"
id=
"encryptionType"
class=
"form-control"
>
<option
value=
"0"
>
不加密
</option>
...
...
templates/messageTools/message/heartBeat_msg_page.html
View file @
3001f34d
...
...
@@ -45,7 +45,7 @@
<div
style=
"width:100%;_background:green;padding:5px;padding-top:0px;"
>
<h3
style=
"border-bottom: 1px solid #eee;"
>
设置消息头:
</h3>
<label>
消息ID:
</label><input
id=
"msgID"
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"0002"
style=
"width:80px;"
>
<label>
终端手
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
车
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
消息流水号:
</label><input
id=
"msgWaterCode"
type=
"text"
class=
"form-control"
value=
"1"
style=
"width:60px;"
>
<label>
是否加密:
</label><select
style=
"width:100px;"
id=
"encryptionType"
class=
"form-control"
>
<option
value=
"0"
>
不加密
</option>
...
...
templates/messageTools/message/location_msg_page.html
View file @
3001f34d
...
...
@@ -5,7 +5,7 @@
<div
style=
"width:100%;_background:green;padding:5px;padding-top:0px;"
>
<h3
style=
"border-bottom: 1px solid #eee;"
>
设置消息头:
</h3>
<label>
消息ID:
</label><input
id=
"msgID"
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"0200"
style=
"width:80px;"
>
<label>
终端手
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
车
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
消息流水号:
</label><input
id=
"msgWaterCode"
type=
"text"
class=
"form-control"
value=
"1"
style=
"width:60px;"
>
<label>
是否加密:
</label><select
style=
"width:100px;"
id=
"encryptionType"
class=
"form-control"
>
<option
value=
"0"
>
不加密
</option>
...
...
templates/messageTools/message/terminalRegister_msg_page.html
View file @
3001f34d
...
...
@@ -5,7 +5,7 @@
<div
style=
"width:100%;_background:green;padding:5px;padding-top:0px;"
>
<h3
style=
"border-bottom: 1px solid #eee;"
>
设置消息头:
</h3>
<label>
消息ID:
</label><input
id=
"msgID"
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"0100"
style=
"width:80px;"
>
<label>
终端手
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
车
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
消息流水号:
</label><input
id=
"msgWaterCode"
type=
"text"
class=
"form-control"
value=
"1"
style=
"width:60px;"
>
<label>
是否加密:
</label><select
style=
"width:100px;"
id=
"encryptionType"
class=
"form-control"
>
<option
value=
"0"
>
不加密
</option>
...
...
templates/messageTools/message/terminalVersionInfoUpload_msg_page.html
View file @
3001f34d
...
...
@@ -5,7 +5,7 @@
<div
style=
"width:100%;_background:green;padding:5px;padding-top:0px;"
>
<h3
style=
"border-bottom: 1px solid #eee;"
>
设置消息头:
</h3>
<label>
消息ID:
</label><input
id=
"msgID"
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"0205"
style=
"width:80px;"
>
<label>
终端手
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
车
机号:
</label><input
id=
"phoneNum"
type=
"text"
class=
"form-control"
value=
"13146201119"
style=
"width:150px;"
>
<label>
消息流水号:
</label><input
id=
"msgWaterCode"
type=
"text"
class=
"form-control"
value=
"1"
style=
"width:60px;"
>
<label>
是否加密:
</label><select
style=
"width:100px;"
id=
"encryptionType"
class=
"form-control"
>
<option
value=
"0"
>
不加密
</option>
...
...
templates/protocolTools/report/M_carSimulater_page.html
View file @
3001f34d
...
...
@@ -50,7 +50,7 @@
<span><label>
在线人数:
</label><input
disabled=
disabled
type=
"text"
id=
"totalSessionNums"
class=
"form-control"
style=
"display:inline;width:80px;"
value=
"1"
/></span>
<button
id=
"sessionRefresh"
type=
"button"
class=
"btn btn-primary"
onclick=
"getAllUsers(this)"
>
刷新
</button><label
style=
"font-size:10px;width:100px;"
>
刷新后,可在控制台查看在线用户详细信息
</label>
</div>
<div
style=
"width:100%;padding-bottom:10px;border-bottom: 1px solid #eee;"
>
<div
style=
"width:100%;
_
padding-bottom:10px;border-bottom: 1px solid #eee;"
>
<h4>
点击登录按钮发送报文:
</h4>
<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>
...
...
@@ -115,6 +115,48 @@
<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>
</div>
<!--
<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>
<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 style="margin-left:10px;"><input name="eventshow" type="radio" value="1" onclick="isShowEventArea(this)"/>显示</label>
</span>
</h5>
<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;">
<label style="padding: 0px 10px;"><input type="checkbox" id="aaa" 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="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="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="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="004A" onclick="eventSelect(this)"/>剩余油量异常告警 </label>
</div>
<div style="margin-top:10px;">
<span><label>我的id:</label><input disabled=disabled type="text" id="c" class="form-control" style="display:inline;width:200px;" value=""/></span>
<span><label>在线人数:</label><input disabled=disabled type="text" id="b" class="form-control" style="display:inline;width:80px;" value="1"/></span>
<button id="a" type="button" class="btn btn-primary" onclick="getAllUsers(this)">刷新</button></label>
</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;">
<h5><b>实时控制:</b>
<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 style="margin-left:10px;"><input name="realtime" type="radio" value="1" onclick="isShowRealTimeCtrArea(this)"/>显示</label>
</span>
</h5>
<div id="realTimeCtl_area" style="display:none;">
<span><label>我的id:</label><input disabled=disabled type="text" id="c2" class="form-control" style="display:inline;width:200px;" value=""/></span>
<span><label>在线人数:</label><input disabled=disabled type="text" id="b2" class="form-control" style="display:inline;width:80px;" value="1"/></span>
<button id="a2" type="button" class="btn btn-primary" onclick="getAllUsers(this)">刷新</button></label>
</div>
</div>
-->
<div
style=
"width:100%;padding-bottom:60px;border-bottom: 1px solid #eee;"
>
<h3>
日志:
</h3>
<textarea
id=
"showFeedback"
style=
"width:100%;padding:5px;padding-bottom:60px;"
rows=
"10"
></textarea>
...
...
@@ -499,6 +541,7 @@ function isLogShow(e){
showLog
=
true
;
}
}
// -------------------------------- session多人在线js代码-------------------------------------------
//获取水机session id
function
getSessionId
(){
var
sessionNum
=
parseInt
(
Math
.
random
()
*
100000
);
...
...
@@ -566,6 +609,31 @@ function getAllUsers(){
}
});
})()
// -------------------------------- 实时控制js代码-------------------------------------------
//设置隐藏或显示实时控制区域
function
isShowRealTimeCtrArea
(
e
){
var
value
=
$
(
e
).
val
()
if
(
value
==
"
0
"
){
$
(
"
#realTimeCtl_area
"
).
css
(
"
display
"
,
"
none
"
)
}
else
{
$
(
"
#realTimeCtl_area
"
).
css
(
"
display
"
,
"
block
"
)
}
}
// -------------------------------- 事件控制js代码-------------------------------------------
//设置隐藏或显示事件控制区域
function
isShowEventArea
(
e
){
var
value
=
$
(
e
).
val
()
if
(
value
==
"
0
"
){
$
(
"
#event_area
"
).
css
(
"
display
"
,
"
none
"
)
}
else
{
$
(
"
#event_area
"
).
css
(
"
display
"
,
"
block
"
)
}
}
</script>
{% endblock %}
</div>
...
...
views/m300Tools/P_m300Protocol_process.py
View file @
3001f34d
...
...
@@ -50,6 +50,43 @@ def porcessSocketSetting():
data
[
"message"
]
=
"Error: 处理失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
##########################################
# 【接口类型】处理发送的自定义报文
##########################################
@
P_m300Protocol_process
.
route
(
"/porcessUserdefinedMsg"
,
methods
=
[
'POST'
])
def
porcessUserdefinedMsg
():
msg
=
request
.
form
.
get
(
"msg"
)
timeout
=
int
(
request
.
form
.
get
(
"timeout"
))
data
=
{}
if
(
msg
==
None
):
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Info: 请检查是否传入了空数据!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
conf_R
=
ConfigParser
()
conf_R
.
read
(
"config/m300Tools/m300Tools.conf"
)
cliSocket
=
ClientSocket
(
conf_R
.
get
(
"socket"
,
"host"
),
conf_R
.
getint
(
"socket"
,
"port"
))
cliSocket
.
connect
()
cliSocket
.
send
(
msg
)
cliSocket
.
setTimeOut
(
timeout
)
socRecv
=
cliSocket
.
receive
()
socRecvo
=
str
(
socRecv
)
cliSocket
.
close
()
data
[
"status"
]
=
"200"
data
[
"message"
]
=
"Sucess: "
data
[
"msgSend"
]
=
msg
data
[
"result"
]
=
socRecvo
data
[
"rev"
]
=
str
(
binascii
.
b2a_hex
(
socRecv
))[
2
:][:
-
1
]
data
[
"orgRev"
]
=
json
.
loads
(
M300Common_res
(
data
[
"rev"
])
.
getMsg
())
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 处理失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
##########################################
# 【接口类型】处理发送的心跳上报报文
##########################################
...
...
views/m300Tools/P_m300Protocol_view.py
View file @
3001f34d
...
...
@@ -26,6 +26,20 @@ def socketSetting_page():
arg
[
"socket"
][
"port"
]
=
conf_R
.
getint
(
"socket"
,
"port"
)
return
render_template
(
path
,
arg
=
arg
)
##########################################
# 【视图类型】访问用户自定义消息页面
##########################################
@
P_m300Protocol_view
.
route
(
'/P_userDefined_m300_page'
)
def
P_userDefined_m300_page
():
#获取请求的路劲
url
=
request
.
url
reqPath
=
re
.
findall
(
"http://(.*)$"
,
url
)[
0
]
reqPath
=
re
.
findall
(
"/(.*)$"
,
reqPath
)[
0
]
arg
=
{}
path
=
"m300Tools/report/P_userDefined_m300_page.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
return
render_template
(
path
,
arg
=
arg
)
##########################################
# 【视图类型】访问心跳协议页面
##########################################
...
...
views/protocolTools/M_carSimulater_process.py
View file @
3001f34d
...
...
@@ -70,7 +70,6 @@ def createConect():
connects
[
sessionId
]
=
connect
socketName
=
"socket_"
+
str
(
len
(
connects
)
+
1
)
connect
[
"name"
]
=
socketName
connect
[
"obj"
]
=
cliSocket
service
=
ProtocolSimulaterService
()
service
.
setSocket
(
cliSocket
)
service
.
setTimeout
(
timeout
)
...
...
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