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
189f96aa
Commit
189f96aa
authored
Mar 03, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成GPS随机数据参数以及部分附加信息随机产生
parent
0d9b38ea
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
452 additions
and
28 deletions
+452
-28
README.md
README.md
+3
-0
lib/protocol/message/Location_msg.py
lib/protocol/message/Location_msg.py
+235
-10
lib/protocol/message/MessageBase.py
lib/protocol/message/MessageBase.py
+30
-11
lib/protocol/message/TerminalVersionInfo_msg.py
lib/protocol/message/TerminalVersionInfo_msg.py
+3
-3
lib/protocol/message/data/CarSafeStatusInfo.py
lib/protocol/message/data/CarSafeStatusInfo.py
+46
-0
lib/socket/messageTest.py
lib/socket/messageTest.py
+7
-4
static/js/messageTools/messages.js
static/js/messageTools/messages.js
+2
-0
templates/messageTools/message/heartBeat_msg_page.html
templates/messageTools/message/heartBeat_msg_page.html
+1
-0
templates/messageTools/message/location_msg_page.html
templates/messageTools/message/location_msg_page.html
+111
-0
views/messageTools/message_view.py
views/messageTools/message_view.py
+14
-0
No files found.
README.md
0 → 100644
View file @
189f96aa
#模拟程序说明文档
####(一)、框架结构说明
\ No newline at end of file
lib/protocol/message/Location_msg.py
View file @
189f96aa
This diff is collapsed.
Click to expand it.
lib/protocol/message/MessageBase.py
View file @
189f96aa
...
@@ -126,15 +126,17 @@ class MessageBase(Base):
...
@@ -126,15 +126,17 @@ class MessageBase(Base):
tmpR
=
data
tmpR
=
data
tmp
=
tmpR
[
0
:
2
]
tmp
=
tmpR
[
0
:
2
]
tmpA
=
tmpR
[
0
:
2
]
tmpR
=
tmpR
[
2
:]
tmpR
=
tmpR
[
2
:]
data
=
""
data
=
""
while
tmp
R
!=
""
:
while
tmp
A
!=
""
:
if
tmp
==
"7d"
:
if
tmp
==
"7d"
:
tmp
=
"7d01"
tmp
=
"7d01"
elif
tmp
==
"7e"
:
elif
tmp
==
"7e"
:
tmp
=
"7d02"
tmp
=
"7d02"
data
=
data
+
tmp
data
=
data
+
tmp
tmp
=
tmpR
[
0
:
2
]
tmp
=
tmpR
[
0
:
2
]
tmpA
=
tmpR
[
0
:
2
]
tmpR
=
tmpR
[
2
:]
tmpR
=
tmpR
[
2
:]
return
data
return
data
...
@@ -233,16 +235,33 @@ class MessageBase(Base):
...
@@ -233,16 +235,33 @@ class MessageBase(Base):
data
=
random
.
randint
(
s
,
e
)
data
=
random
.
randint
(
s
,
e
)
else
:
else
:
if
mult
==
0
:
if
mult
==
0
:
if
type
(
intArr
[
0
])
==
int
:
data
=
int
(
random
.
choice
(
intArr
))
data
=
int
(
random
.
choice
(
intArr
))
elif
type
(
intArr
[
0
])
==
str
:
data
=
random
.
choice
(
intArr
)
else
:
else
:
if
type
(
intArr
[
0
])
==
int
:
if
len
(
intArr
)
<
mult
:
if
len
(
intArr
)
<
mult
:
raise
RuntimeError
(
'个数超过数组长度!'
)
raise
RuntimeError
(
'个数超过数组长度!'
)
temp
=
[]
temp
=
[]
data
=
0
data
=
0
for
i
in
range
(
0
,
mult
):
for
i
in
range
(
0
,
mult
):
num
=
int
(
random
.
choice
(
intArr
))
num
=
int
(
random
.
choice
(
intArr
))
while
num
in
temp
:
if
num
in
temp
:
num
=
int
(
random
.
choice
(
intArr
))
# num = int(random.choice(intArr))
num
=
0
temp
.
append
(
num
)
data
=
data
+
num
elif
type
(
intArr
[
0
])
==
str
:
if
len
(
intArr
)
<
mult
:
raise
RuntimeError
(
'个数超过数组长度!'
)
temp
=
[]
data
=
""
for
i
in
range
(
0
,
mult
):
num
=
random
.
choice
(
intArr
)
if
num
in
temp
:
# num = int(random.choice(intArr))
num
=
0
temp
.
append
(
num
)
temp
.
append
(
num
)
data
=
data
+
num
data
=
data
+
num
return
data
return
data
...
...
lib/protocol/message/TerminalVersionInfo_msg.py
View file @
189f96aa
...
@@ -84,8 +84,8 @@ class TerminalVersionInfo_msg(MessageBase):
...
@@ -84,8 +84,8 @@ class TerminalVersionInfo_msg(MessageBase):
softwareVersion
=
self
.
GBKString2Hex
(
"KZP200_V201001"
)
#软件版本号
softwareVersion
=
self
.
GBKString2Hex
(
"KZP200_V201001"
)
#软件版本号
softwareVersionDate
=
self
.
GBKString2Hex
(
"2020-02-10"
)
#终端版本日期
softwareVersionDate
=
self
.
GBKString2Hex
(
"2020-02-10"
)
#终端版本日期
CPUId
=
self
.
str2Hex
(
"CPU-12345678"
)
#cpuId
CPUId
=
self
.
str2Hex
(
"CPU-12345678"
)
#cpuId
G
MSType
=
self
.
GBKString2Hex
(
"GMS-TYPE-123456"
)
#GMS
型号
G
SMType
=
self
.
GBKString2Hex
(
"GSM-TYPE-123456"
)
#GSM
型号
G
MS_IMEI
=
self
.
GBKString2Hex
(
"GMS
_IMEI_123456"
)
#GSM IMEI 号
G
SM_IMEI
=
self
.
GBKString2Hex
(
"GSM
_IMEI_123456"
)
#GSM IMEI 号
SIM_IMSI
=
self
.
GBKString2Hex
(
"SIM_13146201119"
)
#终端 SIM 卡 IMSI 号
SIM_IMSI
=
self
.
GBKString2Hex
(
"SIM_13146201119"
)
#终端 SIM 卡 IMSI 号
SIM_ICCID
=
self
.
GBKString2Hex
(
"SIM_ICCID13146201119"
)
#终端 SIM 卡 ICCID 号
SIM_ICCID
=
self
.
GBKString2Hex
(
"SIM_ICCID13146201119"
)
#终端 SIM 卡 ICCID 号
carType
=
self
.
int2hexStringByBytes
(
22
,
2
)
#车系车型 ID
carType
=
self
.
int2hexStringByBytes
(
22
,
2
)
#车系车型 ID
...
@@ -93,7 +93,7 @@ class TerminalVersionInfo_msg(MessageBase):
...
@@ -93,7 +93,7 @@ class TerminalVersionInfo_msg(MessageBase):
totalMileage
=
self
.
int2hexStringByBytes
(
389000
,
4
)
#装上终端后车辆累计总里程或车辆仪表里程(单位米)
totalMileage
=
self
.
int2hexStringByBytes
(
389000
,
4
)
#装上终端后车辆累计总里程或车辆仪表里程(单位米)
totalOilExpend
=
self
.
int2hexStringByBytes
(
420000
,
4
)
#装上终端后车辆累计总耗油量(ml)
totalOilExpend
=
self
.
int2hexStringByBytes
(
420000
,
4
)
#装上终端后车辆累计总耗油量(ml)
msg
=
msg
+
softwareVersion
+
softwareVersionDate
+
CPUId
+
G
MSType
+
GMS
_IMEI
msg
=
msg
+
softwareVersion
+
softwareVersionDate
+
CPUId
+
G
SMType
+
GSM
_IMEI
msg
=
msg
+
SIM_IMSI
+
SIM_ICCID
+
carType
+
VIN
+
totalMileage
msg
=
msg
+
SIM_IMSI
+
SIM_ICCID
+
carType
+
VIN
+
totalMileage
msg
=
msg
+
totalOilExpend
msg
=
msg
+
totalOilExpend
return
msg
return
msg
...
...
lib/protocol/message/data/CarSafeStatusInfo.py
View file @
189f96aa
...
@@ -29,6 +29,24 @@ class CarSafeStatusInfo(MessageBase):
...
@@ -29,6 +29,24 @@ class CarSafeStatusInfo(MessageBase):
retain3
=
"00"
# 预留
retain3
=
"00"
# 预留
data
=
data
+
statusCode
+
securityStatus
+
doorStatus
+
lockStatus
+
windowStatus
+
lightStatus
+
onoffStatusA
+
onoffStatusB
+
retain1
+
retain2
+
retain3
return
data
#创建安防状态数据,数据随机产生
def
generateSecurityStatusData_random
(
self
):
data
=
""
statusCode
=
"ffffffffffffffffffff"
#状态掩码
securityStatus
=
self
.
getSecurityStatusHex_random
()
#安全状态
doorStatus
=
self
.
getDoorStatusHex_random
()
#门状态
lockStatus
=
self
.
getLockStatusHex_random
()
#锁状态
windowStatus
=
self
.
getWindowStatusHex_random
()
#窗户状态
lightStatus
=
self
.
getLightStatusHex_random
()
#灯光状态
onoffStatusA
=
self
.
getOnoffStatusAHex_random
()
#开关状态A
onoffStatusB
=
self
.
getOnoffStatusBHex_random
()
#开关状态B
retain1
=
"00"
#预留
retain2
=
"00"
#预留
retain3
=
"00"
# 预留
data
=
data
+
statusCode
+
securityStatus
+
doorStatus
+
lockStatus
+
windowStatus
+
lightStatus
+
onoffStatusA
+
onoffStatusB
+
retain1
+
retain2
+
retain3
data
=
data
+
statusCode
+
securityStatus
+
doorStatus
+
lockStatus
+
windowStatus
+
lightStatus
+
onoffStatusA
+
onoffStatusB
+
retain1
+
retain2
+
retain3
return
data
return
data
...
@@ -50,6 +68,10 @@ class CarSafeStatusInfo(MessageBase):
...
@@ -50,6 +68,10 @@ class CarSafeStatusInfo(MessageBase):
val
=
accStatus
+
defenseStatus
+
brakeStatus
+
acceleratorStatus
+
handBrakeStatus
+
mainSafetyBelt
+
subSafetyBelt
+
retain
val
=
accStatus
+
defenseStatus
+
brakeStatus
+
acceleratorStatus
+
handBrakeStatus
+
mainSafetyBelt
+
subSafetyBelt
+
retain
hexData
=
self
.
int2hexStringByBytes
(
val
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
return
hexData
def
getSecurityStatusHex_random
(
self
):
val
=
self
.
getRandomNum
(
intArr
=
[
0
,
1
,
2
,
4
,
8
,
16
,
32
,
64
],
mult
=
7
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
#####################################################
#####################################################
# 获取门状态16进制数据
# 获取门状态16进制数据
...
@@ -67,6 +89,10 @@ class CarSafeStatusInfo(MessageBase):
...
@@ -67,6 +89,10 @@ class CarSafeStatusInfo(MessageBase):
val
=
lfDoorStatus
+
rfDoorStatus
+
lbDoorStatus
+
rbDoorStatus
+
trunk
+
enginCover
+
retain1
+
retain2
val
=
lfDoorStatus
+
rfDoorStatus
+
lbDoorStatus
+
rbDoorStatus
+
trunk
+
enginCover
+
retain1
+
retain2
hexData
=
self
.
int2hexStringByBytes
(
val
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
return
hexData
def
getDoorStatusHex_random
(
self
):
val
=
self
.
getRandomNum
(
intArr
=
[
0
,
1
,
2
,
4
,
8
,
16
,
32
],
mult
=
6
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
#####################################################
#####################################################
# 获取锁状态16进制数据
# 获取锁状态16进制数据
...
@@ -84,6 +110,10 @@ class CarSafeStatusInfo(MessageBase):
...
@@ -84,6 +110,10 @@ class CarSafeStatusInfo(MessageBase):
val
=
lfDoorLockStatus
+
rfDoorLockStatus
+
lbDoorLockStatus
+
rbDoorLockStatus
+
retain1
+
retain2
+
retain3
+
retain4
val
=
lfDoorLockStatus
+
rfDoorLockStatus
+
lbDoorLockStatus
+
rbDoorLockStatus
+
retain1
+
retain2
+
retain3
+
retain4
hexData
=
self
.
int2hexStringByBytes
(
val
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
return
hexData
def
getLockStatusHex_random
(
self
):
val
=
self
.
getRandomNum
(
intArr
=
[
0
,
1
,
2
,
4
,
8
],
mult
=
4
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
#####################################################
#####################################################
# 获取窗户状态16进制数据
# 获取窗户状态16进制数据
...
@@ -101,6 +131,10 @@ class CarSafeStatusInfo(MessageBase):
...
@@ -101,6 +131,10 @@ class CarSafeStatusInfo(MessageBase):
val
=
lfWindowStatus
+
rfWindowStatus
+
lbWindowStatus
+
rbWindowStatus
+
topWindowStatus
+
lTurnLight
+
rTurnLight
+
readLight
val
=
lfWindowStatus
+
rfWindowStatus
+
lbWindowStatus
+
rbWindowStatus
+
topWindowStatus
+
lTurnLight
+
rTurnLight
+
readLight
hexData
=
self
.
int2hexStringByBytes
(
val
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
return
hexData
def
getWindowStatusHex_random
(
self
):
val
=
self
.
getRandomNum
(
intArr
=
[
0
,
1
,
2
,
4
,
8
,
16
,
32
,
64
,
128
],
mult
=
8
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
#####################################################
#####################################################
# 获取灯光状态16进制数据
# 获取灯光状态16进制数据
...
@@ -118,6 +152,10 @@ class CarSafeStatusInfo(MessageBase):
...
@@ -118,6 +152,10 @@ class CarSafeStatusInfo(MessageBase):
val
=
lowHeadlight
+
highHeadlight
+
ffogLight
+
bfogLight
+
dangerLight
+
backCarLight
+
autoLight
+
widthLight
val
=
lowHeadlight
+
highHeadlight
+
ffogLight
+
bfogLight
+
dangerLight
+
backCarLight
+
autoLight
+
widthLight
hexData
=
self
.
int2hexStringByBytes
(
val
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
return
hexData
def
getLightStatusHex_random
(
self
):
val
=
self
.
getRandomNum
(
intArr
=
[
0
,
1
,
2
,
4
,
8
,
16
,
32
,
64
,
128
],
mult
=
8
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
#####################################################
#####################################################
# 获取开关状态A16进制数据
# 获取开关状态A16进制数据
...
@@ -135,6 +173,10 @@ class CarSafeStatusInfo(MessageBase):
...
@@ -135,6 +173,10 @@ class CarSafeStatusInfo(MessageBase):
val
=
machineOilWarning
+
oilWarning
+
wiperWarning
+
loudsspeakerWaring
+
airConditionerWaring
+
backMirrorWaring
+
retain1
+
retain2
val
=
machineOilWarning
+
oilWarning
+
wiperWarning
+
loudsspeakerWaring
+
airConditionerWaring
+
backMirrorWaring
+
retain1
+
retain2
hexData
=
self
.
int2hexStringByBytes
(
val
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
return
hexData
def
getOnoffStatusAHex_random
(
self
):
val
=
self
.
getRandomNum
(
intArr
=
[
0
,
1
,
2
,
4
,
8
,
16
,
32
],
mult
=
6
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
#####################################################
#####################################################
# 获取开关状态B16进制数据
# 获取开关状态B16进制数据
...
@@ -150,3 +192,7 @@ class CarSafeStatusInfo(MessageBase):
...
@@ -150,3 +192,7 @@ class CarSafeStatusInfo(MessageBase):
val
=
retain1
+
retain2
+
retain3
+
retain4
+
gears
val
=
retain1
+
retain2
+
retain3
+
retain4
+
gears
hexData
=
self
.
int2hexStringByBytes
(
val
)
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
return
hexData
def
getOnoffStatusBHex_random
(
self
):
val
=
self
.
getRandomNum
(
intArr
=
[
0
,
16
,
32
,
48
,
64
,
80
,
96
,
112
,
128
,
144
,
160
,
176
])
hexData
=
self
.
int2hexStringByBytes
(
val
)
return
hexData
\ No newline at end of file
lib/socket/messageTest.py
View file @
189f96aa
#coding:utf-8
#coding:utf-8
import
binascii
import
binascii
import
socket
import
socket
import
traceback
from
lib.protocol.message.DataUpstreamTransport_msg
import
DataUpstreamTransport_msg
from
lib.protocol.message.DataUpstreamTransport_msg
import
DataUpstreamTransport_msg
from
lib.protocol.message.LocationDataBatchUpdate_msg
import
LocationDataBatchUpdate_msg
from
lib.protocol.message.LocationDataBatchUpdate_msg
import
LocationDataBatchUpdate_msg
...
@@ -29,7 +30,8 @@ port = 9001
...
@@ -29,7 +30,8 @@ port = 9001
# msg = QueryTerminalParam_res().generateMsg() #查询终端参数应答
# msg = QueryTerminalParam_res().generateMsg() #查询终端参数应答
# msg = QueryTerminalProperty_res().generateMsg() #查询终端属性应答消息
# msg = QueryTerminalProperty_res().generateMsg() #查询终端属性应答消息
# msg = Location_msg().generateMsg() #位置信息汇报
# msg = Location_msg().generateMsg() #位置信息汇报
msg
=
DataUpstreamTransport_msg
()
.
generateMsg
()
#数据上行透传消息
msg
=
Location_msg
()
.
generateMsg_random
()
# msg = DataUpstreamTransport_msg().generateMsg() #数据上行透传消息
# msg = TerminalUpdataResult_msg().generateMsg() #终端升级结果通知
# msg = TerminalUpdataResult_msg().generateMsg() #终端升级结果通知
# msg = LocationDataBatchUpdate_msg().generateMsg() #定位数据批量上传
# msg = LocationDataBatchUpdate_msg().generateMsg() #定位数据批量上传
# msg = TextInfoUpload_msg().generateMsg() #文本信息上传
# msg = TextInfoUpload_msg().generateMsg() #文本信息上传
...
@@ -48,6 +50,7 @@ def sendSingleMsg(msg):
...
@@ -48,6 +50,7 @@ def sendSingleMsg(msg):
client
.
send
(
binascii
.
a2b_hex
(
msg
))
client
.
send
(
binascii
.
a2b_hex
(
msg
))
# client.send(bytes.fromhex(msg))
# client.send(bytes.fromhex(msg))
except
BaseException
as
e
:
except
BaseException
as
e
:
traceback
.
print_exc
()
client
.
close
()
client
.
close
()
print
(
"连接超时,socket断开"
)
print
(
"连接超时,socket断开"
)
return
return
...
@@ -55,15 +58,15 @@ def sendSingleMsg(msg):
...
@@ -55,15 +58,15 @@ def sendSingleMsg(msg):
data
=
client
.
recv
(
BUF_SIZE
)
data
=
client
.
recv
(
BUF_SIZE
)
# print(data)
# print(data)
except
BaseException
as
e
:
except
BaseException
as
e
:
#
traceback.print_exc()
traceback
.
print_exc
()
client
.
close
()
client
.
close
()
# raise RuntimeError('socket 接收消息超时!')
# raise RuntimeError('socket 接收消息超时!')
print
(
'socket 接收消息超时!'
)
print
(
'socket 接收消息超时!'
)
return
return
print
(
data
)
print
(
data
)
print
(
PlatformCommon_res
(
data
)
.
getOriginalMsg
())
print
(
PlatformCommon_res
(
data
)
.
getOriginalMsg
())
#
print(PlatformCommon_res(data).getMsg()) #解析平台通用应答消息
print
(
PlatformCommon_res
(
data
)
.
getMsg
())
#解析平台通用应答消息
print
(
TerminalRegister_res
(
data
)
.
getMsg
())
#解析终端注册应答消息
#
print(TerminalRegister_res(data).getMsg()) #解析终端注册应答消息
# print(PlatefromVersionInfo_res(data).getMsg()) #解析平台版本信息包上传应答
# print(PlatefromVersionInfo_res(data).getMsg()) #解析平台版本信息包上传应答
client
.
close
()
client
.
close
()
...
...
static/js/messageTools/messages.js
View file @
189f96aa
...
@@ -12,6 +12,8 @@ function messageManTab(e){
...
@@ -12,6 +12,8 @@ function messageManTab(e){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/terminalVersionInfoUpload_msg_page
"
);
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/terminalVersionInfoUpload_msg_page
"
);
}
else
if
(
id
==
"
dataUpstreamTransport_msg
"
){
}
else
if
(
id
==
"
dataUpstreamTransport_msg
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_page
"
);
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_page
"
);
}
else
if
(
id
==
"
location_msg
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/location_msg_page
"
);
}
else
{
}
else
{
alert
(
id
)
alert
(
id
)
}
}
...
...
templates/messageTools/message/heartBeat_msg_page.html
View file @
189f96aa
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
<li
role=
"presentation"
><a
id=
"terminalRegister_msg"
{%
if
arg.path[2]=
="terminalRegister_msg_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"messageManTab(this)"
>
终端注册
</b></a></li>
<li
role=
"presentation"
><a
id=
"terminalRegister_msg"
{%
if
arg.path[2]=
="terminalRegister_msg_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"messageManTab(this)"
>
终端注册
</b></a></li>
<li
role=
"presentation"
><a
id=
"terminalVersionInfoUpload_msg"
{%
if
arg.path[2]=
="terminalVersionInfoUpload_msg_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"messageManTab(this)"
>
终端版本信息主动上报
</b></a></li>
<li
role=
"presentation"
><a
id=
"terminalVersionInfoUpload_msg"
{%
if
arg.path[2]=
="terminalVersionInfoUpload_msg_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"messageManTab(this)"
>
终端版本信息主动上报
</b></a></li>
<li
role=
"presentation"
><a
id=
"dataUpstreamTransport_msg"
{%
if
arg.path[2]=
="dataUpstreamTransport_msg_page"
or
arg.path[2]=
="dataUpstreamTransport_msg_f2_page"
or
arg.path[2]=
="dataUpstreamTransport_msg_f3_page"
or
arg.path[2]=
="dataUpstreamTransport_msg_f4_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"messageManTab(this)"
>
数据上行透传
</b></a></li>
<li
role=
"presentation"
><a
id=
"dataUpstreamTransport_msg"
{%
if
arg.path[2]=
="dataUpstreamTransport_msg_page"
or
arg.path[2]=
="dataUpstreamTransport_msg_f2_page"
or
arg.path[2]=
="dataUpstreamTransport_msg_f3_page"
or
arg.path[2]=
="dataUpstreamTransport_msg_f4_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"messageManTab(this)"
>
数据上行透传
</b></a></li>
<li
role=
"presentation"
><a
id=
"location_msg"
{%
if
arg.path[2]=
="location_msg_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"messageManTab(this)"
>
位置信息汇报
</b></a></li>
<li
role=
"presentation"
><a
id=
"style_index2"
{%
if
arg.path[2]=
="2"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"messageManTab(this)"
>
其他报文
</b></a></li>
<li
role=
"presentation"
><a
id=
"style_index2"
{%
if
arg.path[2]=
="2"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"messageManTab(this)"
>
其他报文
</b></a></li>
</ul>
</ul>
{% endblock %}
{% endblock %}
...
...
templates/messageTools/message/location_msg_page.html
0 → 100644
View file @
189f96aa
{% extends "messageTools/message/heartBeat_msg_page.html" %}
{% block title %}location_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
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=
"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;"
>
<li><label>
省域ID:
</label><input
id=
"provinceId"
type=
"text"
class=
"form-control"
value=
"50"
></li>
<li><label>
市县域ID:
</label><input
id=
"countyId"
type=
"text"
class=
"form-control"
value=
"103"
></li>
</ul>
<H3
style=
"border-bottom: 1px solid #eee;"
>
附加消息内容:
</H3>
<ul
class=
"protocol_content"
style=
"padding:0px;"
>
<li><label>
省域ID:
</label><input
id=
"provinceId2"
type=
"text"
class=
"form-control"
value=
"50"
></li>
<li><label>
市县域ID:
</label><input
id=
"countyId2"
type=
"text"
class=
"form-control"
value=
"103"
></li>
</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
provinceId
=
$
(
"
#provinceId
"
).
val
();
var
countyId
=
$
(
"
#countyId
"
).
val
();
var
manufacturerId
=
$
(
"
#manufacturerId
"
).
val
();
var
terminalType
=
$
(
"
#terminalType
"
).
val
();
var
terminalId
=
$
(
"
#terminalId
"
).
val
();
var
licencePlateColor
=
$
(
"
#licencePlateColor
"
).
val
();
var
carSign
=
$
(
"
#carSign
"
).
val
();
var
data
=
{};
data
[
"
msgID
"
]
=
msgID
;
data
[
"
phoneNum
"
]
=
phoneNum
;
data
[
"
msgWaterCode
"
]
=
msgWaterCode
;
data
[
"
encryptionType
"
]
=
encryptionType
;
data
[
"
subPkg
"
]
=
subPkg
;
data
[
"
pkgCounts
"
]
=
pkgCounts
;
data
[
"
provinceId
"
]
=
provinceId
;
data
[
"
countyId
"
]
=
countyId
;
data
[
"
manufacturerId
"
]
=
manufacturerId
;
data
[
"
terminalType
"
]
=
terminalType
;
data
[
"
terminalId
"
]
=
terminalId
;
data
[
"
licencePlateColor
"
]
=
licencePlateColor
;
data
[
"
carSign
"
]
=
carSign
;
var
host
=
window
.
location
.
host
;
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/messageTools/message_process/porcessTerminalRegisterMsg
"
,
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
+
"
解析数据:
"
+
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 %}
\ No newline at end of file
views/messageTools/message_view.py
View file @
189f96aa
...
@@ -102,3 +102,17 @@ def dataUpstreamTransport_msg_f4_page():
...
@@ -102,3 +102,17 @@ def dataUpstreamTransport_msg_f4_page():
path
=
"messageTools/message/dataUpstreamTransport_msg_f4_page.html"
path
=
"messageTools/message/dataUpstreamTransport_msg_f4_page.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
return
render_template
(
path
,
arg
=
arg
)
return
render_template
(
path
,
arg
=
arg
)
##########################################
# 【视图类型】位置信息汇报
##########################################
@
message_view
.
route
(
'/location_msg_page'
)
def
location_msg_page
():
#获取请求的路劲
url
=
request
.
url
reqPath
=
re
.
findall
(
"http://(.*)$"
,
url
)[
0
]
reqPath
=
re
.
findall
(
"/(.*)$"
,
reqPath
)[
0
]
arg
=
{}
path
=
"messageTools/message/location_msg_page.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
return
render_template
(
path
,
arg
=
arg
)
\ No newline at end of file
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