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
f9458667
Commit
f9458667
authored
Feb 14, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
终端版本信息主动上报界面与后端接对接完成
parent
17d49215
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
253 additions
and
4 deletions
+253
-4
lib/protocol/message/Location_msg.py
lib/protocol/message/Location_msg.py
+5
-2
lib/protocol/message/TerminalVersionInfo_msg.py
lib/protocol/message/TerminalVersionInfo_msg.py
+40
-0
lib/socket/messageTest.py
lib/socket/messageTest.py
+3
-2
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
+6
-0
templates/messageTools/message/terminalVersionInfoUpload_msg_page.html
...sageTools/message/terminalVersionInfoUpload_msg_page.html
+123
-0
views/messageTools/message_process.py
views/messageTools/message_process.py
+60
-0
views/messageTools/message_view.py
views/messageTools/message_view.py
+14
-0
No files found.
lib/protocol/message/Location_msg.py
View file @
f9458667
...
@@ -96,11 +96,14 @@ class Location_msg(MessageBase):
...
@@ -96,11 +96,14 @@ class Location_msg(MessageBase):
#报警事件 ID 数据项列表
#报警事件 ID 数据项列表
extra_FA
=
"FA"
+
self
.
int2hexStringByBytes
(
int
(
len
(
AlarmEvent_data
()
.
generateAlarmEvent_data
())
/
2
))
+
AlarmEvent_data
()
.
generateAlarmEvent_data
()
extra_FA
=
"FA"
+
self
.
int2hexStringByBytes
(
int
(
len
(
AlarmEvent_data
()
.
generateAlarmEvent_data
())
/
2
))
+
AlarmEvent_data
()
.
generateAlarmEvent_data
()
data
=
extra_01
+
extra_02
+
extra_11
+
extra_12
+
extra_13
+
extra_FA
data
=
extra_01
+
extra_02
+
extra_31
+
extra_EA
+
extra_EB
# data = extra_01 + extra_02 + extra_11 + extra_12 + extra_13
# data = extra_01 + extra_02 + extra_11 + extra_12 + extra_13
# data = data + extra_2A + extra_30 + extra_31 + extra_EA + extra_EB
# data = data + extra_2A + extra_30 + extra_31 + extra_EA + extra_EB
# data = data + extra_EC
# data = data + extra_EC
extraInfoLen
=
self
.
int2hexStringByBytes
(
int
(
len
(
data
)
/
2
))
extraInfoLen
=
self
.
int2hexStringByBytes
(
int
(
len
(
data
)
/
2
))
if
int
(
len
(
data
)
/
2
)
>
255
:
raise
RuntimeError
(
'附加信息长度超长!'
)
data
=
extraInfoId
+
extraInfoLen
+
data
data
=
extraInfoId
+
extraInfoLen
+
data
return
data
return
data
...
@@ -166,7 +169,7 @@ class Location_msg(MessageBase):
...
@@ -166,7 +169,7 @@ class Location_msg(MessageBase):
dataId_0007
=
"0007"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
480000
,
4
)
dataId_0007
=
"0007"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
480000
,
4
)
dataId_0010
=
"0010"
+
self
.
int2hexStringByBytes
(
int
(
len
(
self
.
getSpeedupInOneSeconds
())
/
2
))
+
self
.
getSpeedupInOneSeconds
()
dataId_0010
=
"0010"
+
self
.
int2hexStringByBytes
(
int
(
len
(
self
.
getSpeedupInOneSeconds
())
/
2
))
+
self
.
getSpeedupInOneSeconds
()
dataId_0011
=
"0011"
+
self
.
int2hexStringByBytes
(
int
(
len
(
CarSafeStatusInfo
()
.
generateSecurityStatusData
())
/
2
))
+
CarSafeStatusInfo
()
.
generateSecurityStatusData
()
dataId_0011
=
"0011"
+
self
.
int2hexStringByBytes
(
int
(
len
(
CarSafeStatusInfo
()
.
generateSecurityStatusData
())
/
2
))
+
CarSafeStatusInfo
()
.
generateSecurityStatusData
()
dataId_0012
=
"0012"
+
self
.
int2hexStringByBytes
(
2
)
+
self
.
int2hexStringByBytes
(
36
,
2
)
dataId_0012
=
"0012"
+
self
.
int2hexStringByBytes
(
2
)
+
self
.
int2hexStringByBytes
(
36
2
,
2
)
dataId_0013
=
"0013"
+
self
.
int2hexStringByBytes
(
1
)
+
self
.
int2hexStringByBytes
(
6
)
dataId_0013
=
"0013"
+
self
.
int2hexStringByBytes
(
1
)
+
self
.
int2hexStringByBytes
(
6
)
#TODO 由于被置灰,所以没有实现
#TODO 由于被置灰,所以没有实现
# dataId_0015 = "0015" + self.int2hexStringByBytes(2)
# dataId_0015 = "0015" + self.int2hexStringByBytes(2)
...
...
lib/protocol/message/TerminalVersionInfo_msg.py
View file @
f9458667
...
@@ -26,6 +26,24 @@ class TerminalVersionInfo_msg(MessageBase):
...
@@ -26,6 +26,24 @@ class TerminalVersionInfo_msg(MessageBase):
msg
=
msg
+
self
.
IDENTIFY
msg
=
msg
+
self
.
IDENTIFY
return
msg
return
msg
# 生成一条完整的消息,针对图形界面,可传递参数
def
generateMsg_GUI
(
self
,
msgID
=
"0205"
,
phoneNum
=
"13146201119"
,
msgWaterCode
=
1
,
encryptionType
=
0
,
subPkg
=
0
,
\
softwareVersion
=
"KZP200_V201001"
,
softwareVersionDate
=
"2020-02-10"
,
CPUId
=
"CPU-12345678"
,
GMSType
=
"GMS-TYPE-123456"
,
\
GMS_IMEI
=
"GMS_IMEI_123456"
,
SIM_IMSI
=
"SIM_13146201119"
,
SIM_ICCID
=
"SIM_ICCID13146201119"
,
carType
=
22
,
VIN
=
"VIN_1234567891234"
,
\
totalMileage
=
389000
,
totalOilExpend
=
420000
):
msg
=
""
msgHeader
=
self
.
getMsgHeader
()
msgBody
=
self
.
getMsgBody_GUI
(
softwareVersion
,
softwareVersionDate
,
CPUId
,
GMSType
,
GMS_IMEI
,
SIM_IMSI
,
SIM_ICCID
,
carType
,
VIN
,
\
totalMileage
,
totalOilExpend
)
checkCode
=
self
.
getCheckCode
(
msgHeader
+
msgBody
)
msg
=
msg
+
self
.
IDENTIFY
info
=
msgHeader
+
msgBody
+
checkCode
info
=
self
.
replace7e7d
(
info
)
msg
=
msg
+
info
msg
=
msg
+
self
.
IDENTIFY
return
msg
#######################################################
#######################################################
# 获取消息体
# 获取消息体
#######################################################
#######################################################
...
@@ -48,6 +66,28 @@ class TerminalVersionInfo_msg(MessageBase):
...
@@ -48,6 +66,28 @@ class TerminalVersionInfo_msg(MessageBase):
msg
=
msg
+
totalOilExpend
msg
=
msg
+
totalOilExpend
return
msg
return
msg
# 生成一条完整的消息,针对图形界面,可传递参数
def
getMsgBody_GUI
(
self
,
softwareVersion
=
"KZP200_V201001"
,
softwareVersionDate
=
"2020-02-10"
,
CPUId
=
"CPU-12345678"
,
GMSType
=
"GMS-TYPE-123456"
,
\
GMS_IMEI
=
"GMS_IMEI_123456"
,
SIM_IMSI
=
"SIM_13146201119"
,
SIM_ICCID
=
"SIM_ICCID13146201119"
,
carType
=
22
,
VIN
=
"VIN_1234567891234"
,
\
totalMileage
=
389000
,
totalOilExpend
=
420000
):
msg
=
""
softwareVersion
=
self
.
GBKString2Hex
(
softwareVersion
)
#软件版本号
softwareVersionDate
=
self
.
GBKString2Hex
(
softwareVersionDate
)
#终端版本日期
CPUId
=
self
.
str2Hex
(
CPUId
)
#cpuId
GMSType
=
self
.
GBKString2Hex
(
GMSType
)
#GMS型号
GMS_IMEI
=
self
.
GBKString2Hex
(
GMS_IMEI
)
#GSM IMEI 号
SIM_IMSI
=
self
.
GBKString2Hex
(
SIM_IMSI
)
#终端 SIM 卡 IMSI 号
SIM_ICCID
=
self
.
GBKString2Hex
(
SIM_ICCID
)
#终端 SIM 卡 ICCID 号
carType
=
self
.
int2hexStringByBytes
(
carType
,
2
)
#车系车型 ID
VIN
=
self
.
GBKString2Hex
(
VIN
)
#汽车 VIN 码
totalMileage
=
self
.
int2hexStringByBytes
(
totalMileage
,
4
)
#装上终端后车辆累计总里程或车辆仪表里程(单位米)
totalOilExpend
=
self
.
int2hexStringByBytes
(
totalOilExpend
,
4
)
#装上终端后车辆累计总耗油量(ml)
msg
=
msg
+
softwareVersion
+
softwareVersionDate
+
CPUId
+
GMSType
+
GMS_IMEI
msg
=
msg
+
SIM_IMSI
+
SIM_ICCID
+
carType
+
VIN
+
totalMileage
msg
=
msg
+
totalOilExpend
return
msg
#######################################################
#######################################################
# 获取消息头
# 获取消息头
#######################################################
#######################################################
...
...
lib/socket/messageTest.py
View file @
f9458667
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
binascii
import
binascii
import
socket
import
socket
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
from
lib.protocol.message.Location_msg
import
Location_msg
from
lib.protocol.message.Location_msg
import
Location_msg
from
lib.protocol.message.TerminalAuthenticate_msg
import
TerminalAuthenticate_msg
from
lib.protocol.message.TerminalAuthenticate_msg
import
TerminalAuthenticate_msg
...
@@ -18,14 +19,14 @@ port = 9001
...
@@ -18,14 +19,14 @@ port = 9001
# msg = MessageBase().generateMsg()
# msg = MessageBase().generateMsg()
# msg = TerminalCommonMsgRes_msg().generateMsg() #终端通用应答
# msg = TerminalCommonMsgRes_msg().generateMsg() #终端通用应答
# msg = TerminalHeartbeat_msg().generateMsg() #终端心跳
# msg = TerminalHeartbeat_msg().generateMsg() #终端心跳
msg
=
TerminalRegister_msg
()
.
generateMsg
()
#终端注册
#
msg = TerminalRegister_msg().generateMsg() #终端注册
# msg = TerminalCancle_msg().generateMsg() #终端注销
# msg = TerminalCancle_msg().generateMsg() #终端注销
# msg = TerminalAuthenticate_msg().generateMsg() #终端鉴权
# msg = TerminalAuthenticate_msg().generateMsg() #终端鉴权
# msg = TerminalVersionInfo_msg().generateMsg() #终端版本信息上报
# msg = TerminalVersionInfo_msg().generateMsg() #终端版本信息上报
# 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
=
DataUpstreamTransport_msg
()
.
generateMsg
()
#数据上行透传消息
# msg = TerminalUpdataResult_msg().generateMsg() #终端升级结果通知
# msg = TerminalUpdataResult_msg().generateMsg() #终端升级结果通知
# msg = LocationDataBatchUpdate_msg().generateMsg() #定位数据批量上传
# msg = LocationDataBatchUpdate_msg().generateMsg() #定位数据批量上传
...
...
static/js/messageTools/messages.js
View file @
f9458667
...
@@ -8,6 +8,8 @@ function messageManTab(e){
...
@@ -8,6 +8,8 @@ function messageManTab(e){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/heartBeat_msg_page
"
);
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/heartBeat_msg_page
"
);
}
else
if
(
id
==
"
terminalRegister_msg
"
){
}
else
if
(
id
==
"
terminalRegister_msg
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/terminalRegister_msg_page
"
);
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/terminalRegister_msg_page
"
);
}
else
if
(
id
==
"
terminalVersionInfoUpload_msg
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/terminalVersionInfoUpload_msg_page
"
);
}
else
{
}
else
{
alert
(
id
)
alert
(
id
)
}
}
...
...
templates/messageTools/message/heartBeat_msg_page.html
View file @
f9458667
...
@@ -23,12 +23,18 @@
...
@@ -23,12 +23,18 @@
margin-top
:
5px
;
margin-top
:
5px
;
float
:
left
;
float
:
left
;
}
}
.protocol_content
label
{
width
:
90px
;
text-align
:
right
;
}
</style>
</style>
<div
id=
"container2"
style=
"width:83%;min-height:750px;float:left;_background:grey;margin-top:50px;"
>
<div
id=
"container2"
style=
"width:83%;min-height:750px;float:left;_background:grey;margin-top:50px;"
>
{% block content_02 %}
{% block content_02 %}
<ul
class=
"nav nav-pills"
style=
"font-size:14px;"
>
<ul
class=
"nav nav-pills"
style=
"font-size:14px;"
>
<li
role=
"presentation"
><a
id=
"terminalHeartBeat_msg"
{%
if
arg.path[2]=
="heartBeat_msg_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"messageManTab(this)"
>
心跳消息
</b></a></li>
<li
role=
"presentation"
><a
id=
"terminalHeartBeat_msg"
{%
if
arg.path[2]=
="heartBeat_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=
"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=
"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/terminalVersionInfoUpload_msg_page.html
0 → 100644
View file @
f9458667
{% extends "messageTools/message/heartBeat_msg_page.html" %}
{% block title %}terminalVersionInfoUpload_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=
"0205"
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
style=
"word-break:break-all;font-size:12px;"
>
软件版本号:
</label><input
id=
"softwareVersion"
type=
"text"
class=
"form-control"
value=
"KZP200_V201001"
></li>
<li><label
style=
"word-break:break-all;font-size:12px;"
>
终端版本日期:
</label><input
id=
"softwareVersionDate"
type=
"text"
class=
"form-control"
value=
"2020-02-10"
></li>
<li><label>
cpuId:
</label><input
id=
"CPUId"
type=
"text"
class=
"form-control"
value=
"CPU-12345678"
></li>
<li><label>
GMS型号:
</label><input
id=
"GMSType"
type=
"text"
class=
"form-control"
value=
"GMS-TYPE-123456"
></li>
<li><label
style=
"word-break:break-all;font-size:12px;"
>
GSM IMEI号:
</label><input
id=
"GMS_IMEI"
type=
"text"
class=
"form-control"
value=
"GMS_IMEI_123456"
></li>
<li><label
style=
"word-break:break-all;font-size:12px;"
>
终端 SIM卡IMSI 号:
</label><input
id=
"SIM_IMSI"
type=
"text"
class=
"form-control"
value=
"SIM_13146201119"
></li>
<li><label
style=
"word-break:break-all;font-size:12px;"
>
终端 SIM卡ICCID号:
</label><input
id=
"SIM_ICCID"
type=
"text"
class=
"form-control"
value=
"SIM_ICCID13146201119"
></li>
<li><label
style=
"word-break:break-all;font-size:12px;"
>
车系车型ID:
</label><input
id=
"carType"
type=
"text"
class=
"form-control"
value=
"22"
></li>
<li><label
style=
"word-break:break-all;font-size:12px;"
>
汽车VIN码:
</label><input
id=
"VIN"
type=
"text"
class=
"form-control"
value=
"VIN_1234567891234"
></li>
<li><label
style=
"word-break:break-all;font-size:12px;"
>
装上终端后车辆累计总里程:
</label><input
id=
"totalMileage"
type=
"text"
class=
"form-control"
value=
"389000"
></li>
<li><label
style=
"word-break:break-all;font-size:12px;"
>
装上终端后车辆累计总耗油:
</label><input
id=
"totalOilExpend"
type=
"text"
class=
"form-control"
value=
"420000"
></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
softwareVersion
=
$
(
"
#softwareVersion
"
).
val
();
var
softwareVersionDate
=
$
(
"
#softwareVersionDate
"
).
val
();
var
CPUId
=
$
(
"
#CPUId
"
).
val
();
var
GMSType
=
$
(
"
#GMSType
"
).
val
();
var
GMS_IMEI
=
$
(
"
#GMS_IMEI
"
).
val
();
var
SIM_IMSI
=
$
(
"
#SIM_IMSI
"
).
val
();
var
SIM_ICCID
=
$
(
"
#SIM_ICCID
"
).
val
();
var
carType
=
$
(
"
#carType
"
).
val
();
var
VIN
=
$
(
"
#VIN
"
).
val
();
var
totalMileage
=
$
(
"
#totalMileage
"
).
val
();
var
totalOilExpend
=
$
(
"
#totalOilExpend
"
).
val
();
var
data
=
{};
data
[
"
msgID
"
]
=
msgID
;
data
[
"
phoneNum
"
]
=
phoneNum
;
data
[
"
msgWaterCode
"
]
=
msgWaterCode
;
data
[
"
encryptionType
"
]
=
encryptionType
;
data
[
"
subPkg
"
]
=
subPkg
;
data
[
"
pkgCounts
"
]
=
pkgCounts
;
data
[
"
softwareVersion
"
]
=
softwareVersion
;
data
[
"
softwareVersionDate
"
]
=
softwareVersionDate
;
data
[
"
CPUId
"
]
=
CPUId
;
data
[
"
GMSType
"
]
=
GMSType
;
data
[
"
GMS_IMEI
"
]
=
GMS_IMEI
;
data
[
"
SIM_IMSI
"
]
=
SIM_IMSI
;
data
[
"
SIM_ICCID
"
]
=
SIM_ICCID
;
data
[
"
carType
"
]
=
carType
;
data
[
"
VIN
"
]
=
VIN
;
data
[
"
totalMileage
"
]
=
totalMileage
;
data
[
"
totalOilExpend
"
]
=
totalOilExpend
;
var
host
=
window
.
location
.
host
;
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/messageTools/message_process/porcessTerminalVersionInfoUploadMsg
"
,
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_process.py
View file @
f9458667
...
@@ -5,6 +5,8 @@ from configparser import ConfigParser
...
@@ -5,6 +5,8 @@ from configparser import ConfigParser
from
lib.protocol.message.TerminalHeartbeat_msg
import
TerminalHeartbeat_msg
from
lib.protocol.message.TerminalHeartbeat_msg
import
TerminalHeartbeat_msg
from
lib.protocol.message.TerminalRegister_msg
import
TerminalRegister_msg
from
lib.protocol.message.TerminalRegister_msg
import
TerminalRegister_msg
from
lib.protocol.message.TerminalVersionInfo_msg
import
TerminalVersionInfo_msg
from
lib.protocol.messagePlateform.PlateformVersionInfo_res
import
PlatefromVersionInfo_res
from
lib.protocol.messagePlateform.PlatformCommon_res
import
PlatformCommon_res
from
lib.protocol.messagePlateform.PlatformCommon_res
import
PlatformCommon_res
from
lib.protocol.report.HeartBeatReport_protocol
import
HeartBeatReport_protocol
from
lib.protocol.report.HeartBeatReport_protocol
import
HeartBeatReport_protocol
...
@@ -106,4 +108,62 @@ def porcessTerminalRegisterMsg():
...
@@ -106,4 +108,62 @@ def porcessTerminalRegisterMsg():
traceback
.
print_exc
()
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 处理失败!"
data
[
"message"
]
=
"Error: 处理失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
##########################################
# 【接口类型】处理发送的终端版本主动上报消息
##########################################
@
message_process
.
route
(
"/porcessTerminalVersionInfoUploadMsg"
,
methods
=
[
'POST'
])
def
porcessTerminalVersionInfoUploadMsg
():
msgID
=
request
.
form
.
get
(
"msgID"
)
phoneNum
=
int
(
request
.
form
.
get
(
"phoneNum"
))
msgWaterCode
=
int
(
request
.
form
.
get
(
"msgWaterCode"
))
encryptionType
=
int
(
request
.
form
.
get
(
"encryptionType"
))
subPkg
=
int
(
request
.
form
.
get
(
"subPkg"
))
pkgCounts
=
int
(
request
.
form
.
get
(
"pkgCounts"
))
softwareVersion
=
request
.
form
.
get
(
"softwareVersion"
)
softwareVersionDate
=
request
.
form
.
get
(
"softwareVersionDate"
)
CPUId
=
request
.
form
.
get
(
"CPUId"
)
GMSType
=
request
.
form
.
get
(
"GMSType"
)
GMS_IMEI
=
request
.
form
.
get
(
"GMS_IMEI"
)
SIM_IMSI
=
request
.
form
.
get
(
"SIM_IMSI"
)
SIM_ICCID
=
request
.
form
.
get
(
"SIM_ICCID"
)
carType
=
int
(
request
.
form
.
get
(
"carType"
))
VIN
=
request
.
form
.
get
(
"VIN"
)
totalMileage
=
int
(
request
.
form
.
get
(
"totalMileage"
))
totalOilExpend
=
int
(
request
.
form
.
get
(
"totalOilExpend"
))
data
=
{}
if
(
msgID
==
None
or
phoneNum
==
None
or
msgWaterCode
==
None
or
encryptionType
==
None
or
subPkg
==
None
\
or
pkgCounts
==
None
or
softwareVersion
==
None
or
softwareVersionDate
==
None
or
CPUId
==
None
or
\
GMSType
==
None
or
GMS_IMEI
==
None
or
SIM_IMSI
==
None
or
SIM_ICCID
==
None
or
carType
==
None
\
or
VIN
==
None
or
totalMileage
==
None
or
totalOilExpend
==
None
):
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Info: 请检查是否传入了空数据!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
conf_R
=
ConfigParser
()
conf_R
.
read
(
"config/messageTools/messageTools.conf"
)
cliSocket
=
ClientSocket
(
conf_R
.
get
(
"socket"
,
"host"
),
conf_R
.
getint
(
"socket"
,
"port"
))
cliSocket
.
connect
()
terminalVersionInfoObj
=
TerminalVersionInfo_msg
()
msg
=
terminalVersionInfoObj
.
generateMsg_GUI
(
msgID
,
phoneNum
,
msgWaterCode
,
encryptionType
,
subPkg
,
softwareVersion
,
\
softwareVersionDate
,
CPUId
,
GMSType
,
GMS_IMEI
,
SIM_IMSI
,
SIM_ICCID
,
carType
,
VIN
,
\
totalMileage
,
totalOilExpend
)
cliSocket
.
send
(
msg
)
socRecv_1
=
cliSocket
.
receive
()
socRecv_2
=
str
(
socRecv_1
)
cliSocket
.
close
()
data
[
"status"
]
=
"200"
data
[
"message"
]
=
"Sucess: "
data
[
"original"
]
=
msg
data
[
"result"
]
=
socRecv_2
data
[
"parse"
]
=
PlatefromVersionInfo_res
(
socRecv_1
)
.
getMsg
()
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 处理失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
\ No newline at end of file
views/messageTools/message_view.py
View file @
f9458667
...
@@ -32,3 +32,17 @@ def terminalRegister_msg_page():
...
@@ -32,3 +32,17 @@ def terminalRegister_msg_page():
path
=
"messageTools/message/terminalRegister_msg_page.html"
path
=
"messageTools/message/terminalRegister_msg_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
(
'/terminalVersionInfoUpload_msg_page'
)
def
terminalVersionInfoUpload_msg_page
():
#获取请求的路劲
url
=
request
.
url
reqPath
=
re
.
findall
(
"http://(.*)$"
,
url
)[
0
]
reqPath
=
re
.
findall
(
"/(.*)$"
,
reqPath
)[
0
]
arg
=
{}
path
=
"messageTools/message/terminalVersionInfoUpload_msg_page.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
return
render_template
(
path
,
arg
=
arg
)
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