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
0d9b38ea
Commit
0d9b38ea
authored
Mar 02, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成数据上行透传消息图形操作界面
parent
df3a9adb
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1347 additions
and
39 deletions
+1347
-39
lib/multiThread/SendMultMsgThread.py
lib/multiThread/SendMultMsgThread.py
+24
-1
lib/protocol/message/DataUpstreamTransport_msg.py
lib/protocol/message/DataUpstreamTransport_msg.py
+158
-0
lib/protocol/message/Location_msg.py
lib/protocol/message/Location_msg.py
+2
-1
lib/protocol/message/MessageBase.py
lib/protocol/message/MessageBase.py
+77
-11
lib/protocol/message/TerminalHeartbeat_msg.py
lib/protocol/message/TerminalHeartbeat_msg.py
+19
-0
lib/protocol/message/TerminalRegister_msg.py
lib/protocol/message/TerminalRegister_msg.py
+36
-10
lib/protocol/message/TerminalVersionInfo_msg.py
lib/protocol/message/TerminalVersionInfo_msg.py
+32
-0
lib/protocol/messagePlateform/ResponseBase.py
lib/protocol/messagePlateform/ResponseBase.py
+12
-1
lib/protocol/reportPlateform/__init__.py
lib/protocol/reportPlateform/__init__.py
+0
-0
lib/socket/ClientSocket.py
lib/socket/ClientSocket.py
+0
-1
lib/socket/messageTest.py
lib/socket/messageTest.py
+22
-8
static/js/messageTools/messages.js
static/js/messageTools/messages.js
+2
-0
templates/messageTools/message/dataUpstreamTransport_msg_f2_page.html
...ssageTools/message/dataUpstreamTransport_msg_f2_page.html
+145
-0
templates/messageTools/message/dataUpstreamTransport_msg_f3_page.html
...ssageTools/message/dataUpstreamTransport_msg_f3_page.html
+122
-0
templates/messageTools/message/dataUpstreamTransport_msg_f4_page.html
...ssageTools/message/dataUpstreamTransport_msg_f4_page.html
+138
-0
templates/messageTools/message/dataUpstreamTransport_msg_page.html
.../messageTools/message/dataUpstreamTransport_msg_page.html
+215
-0
templates/messageTools/message/heartBeat_msg_page.html
templates/messageTools/message/heartBeat_msg_page.html
+1
-0
templates/messageTools/message/terminalRegister_msg_page.html
...lates/messageTools/message/terminalRegister_msg_page.html
+4
-1
views/messageTools/message_process.py
views/messageTools/message_process.py
+282
-5
views/messageTools/message_view.py
views/messageTools/message_view.py
+56
-0
No files found.
lib/multiThread/SendMultMsgThread.py
View file @
0d9b38ea
...
...
@@ -97,7 +97,14 @@ class SendMultMsgThread():
time
.
sleep
(
2
)
print
(
"平均响应时间:"
+
str
(
self
.
totalTime
/
self
.
threadCount
)
+
"毫秒"
)
print
(
"响应失败个数:"
+
str
(
self
.
failThreadCount
))
print
(
json
.
dumps
(
self
.
threadArr
))
self
.
writeToFile
(
"../../data/threadDetails.json"
,
self
.
threadArr
)
# print(json.dumps( self.threadArr))
def
writeToFile
(
self
,
path
,
data
):
with
open
(
path
,
"w"
,
encoding
=
'utf-8'
)
as
fi
:
json
.
dump
(
data
,
fi
)
# fi.write(data)
...
...
@@ -107,3 +114,19 @@ if __name__ == "__main__":
# t.setMsg("7e020001020131462011190001fffc7fff001c010401c0a6380659ad7a02090042003b200204185704310102EA6600010400000000000204001e7c1f0003050A0001f400000405020001d4c000050400057d0240000604000119400007040007530000100c0004006403f203f203f203f2001114ffffffffffffffffffff00200000000000000000001202002400130106001D0101EB7960C0020bb860D0013c62f00203216050014c60F0015860B001146330011c646001416490012060A00201146014010160100102610002022661100201f561F0020e746210040000119c6040012c60700200e660E00203206701010067020100670301016704024e20670502000067060200416707040000017d02097e")
t
.
startThread
()
lib/protocol/message/DataUpstreamTransport_msg.py
View file @
0d9b38ea
...
...
@@ -29,6 +29,19 @@ class DataUpstreamTransport_msg(MessageBase):
msg
=
msg
+
self
.
IDENTIFY
return
msg
# 生成一条完整的消息,针对图形界面,可传递参数
def
generateMsg_GUI
(
self
,
msgID
=
"0100"
,
phoneNum
=
"13146201119"
,
msgWaterCode
=
1
,
encryptionType
=
0
,
subPkg
=
0
,
msgType
=
"F3"
,
data
=
{
"infoTime"
:
"2020-02-06 11:31:56"
}):
msg
=
""
msgHeader
=
self
.
getMsgHeader_GUI
(
msgID
,
phoneNum
,
msgWaterCode
,
encryptionType
,
subPkg
)
msgBody
=
self
.
getMsgBody_GUI
(
msgType
,
data
)
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
#######################################################
# 获取消息体
#######################################################
...
...
@@ -52,6 +65,38 @@ class DataUpstreamTransport_msg(MessageBase):
msg
=
msgType
+
msgContent
return
msg
# 获取消息体,针对图形界面,可传递参数
def
getMsgBody_GUI
(
self
,
msgType
=
"F3"
,
data
=
{
"infoTime"
:
"2020-02-06 11:31:56"
}):
msg
=
""
# 透传消息类型
# 0xF1 驾驶行程数据(熄火发送)
# 0xF2 故障码数据(状态改变发送)
# 0xF3 休眠进入(进入休眠模式发送)
# 0xF4 休眠唤醒(退出休眠模式发送)
msgType
=
msgType
msgContent
=
""
if
msgType
==
"F1"
:
# 驾驶行程数据(熄火发送)
msgContent
=
self
.
getDrivingData_GUI
(
data
[
"time_1"
],
data
[
"time_2"
],
data
[
"fireLatitude"
],
data
[
"fireLongitude"
],
data
[
"unFireLatitude"
],
\
data
[
"unFireLongitude"
],
data
[
"drivingCircleLabel"
],
data
[
"drivingCircleTotalMileageType"
],
data
[
"drivingCircleTotalMileage"
],
\
data
[
"drivingCircleTotalOil"
],
data
[
"drivingCircleTotalTime"
],
data
[
"drivingCircleOverSpeedTotalTime"
],
\
data
[
"drivingCircleOverSpeedTotalTimes"
],
data
[
"drivingCircleAverageSpeed"
],
data
[
"drivingCircleMaxSpeed"
],
\
data
[
"drivingCircleIdlingTime"
],
data
[
"drivingCircleFootBrakeIsSupport"
],
data
[
"drivingCircleFootBrakeTatalTimes"
],
\
data
[
"drivingCircleRapidlyAccelerateTimes"
],
data
[
"drivingCircleSharpSlowdownTimes"
],
data
[
"drivingCircleSharpCurveTimes"
],
\
data
[
"speedIn20"
],
data
[
"speedIn20_40"
],
data
[
"speedIn40_60"
],
data
[
"speedIn60_80"
],
data
[
"speedIn80_100"
],
data
[
"speedIn100_120"
],
\
data
[
"speedOut120"
],
data
[
"rapidlyAccelerateTimes"
],
data
[
"rapidlySharpSlowdownTimes"
],
data
[
"sharpCurveTimes"
])
elif
msgType
==
"F2"
:
# 故障码数据(状态改变发送)
msgContent
=
self
.
getTroubleCodeData_GUI
(
data
[
"infoTime"
],
data
[
"latitude"
],
data
[
"longitude"
],
data
[
"troubleCodeNums"
])
elif
msgType
==
"F3"
:
# 休眠进入(进入休眠模式发送)
msgContent
=
self
.
getIntoSleepData_GUI
(
data
[
"infoTime"
])
elif
msgType
==
"F4"
:
# 休眠唤醒(退出休眠模式发送)
msgContent
=
self
.
getOutSleepData_GUI
(
data
[
"infoTime"
],
data
[
"outSleepType"
],
data
[
"carVoltage"
],
data
[
"vibrateOutSleepSpeedUpVal"
])
msg
=
msgType
+
msgContent
return
msg
#######################################################
# 获取消息头
#######################################################
...
...
@@ -158,6 +203,81 @@ class DataUpstreamTransport_msg(MessageBase):
data
=
data
+
sharpCurveTimes
return
data
# 获取驾驶行程数据,针对图形界面,可传递参数
def
getDrivingData_GUI
(
self
,
time_1
=
"2020-02-05 22:07:30"
,
time_2
=
"2020-02-08 22:07:30"
,
fireLatitude
=
29.40268
,
fireLongitude
=
106.54041
,
\
unFireLatitude
=
29.40268
,
unFireLongitude
=
106.54041
,
drivingCircleLabel
=
123
,
drivingCircleTotalMileageType
=
"01"
,
\
drivingCircleTotalMileage
=
38090
,
drivingCircleTotalOil
=
75400
,
drivingCircleTotalTime
=
726000
,
\
drivingCircleOverSpeedTotalTime
=
54000
,
drivingCircleOverSpeedTotalTimes
=
101
,
drivingCircleAverageSpeed
=
65
,
\
drivingCircleMaxSpeed
=
123
,
drivingCircleIdlingTime
=
12600000
,
drivingCircleFootBrakeIsSupport
=
1
,
\
drivingCircleFootBrakeTatalTimes
=
32
,
drivingCircleRapidlyAccelerateTimes
=
79
,
drivingCircleSharpSlowdownTimes
=
10
,
\
drivingCircleSharpCurveTimes
=
33
,
speedIn20
=
1068
,
speedIn20_40
=
2020
,
speedIn40_60
=
30400
,
speedIn60_80
=
37000
,
\
speedIn80_100
=
10400
,
speedIn100_120
=
5000
,
speedOut120
=
3200
,
rapidlyAccelerateTimes
=
3000
,
\
rapidlySharpSlowdownTimes
=
3507
,
sharpCurveTimes
=
580
):
time_1
=
"0001"
+
self
.
int2hexStringByBytes
(
6
)
+
self
.
getBCDTime
(
time_1
)
time_2
=
"0002"
+
self
.
int2hexStringByBytes
(
6
)
+
self
.
getBCDTime
(
time_2
)
fireLatitude
=
"0003"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
getFireLatitude
(
fireLatitude
)
#点火纬度
fireLongitude
=
"0004"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
getFireLongitude
(
fireLongitude
)
#点火经度
unFireLatitude
=
"0005"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
getUnFireLatitude
(
unFireLatitude
)
#熄火纬度
unFireLongitude
=
"0006"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
getUnFireLongitude
(
unFireLongitude
)
# 熄火经度
drivingCircleLabel
=
"0007"
+
self
.
int2hexStringByBytes
(
2
)
+
self
.
int2hexStringByBytes
(
drivingCircleLabel
,
2
)
#驾驶循环标签
#一个驾驶循环总里程类型:
drivingCircleTotalMileageType
=
"0008"
+
self
.
int2hexStringByBytes
(
1
)
+
drivingCircleTotalMileageType
#一个驾驶循环总里程,单位米
drivingCircleTotalMileage
=
"0009"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
drivingCircleTotalMileage
,
4
)
#一个驾驶循环总耗油,单位毫升(ml)
drivingCircleTotalOil
=
"000A"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
drivingCircleTotalOil
,
4
)
#一个驾驶循环总时长,单位秒
drivingCircleTotalTime
=
"000B"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
drivingCircleTotalTime
,
4
)
#一个驾驶循环超速累计时长,单位秒
drivingCircleOverSpeedTotalTime
=
"000C"
+
self
.
int2hexStringByBytes
(
2
)
+
self
.
int2hexStringByBytes
(
drivingCircleOverSpeedTotalTime
,
2
)
#一个驾驶循环超速次数,单位次
drivingCircleOverSpeedTotalTimes
=
"000D"
+
self
.
int2hexStringByBytes
(
2
)
+
self
.
int2hexStringByBytes
(
drivingCircleOverSpeedTotalTimes
,
2
)
#一个驾驶循环平均车速,单位 KM/H
drivingCircleAverageSpeed
=
"000E"
+
self
.
int2hexStringByBytes
(
1
)
+
self
.
int2hexStringByBytes
(
drivingCircleAverageSpeed
)
#一个驾驶循环最大车速,单位 KM/H
drivingCircleMaxSpeed
=
"000F"
+
self
.
int2hexStringByBytes
(
1
)
+
self
.
int2hexStringByBytes
(
drivingCircleMaxSpeed
)
#一个驾驶循环怠速时长,单位秒
drivingCircleIdlingTime
=
"0010"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
drivingCircleIdlingTime
,
4
)
#一个驾驶循环脚刹次数支持与否,1 为支持
drivingCircleFootBrakeIsSupport
=
"0011"
+
self
.
int2hexStringByBytes
(
1
)
+
self
.
int2hexStringByBytes
(
drivingCircleFootBrakeIsSupport
)
#一个驾驶循环脚刹总次数,单位次
drivingCircleFootBrakeTatalTimes
=
"0012"
+
self
.
int2hexStringByBytes
(
1
)
+
self
.
int2hexStringByBytes
(
drivingCircleFootBrakeTatalTimes
,
2
)
#一个驾驶循环急加速次数
drivingCircleRapidlyAccelerateTimes
=
"0013"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
drivingCircleRapidlyAccelerateTimes
,
4
)
#一个驾驶循环急减速次数
drivingCircleSharpSlowdownTimes
=
"0014"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
drivingCircleSharpSlowdownTimes
,
4
)
#一个驾驶循环急转弯次数
drivingCircleSharpCurveTimes
=
"0015"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
drivingCircleSharpCurveTimes
,
4
)
#速度为-20Km/H 的里程,单位:m
speedIn20
=
"0016"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
speedIn20
,
4
)
#速度为 20-40Km/H 的里程,单位:m
speedIn20_40
=
"0017"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
speedIn20_40
,
4
)
#速度为 40-60Km/H 的里程,单位:m
speedIn40_60
=
"0018"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
speedIn40_60
,
4
)
#速度为 60-80Km/H 的里程,单位:m
speedIn60_80
=
"0019"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
speedIn60_80
,
4
)
#速度为 80-100Km/H 的里程,单位:m
speedIn80_100
=
"001A"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
speedIn80_100
,
4
)
#速度为 100-120Km/H 的里程,单位:m
speedIn100_120
=
"001B"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
speedIn100_120
,
4
)
#速度为 120Km/H 以上的里程,单位:m
speedOut120
=
"001C"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
speedOut120
,
4
)
#急加速总次数
rapidlyAccelerateTimes
=
"001D"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
rapidlyAccelerateTimes
,
4
)
#急减速总次数
rapidlySharpSlowdownTimes
=
"001E"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
rapidlySharpSlowdownTimes
,
4
)
#急转弯总次数
sharpCurveTimes
=
"001F"
+
self
.
int2hexStringByBytes
(
4
)
+
self
.
int2hexStringByBytes
(
sharpCurveTimes
,
4
)
data
=
time_1
+
time_2
+
fireLatitude
+
fireLongitude
+
unFireLatitude
data
=
data
+
unFireLongitude
+
drivingCircleLabel
+
drivingCircleTotalMileageType
+
drivingCircleTotalMileage
+
drivingCircleTotalOil
data
=
data
+
drivingCircleTotalTime
+
drivingCircleOverSpeedTotalTime
+
drivingCircleOverSpeedTotalTimes
+
drivingCircleAverageSpeed
+
drivingCircleMaxSpeed
data
=
data
+
drivingCircleIdlingTime
+
drivingCircleFootBrakeIsSupport
+
drivingCircleFootBrakeTatalTimes
+
drivingCircleRapidlyAccelerateTimes
+
drivingCircleSharpSlowdownTimes
data
=
data
+
drivingCircleSharpCurveTimes
+
speedIn20
+
speedIn20_40
+
speedIn40_60
+
speedIn60_80
data
=
data
+
speedIn80_100
+
speedIn100_120
+
speedOut120
+
rapidlyAccelerateTimes
+
rapidlySharpSlowdownTimes
data
=
data
+
sharpCurveTimes
return
data
#######################################################
# 获取点火纬度,单位:0.000001 度,Bit31=0/1 北纬/南纬
...
...
@@ -217,6 +337,23 @@ class DataUpstreamTransport_msg(MessageBase):
troubleCode
=
troubleCode
+
self
.
int2hexStringByBytes
(
i
,
4
)
data
=
infoTime
+
latitude
+
longitude
+
troubleCodeNumsHex
+
troubleCode
return
data
# 获取故障码数据,针对图形界面,可传递参数
def
getTroubleCodeData_GUI
(
self
,
infoTime
=
"2020-02-06 11:31:56"
,
latitude
=
29.40268
,
longitude
=
106.54041
,
troubleCodeNums
=
3
):
infoTime
=
self
.
getBCDTime
(
infoTime
)
#单位:0.000001 度,Bit31=0/1 北纬/南纬
latitude
=
self
.
getLatitude
(
latitude
)
#单位:0.000001 度,Bit31=0/1 东经/西经
longitude
=
self
.
getLongitude
(
longitude
)
#为 0 表示无故障码,非 0 为故障码个数
troubleCodeNums
=
troubleCodeNums
troubleCodeNumsHex
=
self
.
int2hexStringByBytes
(
troubleCodeNums
)
#故障码
troubleCode
=
""
for
i
in
range
(
0
,
troubleCodeNums
):
troubleCode
=
troubleCode
+
self
.
int2hexStringByBytes
(
i
,
4
)
data
=
infoTime
+
latitude
+
longitude
+
troubleCodeNumsHex
+
troubleCode
return
data
#获取维度
def
getLatitude
(
self
,
data
=
29.40268
):
orientation
=
0
#0:北纬 1:南纬 (2147483648)
...
...
@@ -239,6 +376,11 @@ class DataUpstreamTransport_msg(MessageBase):
infoTime
=
self
.
getBCDTime
(
"2020-02-06 11:31:56"
)
msg
=
infoTime
return
msg
# 获取进入休眠数据包,针对图形界面,可传递参数
def
getIntoSleepData_GUI
(
self
,
infoTime
=
"2020-02-06 11:31:56"
):
infoTime
=
self
.
getBCDTime
(
infoTime
)
msg
=
infoTime
return
msg
#######################################################
# 获取休眠唤醒数据包
...
...
@@ -259,6 +401,22 @@ class DataUpstreamTransport_msg(MessageBase):
data
=
infoTime
+
outSleepType
+
carVoltage
+
vibrateOutSleepSpeedUpVal
return
data
#获取休眠唤醒数据包,针对图形界面,可传递参数
def
getOutSleepData_GUI
(
self
,
infoTime
=
"2020-02-06 11:31:56"
,
outSleepType
=
"01"
,
carVoltage
=
360
,
vibrateOutSleepSpeedUpVal
=
3700
):
infoTime
=
self
.
getBCDTime
(
infoTime
)
#休眠唤醒类型
# 0x01:休眠定时唤醒
# 0x02:CAN1
# 0x04:CAN2
# 0x08:gSensor 0x10:电压变
outSleepType
=
outSleepType
#车辆电压,单位 0.1V
carVoltage
=
self
.
int2hexStringByBytes
(
carVoltage
,
2
)
#振动唤醒加速度值,单位 mg
vibrateOutSleepSpeedUpVal
=
self
.
int2hexStringByBytes
(
vibrateOutSleepSpeedUpVal
,
2
)
data
=
infoTime
+
outSleepType
+
carVoltage
+
vibrateOutSleepSpeedUpVal
return
data
...
...
lib/protocol/message/Location_msg.py
View file @
0d9b38ea
...
...
@@ -96,7 +96,8 @@ class Location_msg(MessageBase):
extra_FA
=
"FA"
+
self
.
int2hexStringByBytes
(
int
(
len
(
AlarmEvent_data
()
.
generateAlarmEvent_data
())
/
2
))
+
AlarmEvent_data
()
.
generateAlarmEvent_data
()
# data = extra_01 + extra_02 + extra_11 + extra_31 + extra_EA + extra_EB + extra_FA
data
=
extra_31
+
extra_EA
+
extra_EB
print
(
extra_11
)
data
=
extra_11
+
extra_31
+
extra_EA
+
extra_EB
# data = extra_01 + extra_02 + extra_11 + extra_12 + extra_13
# data = data + extra_2A + extra_30 + extra_31 + extra_EA + extra_EB
...
...
lib/protocol/message/MessageBase.py
View file @
0d9b38ea
#encoding:utf-8
import
datetime
import
random
import
time
from
lib.protocol.Base
import
Base
...
...
@@ -89,8 +91,8 @@ class MessageBase(Base):
pkgNumsHex
=
""
for
i
in
range
(
0
,
pkgCounts
):
pkgNum
=
i
pkgNum
Hex
=
self
.
int2hexStringByBytes
(
pkgNum
,
2
)
pkgNumsHex
=
pkgNumsHex
+
pkgNum
Hex
data
Hex
=
self
.
int2hexStringByBytes
(
pkgNum
,
2
)
pkgNumsHex
=
pkgNumsHex
+
data
Hex
msgPackage
=
pkgCountsHex
+
pkgNumsHex
return
msgPackage
...
...
@@ -119,8 +121,21 @@ class MessageBase(Base):
# 替换消息中的7e7d字符
#######################################################
def
replace7e7d
(
self
,
data
):
data
=
data
.
replace
(
"7d"
,
"7d01"
)
data
=
data
.
replace
(
"7e"
,
"7d02"
)
# data = data.replace("7d","7d01")
# data = data.replace("7e","7d02")
tmpR
=
data
tmp
=
tmpR
[
0
:
2
]
tmpR
=
tmpR
[
2
:]
data
=
""
while
tmpR
!=
""
:
if
tmp
==
"7d"
:
tmp
=
"7d01"
elif
tmp
==
"7e"
:
tmp
=
"7d02"
data
=
data
+
tmp
tmp
=
tmpR
[
0
:
2
]
tmpR
=
tmpR
[
2
:]
return
data
#######################################################
...
...
@@ -210,9 +225,57 @@ class MessageBase(Base):
data
=
data
.
decode
(
"gbk"
)
return
data
#######################################################
# 获取一个随机数
#######################################################
def
getRandomNum
(
self
,
s
=
1
,
e
=
1
,
intArr
=
[],
mult
=
0
):
if
intArr
==
[]:
data
=
random
.
randint
(
s
,
e
)
else
:
if
mult
==
0
:
data
=
int
(
random
.
choice
(
intArr
))
else
:
if
len
(
intArr
)
<
mult
:
raise
RuntimeError
(
'个数超过数组长度!'
)
temp
=
[]
data
=
0
for
i
in
range
(
0
,
mult
):
num
=
int
(
random
.
choice
(
intArr
))
while
num
in
temp
:
num
=
int
(
random
.
choice
(
intArr
))
temp
.
append
(
num
)
data
=
data
+
num
return
data
#######################################################
# 获取一个随机字符串
#######################################################
def
getRandomStr
(
self
,
counts
,
strs
=
""
):
if
strs
==
""
:
data
=
random
.
sample
(
"0123456789abcdefghijkmlnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"
,
counts
)
else
:
data
=
[]
for
s
in
range
(
0
,
counts
):
data
.
append
(
random
.
choice
(
strs
))
temp
=
""
for
ch
in
data
:
temp
=
temp
+
ch
return
temp
#######################################################
# 获取随机时间
# type:0、获取年月日时分秒 1、获取年月日 2、获取时分秒
#######################################################
def
getRandomDate
(
self
,
s
=
631123200
,
e
=
1577808000
,
type
=
0
):
timeStamp
=
random
.
randint
(
s
,
e
)
timeArray
=
time
.
localtime
(
timeStamp
)
if
type
==
0
:
theTime
=
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
,
timeArray
)
elif
type
==
1
:
theTime
=
time
.
strftime
(
"
%
Y-
%
m-
%
d"
,
timeArray
)
elif
type
==
2
:
theTime
=
time
.
strftime
(
"
%
H:
%
M:
%
S"
,
timeArray
)
return
theTime
...
...
@@ -222,15 +285,18 @@ if __name__ == "__main__":
# print(MessageBase().int2hexStringByBytes(220400566542345564784802,20))
# print(MessageBase().str2Hex("a865h643gfdj64fd7432"))
# print(MessageBase().hex2Str("61383635683634336766646a3634666437343332"))
print
(
MessageBase
()
.
GBKString2Hex
(
"KZP200_V201001"
))
print
(
MessageBase
()
.
hex2GBKString
(
"4b5a503230305f56323031303031"
))
#
print(MessageBase().GBKString2Hex("KZP200_V201001"))
#
print(MessageBase().hex2GBKString("4b5a503230305f56323031303031"))
# print(MessageBase().str2Hex("\xd3\xe5B23CX"))
# print(MessageBase().getMsgBodyProperty())
# print(MessageBase().int2BCD(13146201117))
# print(MessageBase().getCheckCode("8001000501314620111800000000000200"))
# print(MessageBase().getMsgHeader())
# print(MessageBase().generateMsg())
print
(
MessageBase
()
.
GBKString2Hex
(
"渝B23CX"
))
print
(
MessageBase
()
.
hex2GBKString
(
"5c7864335c7865354232334358"
))
print
(
MessageBase
()
.
int2BCD
(
123456789012345
,
10
))
# print(MessageBase().GBKString2Hex("渝B23CX"))
# print(MessageBase().hex2GBKString("5c7864335c7865354232334358"))
# print(MessageBase().int2BCD(123456789012345,10))
# print(MessageBase().getRandomNum(3000,5000,[2,4,6,8,10,12],4))
# print(MessageBase().getRandomStr(10))
print
(
MessageBase
()
.
replace7e7d
(
"807d007e01314620111800000000000200"
))
print
(
MessageBase
()
.
replace7e7d
(
"87d107e501314620111800000000000200"
))
lib/protocol/message/TerminalHeartbeat_msg.py
View file @
0d9b38ea
...
...
@@ -39,6 +39,25 @@ class TerminalHeartbeat_msg(MessageBase):
msg
=
msg
+
self
.
IDENTIFY
return
msg
# 生成一条完整的消息,数据随机产生
def
generateMsg_random
(
self
):
msgID
=
"0002"
phoneNum
=
self
.
getRandomStr
(
11
,
"0123456789"
)
msgWaterCode
=
self
.
getRandomNum
(
1
,
65535
)
encryptionType
=
0
subPkg
=
self
.
getRandomNum
(
intArr
=
[
0
,
8192
],
mult
=
1
)
msg
=
""
msgHeader
=
self
.
getMsgHeader_GUI
(
msgID
,
phoneNum
,
msgWaterCode
,
encryptionType
,
subPkg
)
msgBody
=
self
.
getMsgBody
()
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
#######################################################
# 获取消息体
#######################################################
...
...
lib/protocol/message/TerminalRegister_msg.py
View file @
0d9b38ea
...
...
@@ -27,12 +27,38 @@ class TerminalRegister_msg(MessageBase):
return
msg
# 生成一条完整的消息,针对图形界面,可传递参数
def
generateMsg_GUI
(
self
,
msgID
=
"0100"
,
phoneNum
=
"13146201119"
,
msgWaterCode
=
1
,
encryptionType
=
0
,
subPkg
=
0
,
provinceId
=
103
,
\
manufacturerId
=
"11010"
,
terminalType
=
"a865h643gfdj64fd7432"
,
terminalId
=
"H6uyt08"
,
\
def
generateMsg_GUI
(
self
,
msgID
=
"0100"
,
phoneNum
=
"13146201119"
,
msgWaterCode
=
1
,
encryptionType
=
0
,
subPkg
=
0
,
provinceId
=
50
,
\
countyId
=
103
,
manufacturerId
=
"11010"
,
terminalType
=
"a865h643gfdj64fd7432"
,
terminalId
=
"H6uyt08"
,
\
licencePlateColor
=
1
,
carSign
=
"渝B23CX"
):
msg
=
""
msgHeader
=
self
.
getMsgHeader_GUI
(
msgID
,
phoneNum
,
msgWaterCode
,
encryptionType
,
subPkg
)
msgBody
=
self
.
getMsgBody_GUI
(
provinceId
,
manufacturerId
,
terminalType
,
terminalId
,
licencePlateColor
,
carSign
)
msgBody
=
self
.
getMsgBody_GUI
(
provinceId
,
countyId
,
manufacturerId
,
terminalType
,
terminalId
,
licencePlateColor
,
carSign
)
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
# 生成一条完整的消息,数据随机产生
def
generateMsg_random
(
self
):
msgID
=
"0100"
phoneNum
=
self
.
getRandomStr
(
11
,
"0123456789"
)
msgWaterCode
=
self
.
getRandomNum
(
1
,
65535
)
encryptionType
=
0
subPkg
=
self
.
getRandomNum
(
intArr
=
[
0
,
8192
])
provinceId
=
self
.
getRandomNum
(
10
,
99
)
countyId
=
self
.
getRandomNum
(
100
,
990
)
manufacturerId
=
self
.
getRandomStr
(
5
,
"0123456789"
)
terminalType
=
self
.
getRandomStr
(
20
)
terminalId
=
self
.
getRandomStr
(
7
)
licencePlateColor
=
self
.
getRandomNum
(
intArr
=
[
1
,
2
,
3
,
4
,
9
])
carSign
=
self
.
getRandomStr
(
5
)
msg
=
""
msgHeader
=
self
.
getMsgHeader_GUI
(
msgID
,
phoneNum
,
msgWaterCode
,
encryptionType
,
subPkg
)
msgBody
=
self
.
getMsgBody_GUI
(
provinceId
,
countyId
,
manufacturerId
,
terminalType
,
terminalId
,
licencePlateColor
,
carSign
)
checkCode
=
self
.
getCheckCode
(
msgHeader
+
msgBody
)
msg
=
msg
+
self
.
IDENTIFY
info
=
msgHeader
+
msgBody
+
checkCode
...
...
@@ -48,7 +74,7 @@ class TerminalRegister_msg(MessageBase):
msg
=
""
# msgNums = self.int2hexStringByBytes(1,2)
# msgNumber = self.int2hexStringByBytes(1,2)
#
市县
域 ID (标示终端安装车辆所在的省域,0 保留,由平台取默认值。省 域 ID 采用 GB/T 2260 中规定的行政区划代 码六位中前两)
#
省
域 ID (标示终端安装车辆所在的省域,0 保留,由平台取默认值。省 域 ID 采用 GB/T 2260 中规定的行政区划代 码六位中前两)
provinceId
=
self
.
int2hexStringByBytes
(
50
,
2
)
#市县域 ID
countyId
=
self
.
int2hexStringByBytes
(
103
,
2
)
...
...
@@ -67,13 +93,15 @@ class TerminalRegister_msg(MessageBase):
return
msg
# 获取消息体,针对图形界面,可传递参数
def
getMsgBody_GUI
(
self
,
provinceId
=
"0103"
,
manufacturerId
=
"11010"
,
terminalType
=
"a865h643gfdj64fd7432"
,
terminalId
=
"H6uyt08"
,
\
def
getMsgBody_GUI
(
self
,
provinceId
=
50
,
countyId
=
103
,
manufacturerId
=
"11010"
,
terminalType
=
"a865h643gfdj64fd7432"
,
terminalId
=
"H6uyt08"
,
\
licencePlateColor
=
1
,
carSign
=
"渝B23CX"
):
msg
=
""
# msgNums = self.int2hexStringByBytes(1,2)
# msgNumber = self.int2hexStringByBytes(1,2)
#
市县
域 ID (标示终端安装车辆所在的省域,0 保留,由平台取默认值。省 域 ID 采用 GB/T 2260 中规定的行政区划代 码六位中前两)
#
省
域 ID (标示终端安装车辆所在的省域,0 保留,由平台取默认值。省 域 ID 采用 GB/T 2260 中规定的行政区划代 码六位中前两)
provinceId
=
self
.
int2hexStringByBytes
(
provinceId
,
2
)
# 市县域 ID
countyId
=
self
.
int2hexStringByBytes
(
countyId
,
2
)
#制造商 ID (5 个字节,终端制造商编码)
manufacturerId
=
self
.
str2Hex
(
manufacturerId
)
#终端型号 (20 个字节,此终端型号由制造商自行定义,位数不足时,后 补“0X00”。)
...
...
@@ -83,11 +111,9 @@ class TerminalRegister_msg(MessageBase):
#车牌颜色 (车牌颜色,按照 JT/T415-2006 的 5.4.12。未上牌时,取值 为 0) 1:蓝色 2:黄色 3:黑色 4:白色 9:其他
licencePlateColor
=
self
.
int2hexStringByBytes
(
licencePlateColor
)
#车辆标识 (车牌颜色为 0 时,表示车辆 VIN;否则,表示公安交通管理 部门颁发的机动车号牌)
carSign
=
str
(
carSign
.
encode
(
"gbk"
))
carSign
=
carSign
[
2
:
len
(
carSign
)
-
1
]
carSign
=
self
.
str2Hex
(
carSign
)
carSign
=
self
.
GBKString2Hex
(
carSign
)
# msg = msg + msgNums + msgNumber
msg
=
msg
+
provinceId
+
manufacturerId
+
terminalType
+
terminalId
+
licencePlateColor
+
carSign
msg
=
msg
+
provinceId
+
countyId
+
manufacturerId
+
terminalType
+
terminalId
+
licencePlateColor
+
carSign
return
msg
#######################################################
...
...
lib/protocol/message/TerminalVersionInfo_msg.py
View file @
0d9b38ea
...
...
@@ -44,6 +44,38 @@ class TerminalVersionInfo_msg(MessageBase):
msg
=
msg
+
self
.
IDENTIFY
return
msg
# 生成一条完整的消息,数据随机产生
def
generateMsg_random
(
self
):
msgID
=
"0205"
phoneNum
=
self
.
getRandomStr
(
11
,
"0123456789"
)
msgWaterCode
=
self
.
getRandomNum
(
1
,
65535
)
encryptionType
=
0
subPkg
=
self
.
getRandomNum
(
intArr
=
[
0
,
8192
])
softwareVersion
=
"KZP200_"
+
self
.
getRandomStr
(
7
)
softwareVersionDate
=
self
.
getRandomDate
(
type
=
1
)
CPUId
=
"CPU-"
+
self
.
getRandomStr
(
8
,
"0123456789"
)
GMSType
=
"GMS-TYPE-"
+
self
.
getRandomStr
(
6
,
"0123456789"
)
GMS_IMEI
=
"GMS_IMEI_"
+
self
.
getRandomStr
(
6
,
"0123456789"
)
SIM_IMSI
=
"SIM_"
+
self
.
getRandomStr
(
11
,
"0123456789"
)
SIM_ICCID
=
"SIM_ICCID"
+
self
.
getRandomStr
(
11
,
"0123456789"
)
carType
=
self
.
getRandomNum
(
0
,
65535
)
VIN
=
"VIN_"
+
self
.
getRandomStr
(
13
,
"0123456789"
)
totalMileage
=
self
.
getRandomNum
(
30000
,
6000000
)
totalOilExpend
=
self
.
getRandomNum
(
30000
,
6000000
)
msg
=
""
msgHeader
=
self
.
getMsgHeader_GUI
(
msgID
,
phoneNum
,
msgWaterCode
,
encryptionType
,
subPkg
)
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
#######################################################
# 获取消息体
#######################################################
...
...
lib/protocol/messagePlateform/ResponseBase.py
View file @
0d9b38ea
...
...
@@ -74,10 +74,21 @@ class ResponseBase(Base):
theTime
=
theTime
+
":"
+
data
[
10
:]
return
theTime
#######################################################
# 通过原始数据,获取消息id
#######################################################
def
getMsgId
(
self
,
data
):
data
=
self
.
removeIdentify
(
data
)
data
=
self
.
restore_7e7d
(
data
)
header
=
data
[:
24
]
msgId
=
header
[:
4
]
# 消息id
return
msgId
if
__name__
==
"__main__"
:
print
(
ResponseBase
()
.
int2binStr
(
7
,
2
))
\ No newline at end of file
# print(ResponseBase().int2binStr(7,2))
print
(
ResponseBase
()
.
getMsgId
(
"7e0002000001314620111800065b7e"
))
print
(
ResponseBase
()
.
getMsgId
(
"7e80010005013146201118e1480006000200767e"
))
\ No newline at end of file
lib/protocol/reportPlateform/__init__.py
0 → 100644
View file @
0d9b38ea
lib/socket/ClientSocket.py
View file @
0d9b38ea
...
...
@@ -47,7 +47,6 @@ class ClientSocket(SocketBase):
data
=
self
.
client
.
recv
(
self
.
BUF_SIZE
)
except
BaseException
as
e
:
# traceback.print_exc()
print
(
"连接超时,socket断开"
)
self
.
client
.
close
()
self
.
status
=
0
raise
RuntimeError
(
'socket 接收消息超时!'
)
...
...
lib/socket/messageTest.py
View file @
0d9b38ea
...
...
@@ -28,8 +28,8 @@ port = 9001
# msg = TerminalVersionInfo_msg().generateMsg() #终端版本信息上报
# msg = QueryTerminalParam_res().generateMsg() #查询终端参数应答
# msg = QueryTerminalProperty_res().generateMsg() #查询终端属性应答消息
msg
=
Location_msg
()
.
generateMsg
()
#位置信息汇报
#
msg = DataUpstreamTransport_msg().generateMsg() #数据上行透传消息
#
msg = Location_msg().generateMsg() #位置信息汇报
msg
=
DataUpstreamTransport_msg
()
.
generateMsg
()
#数据上行透传消息
# msg = TerminalUpdataResult_msg().generateMsg() #终端升级结果通知
# msg = LocationDataBatchUpdate_msg().generateMsg() #定位数据批量上传
# msg = TextInfoUpload_msg().generateMsg() #文本信息上传
...
...
@@ -42,14 +42,28 @@ def sendSingleMsg(msg):
client
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
client
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_KEEPALIVE
,
1
)
# 在客户端开启心跳
client
.
connect
((
host
,
port
))
client
.
send
(
binascii
.
a2b_hex
(
msg
))
# client.send(bytes.fromhex(msg))
data
=
client
.
recv
(
BUF_SIZE
)
client
.
settimeout
(
1
)
try
:
client
.
connect
((
host
,
port
))
client
.
send
(
binascii
.
a2b_hex
(
msg
))
# client.send(bytes.fromhex(msg))
except
BaseException
as
e
:
client
.
close
()
print
(
"连接超时,socket断开"
)
return
try
:
data
=
client
.
recv
(
BUF_SIZE
)
# print(data)
except
BaseException
as
e
:
# traceback.print_exc()
client
.
close
()
# raise RuntimeError('socket 接收消息超时!')
print
(
'socket 接收消息超时!'
)
return
print
(
data
)
print
(
PlatformCommon_res
(
data
)
.
getOriginalMsg
())
print
(
PlatformCommon_res
(
data
)
.
getMsg
())
#解析平台通用应答消息
#
print(TerminalRegister_res(data).getMsg()) #解析终端注册应答消息
#
print(PlatformCommon_res(data).getMsg()) #解析平台通用应答消息
print
(
TerminalRegister_res
(
data
)
.
getMsg
())
#解析终端注册应答消息
# print(PlatefromVersionInfo_res(data).getMsg()) #解析平台版本信息包上传应答
client
.
close
()
...
...
static/js/messageTools/messages.js
View file @
0d9b38ea
...
...
@@ -10,6 +10,8 @@ function messageManTab(e){
$
(
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
if
(
id
==
"
dataUpstreamTransport_msg
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_page
"
);
}
else
{
alert
(
id
)
}
...
...
templates/messageTools/message/dataUpstreamTransport_msg_f2_page.html
0 → 100644
View file @
0d9b38ea
{% extends "messageTools/message/heartBeat_msg_page.html" %}
{% block title %}dataUpstreamTransport_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=
"0900"
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>
<div
style=
"width:100%;margin-bottom:10px;"
>
<label>
选择数据类型:
</label><select
style=
"width:300px;"
id=
"msgType"
class=
"form-control"
onchange=
"changeMsgType()"
>
<option
value=
"F1"
>
驾驶行程数据 (熄火发送)
</option>
<option
value=
"F2"
selected=
"selected"
>
故障码数据 (状态改变发送)
</option>
<option
value=
"F3"
>
休眠进入 (进入休眠模式发送)
</option>
<option
value=
"F4"
>
休眠唤醒 (退出休眠模式发送)
</option>
</select>
</div>
<ul
class=
"protocol_content"
style=
"padding:0px;"
>
<li><label>
时间:
</label><input
id=
"infoTime"
type=
"text"
class=
"form-control"
></li>
<li
style=
"width:340px;"
><label>
维度:
</label><input
id=
"latitude"
type=
"text"
class=
"form-control"
value=
"29.40268"
><select
style=
"width:80px;"
id=
"latitudeType"
class=
"form-control"
>
<option
value=
"0"
>
北纬
</option>
<option
value=
"1"
>
南纬
</option>
</select></li>
<li
style=
"width:340px;"
><label>
经度:
</label><input
id=
"longitude"
type=
"text"
class=
"form-control"
value=
"106.54041"
><select
style=
"width:80px;"
id=
"longitudeType"
class=
"form-control"
>
<option
value=
"0"
>
东经
</option>
<option
value=
"1"
>
西经
</option>
</select></li>
<li><label>
故障码个数:
</label><input
id=
"troubleCodeNums"
type=
"text"
class=
"form-control"
value=
"3"
></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
msgType
=
$
(
"
#msgType
"
).
val
();
var
infoTime
=
$
(
"
#infoTime
"
).
val
();
var
latitude
=
$
(
"
#latitude
"
).
val
();
var
latitudeType
=
$
(
"
#latitudeType
"
).
val
();
if
(
latitudeType
==
"
1
"
){
latitude
=
parseFloat
(
latitude
)
+
2147483648
/
1000000
}
var
longitude
=
$
(
"
#longitude
"
).
val
();
var
longitudeType
=
$
(
"
#longitudeType
"
).
val
();
if
(
longitudeType
==
"
1
"
){
longitude
=
parseFloat
(
longitude
)
+
2147483648
/
1000000
}
var
troubleCodeNums
=
$
(
"
#troubleCodeNums
"
).
val
();
var
data
=
{};
data
[
"
msgID
"
]
=
msgID
;
data
[
"
phoneNum
"
]
=
phoneNum
;
data
[
"
msgWaterCode
"
]
=
msgWaterCode
;
data
[
"
encryptionType
"
]
=
encryptionType
;
data
[
"
subPkg
"
]
=
subPkg
;
data
[
"
pkgCounts
"
]
=
pkgCounts
;
data
[
"
msgType
"
]
=
msgType
;
data
[
"
infoTime
"
]
=
infoTime
;
data
[
"
latitude
"
]
=
latitude
;
data
[
"
longitude
"
]
=
longitude
;
data
[
"
troubleCodeNums
"
]
=
troubleCodeNums
;
var
host
=
window
.
location
.
host
;
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/messageTools/message_process/porcessDataUpstreamTransportMsg_F2
"
,
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
"
)
}
}
function
changeMsgType
(){
var
value
=
$
(
"
#msgType
"
).
val
()
if
(
value
==
"
F1
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_page
"
);
}
else
if
(
value
==
"
F2
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_f2_page
"
);
}
else
if
(
value
==
"
F3
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_f3_page
"
);
}
else
if
(
value
==
"
F4
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_f4_page
"
);
}
}
//设置当前时间到时间输入框
(
function
(){
var
curTime
=
getCurTime
();
$
(
"
#infoTime
"
).
val
(
curTime
);
})();
</script>
{% endblock %}
\ No newline at end of file
templates/messageTools/message/dataUpstreamTransport_msg_f3_page.html
0 → 100644
View file @
0d9b38ea
{% extends "messageTools/message/heartBeat_msg_page.html" %}
{% block title %}dataUpstreamTransport_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=
"0900"
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>
<div
style=
"width:100%;margin-bottom:10px;"
>
<label>
选择数据类型:
</label><select
style=
"width:300px;"
id=
"msgType"
class=
"form-control"
onchange=
"changeMsgType()"
>
<option
value=
"F1"
>
驾驶行程数据 (熄火发送)
</option>
<option
value=
"F2"
>
故障码数据 (状态改变发送)
</option>
<option
value=
"F3"
selected=
"selected"
>
休眠进入 (进入休眠模式发送)
</option>
<option
value=
"F4"
>
休眠唤醒 (退出休眠模式发送)
</option>
</select>
</div>
<ul
class=
"protocol_content"
style=
"padding:0px;"
>
<li><label>
时间:
</label><input
id=
"infoTime"
type=
"text"
class=
"form-control"
></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
msgType
=
$
(
"
#msgType
"
).
val
();
var
infoTime
=
$
(
"
#infoTime
"
).
val
();
var
data
=
{};
data
[
"
msgID
"
]
=
msgID
;
data
[
"
phoneNum
"
]
=
phoneNum
;
data
[
"
msgWaterCode
"
]
=
msgWaterCode
;
data
[
"
encryptionType
"
]
=
encryptionType
;
data
[
"
subPkg
"
]
=
subPkg
;
data
[
"
pkgCounts
"
]
=
pkgCounts
;
data
[
"
msgType
"
]
=
msgType
;
data
[
"
infoTime
"
]
=
infoTime
;
var
host
=
window
.
location
.
host
;
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/messageTools/message_process/porcessDataUpstreamTransportMsg_F3
"
,
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
"
)
}
}
function
changeMsgType
(){
var
value
=
$
(
"
#msgType
"
).
val
()
if
(
value
==
"
F1
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_page
"
);
}
else
if
(
value
==
"
F2
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_f2_page
"
);
}
else
if
(
value
==
"
F3
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_f3_page
"
);
}
else
if
(
value
==
"
F4
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_f4_page
"
);
}
}
//设置当前时间到时间输入框
(
function
(){
var
curTime
=
getCurTime
();
$
(
"
#infoTime
"
).
val
(
curTime
);
})();
</script>
{% endblock %}
\ No newline at end of file
templates/messageTools/message/dataUpstreamTransport_msg_f4_page.html
0 → 100644
View file @
0d9b38ea
{% extends "messageTools/message/heartBeat_msg_page.html" %}
{% block title %}dataUpstreamTransport_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=
"0900"
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>
<div
style=
"width:100%;margin-bottom:10px;"
>
<label>
选择数据类型:
</label><select
style=
"width:300px;"
id=
"msgType"
class=
"form-control"
onchange=
"changeMsgType()"
>
<option
value=
"F1"
>
驾驶行程数据 (熄火发送)
</option>
<option
value=
"F2"
>
故障码数据 (状态改变发送)
</option>
<option
value=
"F3"
>
休眠进入 (进入休眠模式发送)
</option>
<option
value=
"F4"
selected=
"selected"
>
休眠唤醒 (退出休眠模式发送)
</option>
</select>
</div>
<ul
class=
"protocol_content"
style=
"padding:0px;"
>
<li><label>
时间:
</label><input
id=
"infoTime"
type=
"text"
class=
"form-control"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
休眠唤醒类型:
</label><select
id=
"outSleepType"
class=
"form-control"
>
<option
value=
"01"
>
休眠定时唤醒
</option>
<option
value=
"02"
>
CAN1
</option>
<option
value=
"04"
>
CAN2
</option>
<option
value=
"08"
>
gSensor
</option>
<option
value=
"10"
>
电压变化
</option>
<option
value=
"20"
>
GSM 远程唤醒
</option>
</select></li>
<li><label>
车辆电压:
</label><input
id=
"carVoltage"
type=
"text"
class=
"form-control"
value=
"3600"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
振动唤醒加速度值,单位mg:
</label><input
id=
"vibrateOutSleepSpeedUpVal"
type=
"text"
class=
"form-control"
value=
"3700"
></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
msgType
=
$
(
"
#msgType
"
).
val
();
var
infoTime
=
$
(
"
#infoTime
"
).
val
();
var
outSleepType
=
$
(
"
#outSleepType
"
).
val
();
var
carVoltage
=
$
(
"
#carVoltage
"
).
val
();
var
vibrateOutSleepSpeedUpVal
=
$
(
"
#vibrateOutSleepSpeedUpVal
"
).
val
();
var
data
=
{};
data
[
"
msgID
"
]
=
msgID
;
data
[
"
phoneNum
"
]
=
phoneNum
;
data
[
"
msgWaterCode
"
]
=
msgWaterCode
;
data
[
"
encryptionType
"
]
=
encryptionType
;
data
[
"
subPkg
"
]
=
subPkg
;
data
[
"
pkgCounts
"
]
=
pkgCounts
;
data
[
"
msgType
"
]
=
msgType
;
data
[
"
infoTime
"
]
=
infoTime
;
data
[
"
outSleepType
"
]
=
outSleepType
;
data
[
"
carVoltage
"
]
=
carVoltage
;
data
[
"
vibrateOutSleepSpeedUpVal
"
]
=
vibrateOutSleepSpeedUpVal
;
var
host
=
window
.
location
.
host
;
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/messageTools/message_process/porcessDataUpstreamTransportMsg_F4
"
,
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
"
)
}
}
function
changeMsgType
(){
var
value
=
$
(
"
#msgType
"
).
val
()
if
(
value
==
"
F1
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_page
"
);
}
else
if
(
value
==
"
F2
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_f2_page
"
);
}
else
if
(
value
==
"
F3
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_f3_page
"
);
}
else
if
(
value
==
"
F4
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_f4_page
"
);
}
}
//设置当前时间到时间输入框
(
function
(){
var
curTime
=
getCurTime
();
$
(
"
#infoTime
"
).
val
(
curTime
);
})();
</script>
{% endblock %}
\ No newline at end of file
templates/messageTools/message/dataUpstreamTransport_msg_page.html
0 → 100644
View file @
0d9b38ea
{% extends "messageTools/message/heartBeat_msg_page.html" %}
{% block title %}dataUpstreamTransport_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=
"0900"
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>
<div
style=
"width:100%;margin-bottom:10px;"
>
<label>
选择数据类型:
</label><select
style=
"width:300px;"
id=
"msgType"
class=
"form-control"
onchange=
"changeMsgType()"
>
<option
value=
"F1"
>
驾驶行程数据 (熄火发送)
</option>
<option
value=
"F2"
>
故障码数据 (状态改变发送)
</option>
<option
value=
"F3"
>
休眠进入 (进入休眠模式发送)
</option>
<option
value=
"F4"
>
休眠唤醒 (退出休眠模式发送)
</option>
</select>
</div>
<ul
class=
"protocol_content"
style=
"padding:0px;"
>
<li><label>
时间1:
</label><input
id=
"time_1"
type=
"text"
class=
"form-control"
></li>
<li><label>
时间2:
</label><input
id=
"time_2"
type=
"text"
class=
"form-control"
value=
"2020-02-05 22:07:30"
></li>
<li><label>
点火纬度:
</label><input
id=
"fireLatitude"
type=
"text"
class=
"form-control"
value=
"29.40268"
></li>
<li><label>
点火经度:
</label><input
id=
"fireLongitude"
type=
"text"
class=
"form-control"
value=
"106.54041"
></li>
<li><label>
熄火纬度:
</label><input
id=
"unFireLatitude"
type=
"text"
class=
"form-control"
value=
"29.40268"
></li>
<li><label>
熄火经度:
</label><input
id=
"unFireLongitude"
type=
"text"
class=
"form-control"
value=
"106.54041"
></li>
<li><label
style=
"word-break:break-all;font-size:8px;"
>
驾驶循环标签:
</label><input
id=
"drivingCircleLabel"
type=
"text"
class=
"form-control"
value=
"123"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环总里程类型:
</label><input
id=
"drivingCircleTotalMileageType"
type=
"text"
class=
"form-control"
value=
"01"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环总里程,米:
</label><input
id=
"drivingCircleTotalMileage"
type=
"text"
class=
"form-control"
value=
"38090"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环总耗油,(ml):
</label><input
id=
"drivingCircleTotalOil"
type=
"text"
class=
"form-control"
value=
"75400"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环总时长,秒:
</label><input
id=
"drivingCircleTotalTime"
type=
"text"
class=
"form-control"
value=
"726000"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环超速累计时长,秒:
</label><input
id=
"drivingCircleOverSpeedTotalTime"
type=
"text"
class=
"form-control"
value=
"54000"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环超速次数,次:
</label><input
id=
"drivingCircleOverSpeedTotalTimes"
type=
"text"
class=
"form-control"
value=
"101"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环平均车速,KM/H:
</label><input
id=
"drivingCircleAverageSpeed"
type=
"text"
class=
"form-control"
value=
"65"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环最大车速,KM/H:
</label><input
id=
"drivingCircleMaxSpeed"
type=
"text"
class=
"form-control"
value=
"123"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环怠速时长,秒:
</label><input
id=
"drivingCircleIdlingTime"
type=
"text"
class=
"form-control"
value=
"12600000"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环脚刹次数支持与否:
</label><select
id=
"drivingCircleFootBrakeIsSupport"
class=
"form-control"
>
<option
value=
"0"
>
不支持
</option>
<option
value=
"1"
selected=
"selected"
>
支持
</option>
</select></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环脚刹总次数,次:
</label><input
id=
"drivingCircleFootBrakeTatalTimes"
type=
"text"
class=
"form-control"
value=
"32"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环急加速次数:
</label><input
id=
"drivingCircleRapidlyAccelerateTimes"
type=
"text"
class=
"form-control"
value=
"79"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环急减速次数:
</label><input
id=
"drivingCircleSharpSlowdownTimes"
type=
"text"
class=
"form-control"
value=
"10"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
驾驶循环急转弯次数:
</label><input
id=
"drivingCircleSharpCurveTimes"
type=
"text"
class=
"form-control"
value=
"33"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
速度为20Km/H的里程,单位:m:
</label><input
id=
"speedIn20"
type=
"text"
class=
"form-control"
value=
"1068"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
速度为20-40Km/H的里程,m:
</label><input
id=
"speedIn20_40"
type=
"text"
class=
"form-control"
value=
"2020"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
速度为40-60Km/H的里程:
</label><input
id=
"speedIn40_60"
type=
"text"
class=
"form-control"
value=
"30400"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
速度为60-80Km/H的里程:
</label><input
id=
"speedIn60_80"
type=
"text"
class=
"form-control"
value=
"37000"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
速度为80-100Km/H的里程:
</label><input
id=
"speedIn80_100"
type=
"text"
class=
"form-control"
value=
"10400"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
速度为100-120Km/H的里程:
</label><input
id=
"speedIn100_120"
type=
"text"
class=
"form-control"
value=
"5000"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
速度为120Km/H以上的里程:
</label><input
id=
"speedOut120"
type=
"text"
class=
"form-control"
value=
"3200"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
急加速总次数:
</label><input
id=
"rapidlyAccelerateTimes"
type=
"text"
class=
"form-control"
value=
"3000"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
急减速总次数:
</label><input
id=
"rapidlySharpSlowdownTimes"
type=
"text"
class=
"form-control"
value=
"3507"
></li>
<li><label
style=
"word-break:break-all;font-size:10px;"
>
急转弯总次数:
</label><input
id=
"sharpCurveTimes"
type=
"text"
class=
"form-control"
value=
"580"
></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
msgType
=
$
(
"
#msgType
"
).
val
();
var
time_1
=
$
(
"
#time_1
"
).
val
();
var
time_2
=
$
(
"
#time_2
"
).
val
();
var
fireLatitude
=
$
(
"
#fireLatitude
"
).
val
();
var
fireLongitude
=
$
(
"
#fireLongitude
"
).
val
();
var
unFireLatitude
=
$
(
"
#unFireLatitude
"
).
val
();
var
unFireLongitude
=
$
(
"
#unFireLongitude
"
).
val
();
var
drivingCircleLabel
=
$
(
"
#drivingCircleLabel
"
).
val
();
var
drivingCircleTotalMileageType
=
$
(
"
#drivingCircleTotalMileageType
"
).
val
();
var
drivingCircleTotalMileage
=
$
(
"
#drivingCircleTotalMileage
"
).
val
();
var
drivingCircleTotalOil
=
$
(
"
#drivingCircleTotalOil
"
).
val
();
var
drivingCircleTotalTime
=
$
(
"
#drivingCircleTotalTime
"
).
val
();
var
drivingCircleOverSpeedTotalTime
=
$
(
"
#drivingCircleOverSpeedTotalTime
"
).
val
();
var
drivingCircleOverSpeedTotalTimes
=
$
(
"
#drivingCircleOverSpeedTotalTimes
"
).
val
();
var
drivingCircleAverageSpeed
=
$
(
"
#drivingCircleAverageSpeed
"
).
val
();
var
drivingCircleMaxSpeed
=
$
(
"
#drivingCircleMaxSpeed
"
).
val
();
var
drivingCircleIdlingTime
=
$
(
"
#drivingCircleIdlingTime
"
).
val
();
var
drivingCircleFootBrakeIsSupport
=
$
(
"
#drivingCircleFootBrakeIsSupport
"
).
val
();
var
drivingCircleFootBrakeTatalTimes
=
$
(
"
#drivingCircleFootBrakeTatalTimes
"
).
val
();
var
drivingCircleRapidlyAccelerateTimes
=
$
(
"
#drivingCircleRapidlyAccelerateTimes
"
).
val
();
var
drivingCircleSharpSlowdownTimes
=
$
(
"
#drivingCircleSharpSlowdownTimes
"
).
val
();
var
drivingCircleSharpCurveTimes
=
$
(
"
#drivingCircleSharpCurveTimes
"
).
val
();
var
speedIn20
=
$
(
"
#speedIn20
"
).
val
();
var
speedIn20_40
=
$
(
"
#speedIn20_40
"
).
val
();
var
speedIn40_60
=
$
(
"
#speedIn40_60
"
).
val
();
var
speedIn60_80
=
$
(
"
#speedIn60_80
"
).
val
();
var
speedIn80_100
=
$
(
"
#speedIn80_100
"
).
val
();
var
speedIn100_120
=
$
(
"
#speedIn100_120
"
).
val
();
var
speedOut120
=
$
(
"
#speedOut120
"
).
val
();
var
rapidlyAccelerateTimes
=
$
(
"
#rapidlyAccelerateTimes
"
).
val
();
var
rapidlySharpSlowdownTimes
=
$
(
"
#rapidlySharpSlowdownTimes
"
).
val
();
var
sharpCurveTimes
=
$
(
"
#sharpCurveTimes
"
).
val
();
var
data
=
{};
data
[
"
msgID
"
]
=
msgID
;
data
[
"
phoneNum
"
]
=
phoneNum
;
data
[
"
msgWaterCode
"
]
=
msgWaterCode
;
data
[
"
encryptionType
"
]
=
encryptionType
;
data
[
"
subPkg
"
]
=
subPkg
;
data
[
"
pkgCounts
"
]
=
pkgCounts
;
data
[
"
msgType
"
]
=
msgType
;
data
[
"
time_1
"
]
=
time_1
;
data
[
"
time_2
"
]
=
time_2
;
data
[
"
fireLatitude
"
]
=
fireLatitude
;
data
[
"
fireLongitude
"
]
=
fireLongitude
;
data
[
"
unFireLatitude
"
]
=
unFireLatitude
;
data
[
"
unFireLongitude
"
]
=
unFireLongitude
;
data
[
"
drivingCircleLabel
"
]
=
drivingCircleLabel
;
data
[
"
drivingCircleTotalMileageType
"
]
=
drivingCircleTotalMileageType
;
data
[
"
drivingCircleTotalMileage
"
]
=
drivingCircleTotalMileage
;
data
[
"
drivingCircleTotalOil
"
]
=
drivingCircleTotalOil
;
data
[
"
drivingCircleTotalTime
"
]
=
drivingCircleTotalTime
;
data
[
"
drivingCircleOverSpeedTotalTime
"
]
=
drivingCircleOverSpeedTotalTime
;
data
[
"
drivingCircleOverSpeedTotalTimes
"
]
=
drivingCircleOverSpeedTotalTimes
;
data
[
"
drivingCircleAverageSpeed
"
]
=
drivingCircleAverageSpeed
;
data
[
"
drivingCircleMaxSpeed
"
]
=
drivingCircleMaxSpeed
;
data
[
"
drivingCircleIdlingTime
"
]
=
drivingCircleIdlingTime
;
data
[
"
drivingCircleFootBrakeIsSupport
"
]
=
drivingCircleFootBrakeIsSupport
;
data
[
"
drivingCircleFootBrakeTatalTimes
"
]
=
drivingCircleFootBrakeTatalTimes
;
data
[
"
drivingCircleRapidlyAccelerateTimes
"
]
=
drivingCircleRapidlyAccelerateTimes
;
data
[
"
drivingCircleSharpSlowdownTimes
"
]
=
drivingCircleSharpSlowdownTimes
;
data
[
"
drivingCircleSharpCurveTimes
"
]
=
drivingCircleSharpCurveTimes
;
data
[
"
speedIn20
"
]
=
speedIn20
;
data
[
"
speedIn20_40
"
]
=
speedIn20_40
;
data
[
"
speedIn40_60
"
]
=
speedIn40_60
;
data
[
"
speedIn60_80
"
]
=
speedIn60_80
;
data
[
"
speedIn80_100
"
]
=
speedIn80_100
;
data
[
"
speedIn100_120
"
]
=
speedIn100_120
;
data
[
"
speedOut120
"
]
=
speedOut120
;
data
[
"
rapidlyAccelerateTimes
"
]
=
rapidlyAccelerateTimes
;
data
[
"
rapidlySharpSlowdownTimes
"
]
=
rapidlySharpSlowdownTimes
;
data
[
"
sharpCurveTimes
"
]
=
sharpCurveTimes
;
var
host
=
window
.
location
.
host
;
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/messageTools/message_process/porcessDataUpstreamTransportMsg
"
,
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
"
)
}
}
function
changeMsgType
(){
var
value
=
$
(
"
#msgType
"
).
val
()
if
(
value
==
"
F1
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_page
"
);
}
else
if
(
value
==
"
F2
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_f2_page
"
);
}
else
if
(
value
==
"
F3
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_f3_page
"
);
}
else
if
(
value
==
"
F4
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/message_view/dataUpstreamTransport_msg_f4_page
"
);
}
}
//设置当前时间到时间输入框
(
function
(){
var
curTime
=
getCurTime
();
$
(
"
#time_1
"
).
val
(
curTime
);
})();
</script>
{% endblock %}
\ No newline at end of file
templates/messageTools/message/heartBeat_msg_page.html
View file @
0d9b38ea
...
...
@@ -35,6 +35,7 @@
<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=
"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=
"style_index2"
{%
if
arg.path[2]=
="2"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"messageManTab(this)"
>
其他报文
</b></a></li>
</ul>
{% endblock %}
...
...
templates/messageTools/message/terminalRegister_msg_page.html
View file @
0d9b38ea
...
...
@@ -19,7 +19,8 @@
</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=
"103"
></li>
<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>
<li><label>
制造商ID:
</label><input
id=
"manufacturerId"
type=
"text"
class=
"form-control"
value=
"11010"
></li>
<li
style=
"width:500px;"
><label>
终端型号:
</label><input
style=
"width:320px;"
id=
"terminalType"
type=
"text"
class=
"form-control"
value=
"a865h643gfdj64fd7432"
></li>
<li><label>
终端ID:
</label><input
id=
"terminalId"
type=
"text"
class=
"form-control"
value=
"H6uyt08"
></li>
...
...
@@ -52,6 +53,7 @@ $("#sendMsgBtn").click(function(){
}
var
provinceId
=
$
(
"
#provinceId
"
).
val
();
var
countyId
=
$
(
"
#countyId
"
).
val
();
var
manufacturerId
=
$
(
"
#manufacturerId
"
).
val
();
var
terminalType
=
$
(
"
#terminalType
"
).
val
();
var
terminalId
=
$
(
"
#terminalId
"
).
val
();
...
...
@@ -67,6 +69,7 @@ $("#sendMsgBtn").click(function(){
data
[
"
pkgCounts
"
]
=
pkgCounts
;
data
[
"
provinceId
"
]
=
provinceId
;
data
[
"
countyId
"
]
=
countyId
;
data
[
"
manufacturerId
"
]
=
manufacturerId
;
data
[
"
terminalType
"
]
=
terminalType
;
data
[
"
terminalId
"
]
=
terminalId
;
...
...
views/messageTools/message_process.py
View file @
0d9b38ea
...
...
@@ -3,6 +3,7 @@
from
flask
import
Blueprint
,
Response
,
request
from
configparser
import
ConfigParser
from
lib.protocol.message.DataUpstreamTransport_msg
import
DataUpstreamTransport_msg
from
lib.protocol.message.TerminalHeartbeat_msg
import
TerminalHeartbeat_msg
from
lib.protocol.message.TerminalRegister_msg
import
TerminalRegister_msg
from
lib.protocol.message.TerminalVersionInfo_msg
import
TerminalVersionInfo_msg
...
...
@@ -51,7 +52,7 @@ def porcessHeartBeatMsg():
data
[
"message"
]
=
"Sucess: "
data
[
"original"
]
=
msg
data
[
"result"
]
=
socRecv_2
data
[
"parse"
]
=
PlatformCommon_res
(
socRecv_1
)
.
getMsg
(
)
data
[
"parse"
]
=
json
.
loads
(
PlatformCommon_res
(
socRecv_1
)
.
getMsg
()
)
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
...
...
@@ -72,6 +73,7 @@ def porcessTerminalRegisterMsg():
pkgCounts
=
int
(
request
.
form
.
get
(
"pkgCounts"
))
provinceId
=
int
(
request
.
form
.
get
(
"provinceId"
))
countyId
=
int
(
request
.
form
.
get
(
"countyId"
))
manufacturerId
=
request
.
form
.
get
(
"manufacturerId"
)
terminalType
=
request
.
form
.
get
(
"terminalType"
)
terminalId
=
request
.
form
.
get
(
"terminalId"
)
...
...
@@ -80,7 +82,7 @@ def porcessTerminalRegisterMsg():
data
=
{}
if
(
msgID
==
None
or
phoneNum
==
None
or
msgWaterCode
==
None
or
encryptionType
==
None
or
subPkg
==
None
\
or
pkgCounts
==
None
or
provinceId
==
None
or
manufacturerId
==
None
or
terminalType
==
None
\
or
pkgCounts
==
None
or
provinceId
==
None
or
countyId
==
None
or
manufacturerId
==
None
or
terminalType
==
None
\
or
terminalId
==
None
or
licencePlateColor
==
None
or
carSign
==
None
):
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Info: 请检查是否传入了空数据!"
...
...
@@ -93,7 +95,7 @@ def porcessTerminalRegisterMsg():
cliSocket
.
connect
()
terminalRegisterObj
=
TerminalRegister_msg
()
msg
=
terminalRegisterObj
.
generateMsg_GUI
(
msgID
,
phoneNum
,
msgWaterCode
,
encryptionType
,
subPkg
,
provinceId
,
\
manufacturerId
,
terminalType
,
terminalId
,
licencePlateColor
,
carSign
)
countyId
,
manufacturerId
,
terminalType
,
terminalId
,
licencePlateColor
,
carSign
)
cliSocket
.
send
(
msg
)
socRecv_1
=
cliSocket
.
receive
()
socRecv_2
=
str
(
socRecv_1
)
...
...
@@ -102,7 +104,7 @@ def porcessTerminalRegisterMsg():
data
[
"message"
]
=
"Sucess: "
data
[
"original"
]
=
msg
data
[
"result"
]
=
socRecv_2
data
[
"parse"
]
=
PlatformCommon_res
(
socRecv_1
)
.
getMsg
(
)
data
[
"parse"
]
=
json
.
loads
(
PlatformCommon_res
(
socRecv_1
)
.
getMsg
()
)
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
...
...
@@ -160,7 +162,282 @@ def porcessTerminalVersionInfoUploadMsg():
data
[
"message"
]
=
"Sucess: "
data
[
"original"
]
=
msg
data
[
"result"
]
=
socRecv_2
data
[
"parse"
]
=
PlatefromVersionInfo_res
(
socRecv_1
)
.
getMsg
()
data
[
"parse"
]
=
json
.
loads
(
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'
)
##########################################
# 【接口类型】处理发送的终端版本主动上报消息(驾驶行程数据)
##########################################
@
message_process
.
route
(
"/porcessDataUpstreamTransportMsg"
,
methods
=
[
'POST'
])
def
porcessDataUpstreamTransportMsg
():
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"
))
msgType
=
request
.
form
.
get
(
"msgType"
)
time_1
=
request
.
form
.
get
(
"time_1"
)
time_2
=
request
.
form
.
get
(
"time_2"
)
fireLatitude
=
float
(
request
.
form
.
get
(
"fireLatitude"
))
fireLongitude
=
float
(
request
.
form
.
get
(
"fireLongitude"
))
unFireLatitude
=
float
(
request
.
form
.
get
(
"unFireLatitude"
))
unFireLongitude
=
float
(
request
.
form
.
get
(
"unFireLongitude"
))
drivingCircleLabel
=
int
(
request
.
form
.
get
(
"drivingCircleLabel"
))
drivingCircleTotalMileageType
=
request
.
form
.
get
(
"drivingCircleTotalMileageType"
)
drivingCircleTotalMileage
=
int
(
request
.
form
.
get
(
"drivingCircleTotalMileage"
))
drivingCircleTotalOil
=
int
(
request
.
form
.
get
(
"drivingCircleTotalOil"
))
drivingCircleTotalTime
=
int
(
request
.
form
.
get
(
"drivingCircleTotalTime"
))
drivingCircleOverSpeedTotalTime
=
int
(
request
.
form
.
get
(
"drivingCircleOverSpeedTotalTime"
))
drivingCircleOverSpeedTotalTimes
=
int
(
request
.
form
.
get
(
"drivingCircleOverSpeedTotalTimes"
))
drivingCircleAverageSpeed
=
int
(
request
.
form
.
get
(
"drivingCircleAverageSpeed"
))
drivingCircleMaxSpeed
=
int
(
request
.
form
.
get
(
"drivingCircleMaxSpeed"
))
drivingCircleIdlingTime
=
int
(
request
.
form
.
get
(
"drivingCircleIdlingTime"
))
drivingCircleFootBrakeIsSupport
=
int
(
request
.
form
.
get
(
"drivingCircleFootBrakeIsSupport"
))
drivingCircleFootBrakeTatalTimes
=
int
(
request
.
form
.
get
(
"drivingCircleFootBrakeTatalTimes"
))
drivingCircleRapidlyAccelerateTimes
=
int
(
request
.
form
.
get
(
"drivingCircleRapidlyAccelerateTimes"
))
drivingCircleSharpSlowdownTimes
=
int
(
request
.
form
.
get
(
"drivingCircleSharpSlowdownTimes"
))
drivingCircleSharpCurveTimes
=
int
(
request
.
form
.
get
(
"drivingCircleSharpCurveTimes"
))
speedIn20
=
int
(
request
.
form
.
get
(
"speedIn20"
))
speedIn20_40
=
int
(
request
.
form
.
get
(
"speedIn20_40"
))
speedIn40_60
=
int
(
request
.
form
.
get
(
"speedIn40_60"
))
speedIn60_80
=
int
(
request
.
form
.
get
(
"speedIn60_80"
))
speedIn80_100
=
int
(
request
.
form
.
get
(
"speedIn80_100"
))
speedIn100_120
=
int
(
request
.
form
.
get
(
"speedIn100_120"
))
speedOut120
=
int
(
request
.
form
.
get
(
"speedOut120"
))
rapidlyAccelerateTimes
=
int
(
request
.
form
.
get
(
"rapidlyAccelerateTimes"
))
rapidlySharpSlowdownTimes
=
int
(
request
.
form
.
get
(
"rapidlySharpSlowdownTimes"
))
sharpCurveTimes
=
int
(
request
.
form
.
get
(
"sharpCurveTimes"
))
data
=
{}
if
(
msgID
==
None
or
phoneNum
==
None
or
msgWaterCode
==
None
or
encryptionType
==
None
or
subPkg
==
None
\
or
pkgCounts
==
None
or
time_1
==
None
or
time_2
==
None
or
fireLatitude
==
None
or
fireLongitude
==
None
or
\
unFireLatitude
==
None
or
unFireLongitude
==
None
or
drivingCircleLabel
==
None
or
drivingCircleTotalMileageType
==
None
or
\
drivingCircleTotalMileage
==
None
or
drivingCircleTotalOil
==
None
or
drivingCircleTotalTime
==
None
or
\
drivingCircleOverSpeedTotalTime
==
None
or
drivingCircleOverSpeedTotalTimes
==
None
or
drivingCircleAverageSpeed
==
None
or
\
drivingCircleMaxSpeed
==
None
or
drivingCircleIdlingTime
==
None
or
drivingCircleFootBrakeIsSupport
==
None
or
\
drivingCircleFootBrakeTatalTimes
==
None
or
drivingCircleRapidlyAccelerateTimes
==
None
or
drivingCircleSharpSlowdownTimes
==
None
or
\
drivingCircleSharpCurveTimes
==
None
or
speedIn20
==
None
or
speedIn20_40
==
None
or
speedIn40_60
==
None
or
speedIn60_80
==
None
or
\
speedIn80_100
==
None
or
speedIn100_120
==
None
or
speedOut120
==
None
or
rapidlyAccelerateTimes
==
None
or
\
rapidlySharpSlowdownTimes
==
None
or
sharpCurveTimes
==
None
):
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Info: 请检查是否传入了空数据!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
msgData
=
{}
msgData
[
"time_1"
]
=
time_1
msgData
[
"time_2"
]
=
time_2
msgData
[
"fireLatitude"
]
=
fireLatitude
msgData
[
"fireLongitude"
]
=
fireLongitude
msgData
[
"unFireLatitude"
]
=
unFireLatitude
msgData
[
"unFireLongitude"
]
=
unFireLongitude
msgData
[
"drivingCircleLabel"
]
=
drivingCircleLabel
msgData
[
"drivingCircleTotalMileageType"
]
=
drivingCircleTotalMileageType
msgData
[
"drivingCircleTotalMileage"
]
=
drivingCircleTotalMileage
msgData
[
"drivingCircleTotalOil"
]
=
drivingCircleTotalOil
msgData
[
"drivingCircleTotalTime"
]
=
drivingCircleTotalTime
msgData
[
"drivingCircleOverSpeedTotalTime"
]
=
drivingCircleOverSpeedTotalTime
msgData
[
"drivingCircleOverSpeedTotalTimes"
]
=
drivingCircleOverSpeedTotalTimes
msgData
[
"drivingCircleAverageSpeed"
]
=
drivingCircleAverageSpeed
msgData
[
"drivingCircleMaxSpeed"
]
=
drivingCircleMaxSpeed
msgData
[
"drivingCircleIdlingTime"
]
=
drivingCircleIdlingTime
msgData
[
"drivingCircleFootBrakeIsSupport"
]
=
drivingCircleFootBrakeIsSupport
msgData
[
"drivingCircleFootBrakeTatalTimes"
]
=
drivingCircleFootBrakeTatalTimes
msgData
[
"drivingCircleRapidlyAccelerateTimes"
]
=
drivingCircleRapidlyAccelerateTimes
msgData
[
"drivingCircleSharpSlowdownTimes"
]
=
drivingCircleSharpSlowdownTimes
msgData
[
"drivingCircleSharpCurveTimes"
]
=
drivingCircleSharpCurveTimes
msgData
[
"speedIn20"
]
=
speedIn20
msgData
[
"speedIn20_40"
]
=
speedIn20_40
msgData
[
"speedIn40_60"
]
=
speedIn40_60
msgData
[
"speedIn60_80"
]
=
speedIn60_80
msgData
[
"speedIn80_100"
]
=
speedIn80_100
msgData
[
"speedIn100_120"
]
=
speedIn100_120
msgData
[
"speedOut120"
]
=
speedOut120
msgData
[
"rapidlyAccelerateTimes"
]
=
rapidlyAccelerateTimes
msgData
[
"rapidlySharpSlowdownTimes"
]
=
rapidlySharpSlowdownTimes
msgData
[
"sharpCurveTimes"
]
=
sharpCurveTimes
conf_R
=
ConfigParser
()
conf_R
.
read
(
"config/messageTools/messageTools.conf"
)
cliSocket
=
ClientSocket
(
conf_R
.
get
(
"socket"
,
"host"
),
conf_R
.
getint
(
"socket"
,
"port"
))
cliSocket
.
connect
()
DataUpstreamTransportObj
=
DataUpstreamTransport_msg
()
msg
=
DataUpstreamTransportObj
.
generateMsg_GUI
(
msgID
,
phoneNum
,
msgWaterCode
,
encryptionType
,
subPkg
,
msgType
,
msgData
)
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"
]
=
json
.
loads
(
PlatformCommon_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'
)
##########################################
# 【接口类型】处理发送的终端版本主动上报消息(故障码数据)
##########################################
@
message_process
.
route
(
"/porcessDataUpstreamTransportMsg_F2"
,
methods
=
[
'POST'
])
def
porcessDataUpstreamTransportMsg_F2
():
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"
))
msgType
=
request
.
form
.
get
(
"msgType"
)
infoTime
=
request
.
form
.
get
(
"infoTime"
)
latitude
=
float
(
request
.
form
.
get
(
"latitude"
))
longitude
=
float
(
request
.
form
.
get
(
"longitude"
))
troubleCodeNums
=
int
(
request
.
form
.
get
(
"troubleCodeNums"
))
data
=
{}
if
(
msgID
==
None
or
phoneNum
==
None
or
msgWaterCode
==
None
or
encryptionType
==
None
or
subPkg
==
None
\
or
pkgCounts
==
None
or
infoTime
==
None
or
latitude
==
None
or
longitude
==
None
or
troubleCodeNums
==
None
):
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Info: 请检查是否传入了空数据!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
msgData
=
{}
msgData
[
"infoTime"
]
=
infoTime
msgData
[
"latitude"
]
=
latitude
msgData
[
"longitude"
]
=
longitude
msgData
[
"troubleCodeNums"
]
=
troubleCodeNums
conf_R
=
ConfigParser
()
conf_R
.
read
(
"config/messageTools/messageTools.conf"
)
cliSocket
=
ClientSocket
(
conf_R
.
get
(
"socket"
,
"host"
),
conf_R
.
getint
(
"socket"
,
"port"
))
cliSocket
.
connect
()
DataUpstreamTransportObj
=
DataUpstreamTransport_msg
()
msg
=
DataUpstreamTransportObj
.
generateMsg_GUI
(
msgID
,
phoneNum
,
msgWaterCode
,
encryptionType
,
subPkg
,
msgType
,
msgData
)
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"
]
=
json
.
loads
(
PlatformCommon_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'
)
##########################################
# 【接口类型】处理发送的终端版本主动上报消息(休眠进入)
##########################################
@
message_process
.
route
(
"/porcessDataUpstreamTransportMsg_F3"
,
methods
=
[
'POST'
])
def
porcessDataUpstreamTransportMsg_F3
():
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"
))
msgType
=
request
.
form
.
get
(
"msgType"
)
infoTime
=
request
.
form
.
get
(
"infoTime"
)
data
=
{}
if
(
msgID
==
None
or
phoneNum
==
None
or
msgWaterCode
==
None
or
encryptionType
==
None
or
subPkg
==
None
\
or
pkgCounts
==
None
or
infoTime
==
None
):
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Info: 请检查是否传入了空数据!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
msgData
=
{}
msgData
[
"infoTime"
]
=
infoTime
conf_R
=
ConfigParser
()
conf_R
.
read
(
"config/messageTools/messageTools.conf"
)
cliSocket
=
ClientSocket
(
conf_R
.
get
(
"socket"
,
"host"
),
conf_R
.
getint
(
"socket"
,
"port"
))
cliSocket
.
connect
()
DataUpstreamTransportObj
=
DataUpstreamTransport_msg
()
msg
=
DataUpstreamTransportObj
.
generateMsg_GUI
(
msgID
,
phoneNum
,
msgWaterCode
,
encryptionType
,
subPkg
,
msgType
,
msgData
)
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"
]
=
json
.
loads
(
PlatformCommon_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'
)
##########################################
# 【接口类型】处理发送的终端版本主动上报消息(休眠唤醒)
##########################################
@
message_process
.
route
(
"/porcessDataUpstreamTransportMsg_F4"
,
methods
=
[
'POST'
])
def
porcessDataUpstreamTransportMsg_F4
():
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"
))
msgType
=
request
.
form
.
get
(
"msgType"
)
infoTime
=
request
.
form
.
get
(
"infoTime"
)
outSleepType
=
request
.
form
.
get
(
"outSleepType"
)
carVoltage
=
int
(
request
.
form
.
get
(
"carVoltage"
))
vibrateOutSleepSpeedUpVal
=
int
(
request
.
form
.
get
(
"vibrateOutSleepSpeedUpVal"
))
data
=
{}
if
(
msgID
==
None
or
phoneNum
==
None
or
msgWaterCode
==
None
or
encryptionType
==
None
or
subPkg
==
None
\
or
pkgCounts
==
None
or
infoTime
==
None
):
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Info: 请检查是否传入了空数据!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
msgData
=
{}
msgData
[
"infoTime"
]
=
infoTime
msgData
[
"outSleepType"
]
=
outSleepType
msgData
[
"carVoltage"
]
=
carVoltage
msgData
[
"vibrateOutSleepSpeedUpVal"
]
=
vibrateOutSleepSpeedUpVal
conf_R
=
ConfigParser
()
conf_R
.
read
(
"config/messageTools/messageTools.conf"
)
cliSocket
=
ClientSocket
(
conf_R
.
get
(
"socket"
,
"host"
),
conf_R
.
getint
(
"socket"
,
"port"
))
cliSocket
.
connect
()
DataUpstreamTransportObj
=
DataUpstreamTransport_msg
()
msg
=
DataUpstreamTransportObj
.
generateMsg_GUI
(
msgID
,
phoneNum
,
msgWaterCode
,
encryptionType
,
subPkg
,
msgType
,
msgData
)
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"
]
=
json
.
loads
(
PlatformCommon_res
(
socRecv_1
)
.
getMsg
())
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
...
...
views/messageTools/message_view.py
View file @
0d9b38ea
...
...
@@ -46,3 +46,59 @@ def terminalVersionInfoUpload_msg_page():
path
=
"messageTools/message/terminalVersionInfoUpload_msg_page.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
return
render_template
(
path
,
arg
=
arg
)
##########################################
# 【视图类型】访问数据上行透传页面(驾驶行程数据)
##########################################
@
message_view
.
route
(
'/dataUpstreamTransport_msg_page'
)
def
dataUpstreamTransport_msg_page
():
#获取请求的路劲
url
=
request
.
url
reqPath
=
re
.
findall
(
"http://(.*)$"
,
url
)[
0
]
reqPath
=
re
.
findall
(
"/(.*)$"
,
reqPath
)[
0
]
arg
=
{}
path
=
"messageTools/message/dataUpstreamTransport_msg_page.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
return
render_template
(
path
,
arg
=
arg
)
##########################################
# 【视图类型】访问数据上行透传页面(故障码数据)
##########################################
@
message_view
.
route
(
'/dataUpstreamTransport_msg_f2_page'
)
def
dataUpstreamTransport_msg_f2_page
():
#获取请求的路劲
url
=
request
.
url
reqPath
=
re
.
findall
(
"http://(.*)$"
,
url
)[
0
]
reqPath
=
re
.
findall
(
"/(.*)$"
,
reqPath
)[
0
]
arg
=
{}
path
=
"messageTools/message/dataUpstreamTransport_msg_f2_page.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
return
render_template
(
path
,
arg
=
arg
)
##########################################
# 【视图类型】访问数据上行透传页面(休眠进入)
##########################################
@
message_view
.
route
(
'/dataUpstreamTransport_msg_f3_page'
)
def
dataUpstreamTransport_msg_f3_page
():
#获取请求的路劲
url
=
request
.
url
reqPath
=
re
.
findall
(
"http://(.*)$"
,
url
)[
0
]
reqPath
=
re
.
findall
(
"/(.*)$"
,
reqPath
)[
0
]
arg
=
{}
path
=
"messageTools/message/dataUpstreamTransport_msg_f3_page.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
return
render_template
(
path
,
arg
=
arg
)
##########################################
# 【视图类型】访问数据上行透传页面(休眠唤醒)
##########################################
@
message_view
.
route
(
'/dataUpstreamTransport_msg_f4_page'
)
def
dataUpstreamTransport_msg_f4_page
():
#获取请求的路劲
url
=
request
.
url
reqPath
=
re
.
findall
(
"http://(.*)$"
,
url
)[
0
]
reqPath
=
re
.
findall
(
"/(.*)$"
,
reqPath
)[
0
]
arg
=
{}
path
=
"messageTools/message/dataUpstreamTransport_msg_f4_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