Commit 0d9b38ea authored by liyuanhong's avatar liyuanhong

完成数据上行透传消息图形操作界面

parent df3a9adb
......@@ -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()
......@@ -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
......
#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
pkgNumHex = self.int2hexStringByBytes(pkgNum,2)
pkgNumsHex = pkgNumsHex + pkgNumHex
dataHex = self.int2hexStringByBytes(pkgNum,2)
pkgNumsHex = pkgNumsHex + dataHex
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"))
......@@ -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
#######################################################
# 获取消息体
#######################################################
......
......@@ -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
#######################################################
......
......@@ -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
#######################################################
# 获取消息体
#######################################################
......
......@@ -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
......@@ -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 接收消息超时!')
......
......@@ -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()
......
......@@ -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)
}
......
{% 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
{% 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
{% 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
......@@ -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 %}
......
......@@ -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;
......
This diff is collapsed.
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment