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
ddaf3a31
Commit
ddaf3a31
authored
Mar 24, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加了m300测试页面的点击进入
parent
29757da2
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
230 additions
and
11 deletions
+230
-11
lib/socket/protocolTest_M500.py
lib/socket/protocolTest_M500.py
+1
-1
run.py
run.py
+4
-0
static/js/index.js
static/js/index.js
+2
-6
static/js/m300Tools/m300.js
static/js/m300Tools/m300.js
+15
-0
templates/base.html
templates/base.html
+1
-1
templates/m300Tools/index.html
templates/m300Tools/index.html
+45
-0
templates/m300Tools/report/P_heartBeat_m300_page.html
templates/m300Tools/report/P_heartBeat_m300_page.html
+130
-0
templates/protocolTools/report/userDefined_protocol_page.html
...lates/protocolTools/report/userDefined_protocol_page.html
+9
-2
views/m300Tools/P_m300Protocol_view.py
views/m300Tools/P_m300Protocol_view.py
+21
-0
views/m300Tools/__init__.py
views/m300Tools/__init__.py
+0
-0
views/protocolTools/protocolReport_process.py
views/protocolTools/protocolReport_process.py
+2
-1
No files found.
lib/socket/protocolTest_M500.py
View file @
ddaf3a31
...
...
@@ -32,7 +32,7 @@ port = 9008
# msg = TroubleReport_protocol().generateTroubleMsg() #终端上报故障码数据包
# msg = EventReport_protocol().generateEventMsg()
# msg = VersionReport_protocol().generateVersionMsg() #终端上报版本信息数据包
msg
=
SleepReport_protocol
()
.
generateSleepMsg
()
msg
=
SleepReport_protocol
()
.
generateSleepMsg
()
#终端休眠数据包
print
(
msg
)
BUF_SIZE
=
1024
...
...
run.py
View file @
ddaf3a31
...
...
@@ -8,6 +8,8 @@ from views.protocolTools.M_carSimulater_view import M_carSimulater_view
from
views.protocolTools.M_carSimulater_process
import
M_carSimulater_process
from
views.protocolTools.test_view
import
test_view
from
views.m300Tools.P_m300Protocol_view
import
P_m300Protocol_view
from
views.messageTools.msgSetting_view
import
msgSetting_view
from
views.messageTools.msgSetting_process
import
msgSetting_process
from
views.messageTools.message_view
import
message_view
...
...
@@ -22,6 +24,8 @@ app.register_blueprint(M_carSimulater_view,url_prefix = "/protocolTools/M_carSim
app
.
register_blueprint
(
M_carSimulater_process
,
url_prefix
=
"/protocolTools/M_carSimulater_process"
)
app
.
register_blueprint
(
test_view
,
url_prefix
=
"/protocolTools/test_view"
)
app
.
register_blueprint
(
P_m300Protocol_view
,
url_prefix
=
"/m300Tools/P_m300Protocol_view"
)
app
.
register_blueprint
(
msgSetting_view
,
url_prefix
=
"/messageTools/msgSetting_view"
)
app
.
register_blueprint
(
msgSetting_process
,
url_prefix
=
"/messageTools/msgSetting_process"
)
app
.
register_blueprint
(
message_view
,
url_prefix
=
"/messageTools/message_view"
)
...
...
static/js/index.js
View file @
ddaf3a31
...
...
@@ -7,11 +7,7 @@ function swichTap(e){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/protocolTools/protocolReport_view/GPS_protocol_page
"
);
}
else
if
(
id
==
"
messageTools
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/heartBeat_msg_page
"
);
}
else
if
(
id
==
"
tab1
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/tab1/style
"
);
}
else
if
(
id
==
"
tab2
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/tab2/login
"
);
}
else
if
(
id
==
"
otherTab
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/other
"
);
}
else
if
(
id
==
"
m300Tools
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/m300Tools/P_m300Protocol_view/P_heartBeat_m300_page
"
);
}
}
static/js/m300Tools/m300.js
0 → 100644
View file @
ddaf3a31
/**
*protocols 页面顶部的协议切换
*/
function
m300ProtocolManTab
(
e
){
var
url
=
window
.
location
.
href
;
var
id
=
$
(
e
).
attr
(
"
id
"
);
if
(
id
==
"
P_heartBeat_m300_msg
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/m300Tools/P_m300Protocol_view/P_heartBeat_m300_page
"
);
}
else
if
(
id
==
"
userDefined_protocol
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/protocolTools/protocolReport_view/userDefined_protocol_page
"
);
}
else
{
alert
(
id
)
}
}
templates/base.html
View file @
ddaf3a31
...
...
@@ -20,7 +20,7 @@
<div
style=
"width: 70%;margin: 0 auto"
>
<ul
class=
"nav nav-tabs"
style=
"font-size:18px;"
>
<li
role=
"presentation"
{%
if
arg.path[0]=
="protocolTools"
%}
class=
"active"
{%
endif
%}
><a
onclick=
"swichTap(this)"
id=
"protocolTools"
>
M500协议工具
</a></li>
<li
role=
"presentation"
{%
if
arg.path[0]=
="m300
"
%}
class=
"active"
{%
endif
%}
><a
onclick=
"swichTap(this)"
id=
"m300
"
>
M300协议工具
</a></li>
<li
role=
"presentation"
{%
if
arg.path[0]=
="m300
Tools"
%}
class=
"active"
{%
endif
%}
><a
onclick=
"swichTap(this)"
id=
"m300Tools
"
>
M300协议工具
</a></li>
<li
role=
"presentation"
{%
if
arg.path[0]=
="messageTools"
%}
class=
"active"
{%
endif
%}
><a
onclick=
"swichTap(this)"
id=
"messageTools"
>
新硬件消息工具
</a></li>
</ul>
</div>
...
...
templates/m300Tools/index.html
0 → 100644
View file @
ddaf3a31
{% extends "base.html" %}
{% block title %}m300消息工具{% endblock %}
{% block content %}
<style
type=
"text/css"
>
.link-tab
{
background-color
:
#e4e2dd
;
}
.active_left_tab
{
background-color
:
#428BCA
;
color
:
white
;
}
.table
>
thead
>
tr
>
th
,
.table
>
tbody
>
tr
>
td
{
_background-color
:
red
;
}
</style>
<!-- 切换左边的tab -->
<script
type=
"text/javascript"
>
function
swichLeftTab
(
e
){
var
id
=
$
(
e
).
attr
(
"
id
"
)
if
(
id
==
"
m300_msg_send
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/m300Tools/P_m300Protocol_view/P_heartBeat_m300_page
"
);
}
else
if
(
id
==
"
icon
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/tab1/icon
"
);
}
}
</script>
<!-- 左侧导航添加为可继承模块 -->
{% block leftNav %}
<div
id=
"container1"
class=
"col-sm-3 col-md-2 sidebar"
style=
"margin-top:50px;width:15%;padding:0px;margin-right:15px;"
>
<ul
class=
"nav nav-sidebar"
>
<li
id=
"m300_msg_send"
onclick=
"swichLeftTab(this)"
><a
{%
if
arg.path[1]=
="P_m300Protocol_view"
%}
class=
"active_left_tab"
{%
endif
%}
><span
class=
"glyphicon glyphicon-list-alt"
aria-hidden=
"true"
></span>
m300单消息发送
<span
class=
"sr-only"
></span></a></li>
</ul>
<ul
class=
"nav nav-sidebar"
style=
"margin-top:20px;"
>
<li><a><span
class=
"glyphicon glyphicon-eye-open"
aria-hidden=
"true"
></span>
其他页面
</a></li>
</ul>
</div>
{% endblock %}
{% block content_01 %}
<!-- 右边内容区域 -->
{% endblock %}
{% endblock %}
</div>
\ No newline at end of file
templates/m300Tools/report/P_heartBeat_m300_page.html
0 → 100644
View file @
ddaf3a31
{% extends "m300Tools/index.html" %}
{% block title %}heartBeat_msg{% endblock %}
{% block content_01 %}
<script
src=
"../../static/js/m300Tools/m300.js"
></script>
<style>
.nav-pills
li
{
margin-bottom
:
5px
;
}
.form-control
{
display
:
inline
;
width
:
160px
;
}
.protocol_content
:after
{
clear
:
both
;
display
:
block
;
content
:
" "
;
}
.protocol_content
li
{
width
:
250px
;
_background
:
yellow
;
list-style
:
none
;
margin-top
:
5px
;
float
:
left
;
}
.protocol_content
label
{
width
:
90px
;
text-align
:
right
;
}
</style>
<div
id=
"container2"
style=
"width:83%;min-height:750px;float:left;_background:grey;margin-top:50px;"
>
{% block content_02 %}
<ul
class=
"nav nav-pills"
style=
"font-size:14px;"
>
<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>
</ul>
{% 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
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=
"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>
<option
value=
"1024"
>
加密
</option>
</select>
<label>
有无分包:
</label><select
style=
"width:80px;"
id=
"subPkg"
class=
"form-control"
onchange=
"hasSubPkg()"
>
<option
value=
"0"
>
无
</option>
<option
value=
"8192"
>
有
</option>
</select>
<label
id=
"subPkg_label"
style=
"color:grey;"
>
分包个数:
</label><input
disabled=
"disabled"
id=
"pkgCounts"
type=
"text"
class=
"form-control"
value=
"0"
style=
"width:60px;"
>
</div>
<H3
style=
"border-bottom: 1px solid #eee;"
>
设置心跳消息内容:
</H3>
<ul
class=
"protocol_content"
style=
"padding:0px;"
>
<label
style=
"color:red;width:130px;"
>
心跳消息无消息体...
</label>
</ul>
<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=
"8"
></textarea>
</div>
</div>
<script>
//发送GPS数据
$
(
"
#sendMsgBtn
"
).
click
(
function
(){
var
msgID
=
$
(
"
#msgID
"
).
val
();
var
phoneNum
=
$
(
"
#phoneNum
"
).
val
();
var
msgWaterCode
=
$
(
"
#msgWaterCode
"
).
val
();
var
encryptionType
=
$
(
"
#encryptionType
"
).
val
();
var
subPkg
=
$
(
"
#subPkg
"
).
val
();
var
pkgCounts
=
""
if
(
subPkg
!=
"
8192
"
){
pkgCounts
=
"
0
"
}
else
{
pkgCounts
=
$
(
"
#pkgCounts
"
).
val
();
}
var
data
=
{};
data
[
"
msgID
"
]
=
msgID
;
data
[
"
phoneNum
"
]
=
phoneNum
;
data
[
"
msgWaterCode
"
]
=
msgWaterCode
;
data
[
"
encryptionType
"
]
=
encryptionType
;
data
[
"
subPkg
"
]
=
subPkg
;
data
[
"
pkgCounts
"
]
=
pkgCounts
;
var
host
=
window
.
location
.
host
;
$
(
"
#showFeedback
"
).
val
(
""
)
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/messageTools/message_process/porcessHeartBeatMsg
"
,
type
:
"
post
"
,
data
:
data
,
dataType
:
"
json
"
,
success
:
function
(
data
){
if
(
data
.
status
==
200
){
//window.location.reload()
var
theShow
=
"
原始数据:
"
+
data
.
original
+
"
\n
"
;
theShow
=
theShow
+
"
收到数据:
"
+
data
.
result
+
"
\n
"
;
theShow
=
theShow
+
"
收到数据16进制:
"
+
data
.
resultH
+
"
\n
"
;
theShow
=
theShow
+
"
解析数据:
"
+
JSON
.
stringify
(
data
.
parse
)
+
"
\n
"
;
$
(
"
#showFeedback
"
).
val
(
theShow
)
}
else
{
$
(
"
#showFeedback
"
).
val
(
data
.
message
)
alert
(
data
.
message
);
}
}
});
});
function
hasSubPkg
(){
value
=
$
(
"
#subPkg
"
).
val
()
if
(
value
==
"
8192
"
){
$
(
"
#subPkg_label
"
).
css
(
"
color
"
,
"
black
"
)
$
(
"
#pkgCounts
"
).
removeAttr
(
"
disabled
"
)
}
else
{
$
(
"
#subPkg_label
"
).
css
(
"
color
"
,
"
grey
"
)
$
(
"
#pkgCounts
"
).
attr
(
"
disabled
"
,
"
disabled
"
)
}
}
</script>
{% endblock %}
</div>
{% endblock %}
\ No newline at end of file
templates/protocolTools/report/userDefined_protocol_page.html
View file @
ddaf3a31
...
...
@@ -2,9 +2,14 @@
{% block title %}heartBeat_protocol{% 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=
"10"
>
</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=
"
5
"
></textarea>
<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;"
>
...
...
@@ -12,7 +17,7 @@
</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=
"
8
"
></textarea>
<textarea
id=
"showFeedback"
style=
"width:100%;padding:5px;"
rows=
"
6
"
></textarea>
</div>
</div>
...
...
@@ -21,9 +26,11 @@
//发送心跳数据包
$
(
"
#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
(
""
)
...
...
views/m300Tools/P_m300Protocol_view.py
0 → 100644
View file @
ddaf3a31
#coding:utf-8
from
configparser
import
ConfigParser
from
flask
import
Blueprint
,
render_template
,
request
import
re
P_m300Protocol_view
=
Blueprint
(
'P_m300Protocol_view'
,
__name__
)
##########################################
# 【视图类型】访问侧车机模拟器页面
##########################################
@
P_m300Protocol_view
.
route
(
'/P_heartBeat_m300_page'
)
def
P_heartBeat_m300_page
():
#获取请求的路劲
url
=
request
.
url
reqPath
=
re
.
findall
(
"http://(.*)$"
,
url
)[
0
]
reqPath
=
re
.
findall
(
"/(.*)$"
,
reqPath
)[
0
]
arg
=
{}
path
=
"m300Tools/report/P_heartBeat_m300_page.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
return
render_template
(
path
,
arg
=
arg
)
\ No newline at end of file
views/m300Tools/__init__.py
0 → 100644
View file @
ddaf3a31
views/protocolTools/protocolReport_process.py
View file @
ddaf3a31
...
...
@@ -24,6 +24,7 @@ protocolReport_process = Blueprint('protocolReport_process', __name__)
@
protocolReport_process
.
route
(
"/porcessUserdefinedMsg"
,
methods
=
[
'POST'
])
def
porcessUserdefinedMsg
():
msg
=
request
.
form
.
get
(
"msg"
)
timeout
=
int
(
request
.
form
.
get
(
"timeout"
))
data
=
{}
if
(
msg
==
None
):
...
...
@@ -37,7 +38,7 @@ def porcessUserdefinedMsg():
cliSocket
=
ClientSocket
(
conf_R
.
get
(
"socket"
,
"host"
),
conf_R
.
getint
(
"socket"
,
"port"
))
cliSocket
.
connect
()
cliSocket
.
send
(
msg
)
cliSocket
.
setTimeOut
(
500
)
cliSocket
.
setTimeOut
(
timeout
)
socRecv
=
cliSocket
.
receive
()
socRecvo
=
str
(
socRecv
)
cliSocket
.
close
()
...
...
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