Commit f21d3a19 authored by liyuanhong's avatar liyuanhong

增加了页面16进制消息的显示

parent f0bb02f9
......@@ -23,12 +23,13 @@ class SendMultMsgThread():
self.threadArr = {} #保存每个线程的信息
self.failThreadCount = 0 #失败线程数
self.durThreads = [] #持续发送线程数组,当数组为空,表示所有线程已经结束
dt = 1 * 1 * 60
dt = 1 * 20 * 60
self.durTime = dt #线程持续时间
self.connectTimeoutNum = 0 #连接超时线程数
self.sendTimeoutNum = 0 #发送超时线程数
self.reviceTimeoutNum = 0 #接收超时线程数
self.sucessNum = 0 #成功线程数
self.failThreadCount = 0 #失败线程数
self.messageCon = [] #用来统计每个线程所发的消息数
self.messageCons = 0 # 用来统计每个线程所发的消息数
pass
......@@ -127,6 +128,7 @@ class SendMultMsgThread():
self.durThreads.remove(threadName)
self.threadArr[threadName]["status"] = 1
self.failThreadCount = self.failThreadCount + 1
self.sendTimeoutNum = self.sendTimeoutNum + 1
endTime = int(time.time())
timeExpend = endTime - startTime
self.threadArr[threadName]["timeExp"] = timeExpend
......@@ -142,7 +144,7 @@ class SendMultMsgThread():
self.durThreads.remove(threadName)
self.threadArr[threadName]["status"] = 1
self.failThreadCount = self.failThreadCount + 1
self.reviceTimeoutNum = self.connectTimeoutNum + 1
self.reviceTimeoutNum = self.reviceTimeoutNum + 1
self.messageCon.append(msgCon)
self.threadArr[threadName]["msgCon"] = msgCon
print(threadName + ":" + 'socket 接收消息超时!')
......@@ -191,9 +193,9 @@ class SendMultMsgThread():
def startThreadContinuous(self):
timeStart = int(time.time() * 1000)
for i in range(0,self.threadCount):
threadName = "thread-" + str(i)
threadName = "thread-" + str(i + 42000)
print(threadName)
carid = 201912000000 + i
carid = 201912000000 + i + 42000
theThread = threading.Thread(target=self.sendMsgContinuous, args=(carid,threadName,)) # 数据写死,心跳
threadInfo = {}
threadInfo["name"] = threadName
......
......@@ -18,12 +18,12 @@ class SendMultMsgThread():
self.msg = msg
self.timeOut = 30 #socket超时时间
self.BUF_SIZE = 1024 #接收消息缓存
self.threadCount = 1000 #并发线程数
self.threadCount = 10000 #并发线程数
self.totalTime = 0 #所有线程的运行总和
self.threadArr = {} #保存每个线程的信息
self.failThreadCount = 0 #失败线程数
self.durThreads = [] #持续发送线程数组,当数组为空,表示所有线程已经结束
dt = 1 * 1 * 60
dt = 1 * 20 * 60
self.durTime = dt #线程持续时间
self.connectTimeoutNum = 0 #连接超时线程数
self.sendTimeoutNum = 0 #发送超时线程数
......
......@@ -92,6 +92,7 @@ $("#sendMsgBtn").click(function(){
data["troubleCodeNums"] = troubleCodeNums;
var host = window.location.host;
$("#showFeedback").val("")
$.ajax({
url:"http://" + host + "/messageTools/message_process/porcessDataUpstreamTransportMsg_F2",
type:"post",
......@@ -102,6 +103,7 @@ $("#sendMsgBtn").click(function(){
//window.location.reload()
var theShow = "原始数据: " + data.original + "\n";
theShow = theShow + "收到数据: " + data.result + "\n";
theShow = theShow + "收到数据16进制: " + data.resultH + "\n";
theShow = theShow + "解析数据: " + JSON.stringify(data.parse) + "\n";
$("#showFeedback").val(theShow)
}else{
......
......@@ -69,6 +69,7 @@ $("#sendMsgBtn").click(function(){
data["infoTime"] = infoTime;
var host = window.location.host;
$("#showFeedback").val("")
$.ajax({
url:"http://" + host + "/messageTools/message_process/porcessDataUpstreamTransportMsg_F3",
type:"post",
......@@ -79,6 +80,7 @@ $("#sendMsgBtn").click(function(){
//window.location.reload()
var theShow = "原始数据: " + data.original + "\n";
theShow = theShow + "收到数据: " + data.result + "\n";
theShow = theShow + "收到数据16进制: " + data.resultH + "\n";
theShow = theShow + "解析数据: " + JSON.stringify(data.parse) + "\n";
$("#showFeedback").val(theShow)
}else{
......
......@@ -85,6 +85,7 @@ $("#sendMsgBtn").click(function(){
data["vibrateOutSleepSpeedUpVal"] = vibrateOutSleepSpeedUpVal;
var host = window.location.host;
$("#showFeedback").val("")
$.ajax({
url:"http://" + host + "/messageTools/message_process/porcessDataUpstreamTransportMsg_F4",
type:"post",
......@@ -95,6 +96,7 @@ $("#sendMsgBtn").click(function(){
//window.location.reload()
var theShow = "原始数据: " + data.original + "\n";
theShow = theShow + "收到数据: " + data.result + "\n";
theShow = theShow + "收到数据16进制: " + data.resultH + "\n";
theShow = theShow + "解析数据: " + JSON.stringify(data.parse) + "\n";
$("#showFeedback").val(theShow)
}else{
......
......@@ -162,6 +162,7 @@ $("#sendMsgBtn").click(function(){
data["sharpCurveTimes"] = sharpCurveTimes;
var host = window.location.host;
$("#showFeedback").val("")
$.ajax({
url:"http://" + host + "/messageTools/message_process/porcessDataUpstreamTransportMsg",
type:"post",
......@@ -172,6 +173,7 @@ $("#sendMsgBtn").click(function(){
//window.location.reload()
var theShow = "原始数据: " + data.original + "\n";
theShow = theShow + "收到数据: " + data.result + "\n";
theShow = theShow + "收到数据16进制: " + data.resultH + "\n";
theShow = theShow + "解析数据: " + JSON.stringify(data.parse) + "\n";
$("#showFeedback").val(theShow)
}else{
......
......@@ -97,6 +97,7 @@
data["pkgCounts"] = pkgCounts;
var host = window.location.host;
$("#showFeedback").val("")
$.ajax({
url:"http://" + host + "/messageTools/message_process/porcessHeartBeatMsg",
type:"post",
......@@ -107,6 +108,7 @@
//window.location.reload()
var theShow = "原始数据: " + data.original + "\n";
theShow = theShow + "收到数据: " + data.result + "\n";
theShow = theShow + "收到数据16进制: " + data.resultH + "\n";
theShow = theShow + "解析数据: " + JSON.stringify(data.parse) + "\n";
$("#showFeedback").val(theShow)
}else{
......
......@@ -746,6 +746,7 @@ $("#sendMsgBtn").click(function(){
data["extraInfo"] = getExtraInfo();
var host = window.location.host;
$("#showFeedback").val("")
$.ajax({
url:"http://" + host + "/messageTools/message_process/porcessTerminalRegisterMsg",
type:"post",
......@@ -756,6 +757,7 @@ $("#sendMsgBtn").click(function(){
//window.location.reload()
var theShow = "原始数据: " + data.original + "\n";
theShow = theShow + "收到数据: " + data.result + "\n";
theShow = theShow + "收到数据16进制: " + data.resultH + "\n";
theShow = theShow + "解析数据: " + JSON.stringify(data.parse) + "\n";
$("#showFeedback").val(theShow)
}else{
......
......@@ -77,6 +77,7 @@ $("#sendMsgBtn").click(function(){
data["carSign"] = carSign;
var host = window.location.host;
$("#showFeedback").val("")
$.ajax({
url:"http://" + host + "/messageTools/message_process/porcessTerminalRegisterMsg",
type:"post",
......@@ -87,6 +88,7 @@ $("#sendMsgBtn").click(function(){
//window.location.reload()
var theShow = "原始数据: " + data.original + "\n";
theShow = theShow + "收到数据: " + data.result + "\n";
theShow = theShow + "收到数据16进制: " + data.resultH + "\n";
theShow = theShow + "解析数据: " + JSON.stringify(data.parse) + "\n";
$("#showFeedback").val(theShow)
}else{
......
......@@ -89,6 +89,7 @@ $("#sendMsgBtn").click(function(){
data["totalOilExpend"] = totalOilExpend;
var host = window.location.host;
$("#showFeedback").val("")
$.ajax({
url:"http://" + host + "/messageTools/message_process/porcessTerminalVersionInfoUploadMsg",
type:"post",
......@@ -99,6 +100,7 @@ $("#sendMsgBtn").click(function(){
//window.location.reload()
var theShow = "原始数据: " + data.original + "\n";
theShow = theShow + "收到数据: " + data.result + "\n";
theShow = theShow + "收到数据16进制: " + data.resultH + "\n";
theShow = theShow + "解析数据: " + JSON.stringify(data.parse) + "\n";
$("#showFeedback").val(theShow)
}else{
......
......@@ -140,6 +140,7 @@
data["GPSTimestamp"] = GPSTimestamp;
var host = window.location.host;
$("#showFeedback").val("")
$.ajax({
url:"http://" + host + "/protocolTools/protocolReport_process/porcessGPSMsg",
type:"post",
......@@ -148,7 +149,11 @@
success:function(data){
if(data.status == 200){
//window.location.reload()
$("#showFeedback").val(data.result)
msg = "发送消息:" + data.msgSend + "\n"
msg = msg + "收到消息:" + data.result + "\n"
msg = msg + "收到消息16进制:" + data.rev + "\n"
msg = msg + "收到消息解析结果:" + data.orgRev + "\n"
$("#showFeedback").val(msg)
}else{
$("#showFeedback").val(data.message)
alert(data.message);
......
......@@ -191,6 +191,7 @@ $("#sendMsgBtn").click(function(){
data["GPSMileage"] = GPSMileage;
var host = window.location.host;
$("#showFeedback").val("")
$.ajax({
url:"http://" + host + "/protocolTools/protocolReport_process/porcessOBD_CAN_Msg",
type:"post",
......@@ -199,7 +200,11 @@ $("#sendMsgBtn").click(function(){
success:function(data){
if(data.status == 200){
//window.location.reload()
$("#showFeedback").val(data.result)
msg = "发送消息:" + data.msgSend + "\n"
msg = msg + "收到消息:" + data.result + "\n"
msg = msg + "收到消息16进制:" + data.rev + "\n"
msg = msg + "收到消息解析结果:" + data.orgRev + "\n"
$("#showFeedback").val(msg)
}else{
$("#showFeedback").val(data.message)
alert(data.message);
......
......@@ -31,6 +31,7 @@ $("#sendMsgBtn").click(function(){
data["DEV_ID"] = DEV_ID;
var host = window.location.host;
$("#showFeedback").val("")
$.ajax({
url:"http://" + host + "/protocolTools/protocolReport_process/porcessHeartBeatMsg",
type:"post",
......@@ -39,7 +40,11 @@ $("#sendMsgBtn").click(function(){
success:function(data){
if(data.status == 200){
//window.location.reload()
$("#showFeedback").val(data.result)
msg = "发送消息:" + data.msgSend + "\n"
msg = msg + "收到消息:" + data.result + "\n"
msg = msg + "收到消息16进制:" + data.rev + "\n"
msg = msg + "收到消息解析结果:" + data.orgRev + "\n"
$("#showFeedback").val(msg)
}else{
$("#showFeedback").val(data.message)
alert(data.message);
......
......@@ -44,6 +44,7 @@ $("#sendMsgBtn").click(function(){
data["imei"] = imei
var host = window.location.host;
$("#showFeedback").val("")
$.ajax({
url:"http://" + host + "/protocolTools/protocolReport_process/porcessLoginMsg",
type:"post",
......@@ -51,8 +52,11 @@ $("#sendMsgBtn").click(function(){
dataType:"json",
success:function(data){
if(data.status == 200){
//window.location.reload()
$("#showFeedback").val(data.result)
msg = "发送消息:" + data.msgSend + "\n"
msg = msg + "收到消息:" + data.result + "\n"
msg = msg + "收到消息16进制:" + data.rev + "\n"
msg = msg + "收到消息解析结果:" + data.orgRev + "\n"
$("#showFeedback").val(msg)
}else{
$("#showFeedback").val(data.message)
alert(data.message);
......
......@@ -333,6 +333,7 @@ $("#sendMsgBtn").click(function(){
data["dataByte"] = dataByte
var host = window.location.host;
$("#showFeedback").val("")
$.ajax({
url:"http://" + host + "/protocolTools/protocolReport_process/porcessSecurityStatusMsg",
type:"post",
......@@ -341,7 +342,11 @@ $("#sendMsgBtn").click(function(){
success:function(data){
if(data.status == 200){
//window.location.reload()
$("#showFeedback").val(data.result)
msg = "发送消息:" + data.msgSend + "\n"
msg = msg + "收到消息:" + data.result + "\n"
msg = msg + "收到消息16进制:" + data.rev + "\n"
msg = msg + "收到消息解析结果:" + data.orgRev + "\n"
$("#showFeedback").val(msg)
}else{
$("#showFeedback").val(data.message)
alert(data.message);
......
......@@ -52,7 +52,9 @@ def porcessHeartBeatMsg():
data["message"] = "Sucess: "
data["original"] = msg
data["result"] = socRecv_2
data["parse"] = json.loads(PlatformCommon_res(socRecv_1).getMsg())
msgP = PlatformCommon_res(socRecv_1)
data["resultH"] = msgP.getOriginalMsg()
data["parse"] = json.loads(msgP.getMsg())
except BaseException as e:
# 打印异常信息
traceback.print_exc()
......@@ -104,7 +106,9 @@ def porcessTerminalRegisterMsg():
data["message"] = "Sucess: "
data["original"] = msg
data["result"] = socRecv_2
data["parse"] = json.loads(PlatformCommon_res(socRecv_1).getMsg())
msgP = PlatformCommon_res(socRecv_1)
data["resultH"] = msgP.getOriginalMsg()
data["parse"] = json.loads(msgP.getMsg())
except BaseException as e:
# 打印异常信息
traceback.print_exc()
......@@ -162,7 +166,9 @@ def porcessTerminalVersionInfoUploadMsg():
data["message"] = "Sucess: "
data["original"] = msg
data["result"] = socRecv_2
data["parse"] = json.loads(PlatefromVersionInfo_res(socRecv_1).getMsg())
msgP = PlatformCommon_res(socRecv_1)
data["resultH"] = msgP.getOriginalMsg()
data["parse"] = json.loads(msgP.getMsg())
except BaseException as e:
# 打印异常信息
traceback.print_exc()
......@@ -278,7 +284,9 @@ def porcessDataUpstreamTransportMsg():
data["message"] = "Sucess: "
data["original"] = msg
data["result"] = socRecv_2
data["parse"] = json.loads(PlatformCommon_res(socRecv_1).getMsg())
msgP = PlatformCommon_res(socRecv_1)
data["resultH"] = msgP.getOriginalMsg()
data["parse"] = json.loads(msgP.getMsg())
except BaseException as e:
# 打印异常信息
traceback.print_exc()
......@@ -333,7 +341,9 @@ def porcessDataUpstreamTransportMsg_F2():
data["message"] = "Sucess: "
data["original"] = msg
data["result"] = socRecv_2
data["parse"] = json.loads(PlatformCommon_res(socRecv_1).getMsg())
msgP = PlatformCommon_res(socRecv_1)
data["resultH"] = msgP.getOriginalMsg()
data["parse"] = json.loads(msgP.getMsg())
except BaseException as e:
# 打印异常信息
traceback.print_exc()
......@@ -382,7 +392,9 @@ def porcessDataUpstreamTransportMsg_F3():
data["message"] = "Sucess: "
data["original"] = msg
data["result"] = socRecv_2
data["parse"] = json.loads(PlatformCommon_res(socRecv_1).getMsg())
msgP = PlatformCommon_res(socRecv_1)
data["resultH"] = msgP.getOriginalMsg()
data["parse"] = json.loads(msgP.getMsg())
except BaseException as e:
# 打印异常信息
traceback.print_exc()
......@@ -437,7 +449,9 @@ def porcessDataUpstreamTransportMsg_F4():
data["message"] = "Sucess: "
data["original"] = msg
data["result"] = socRecv_2
data["parse"] = json.loads(PlatformCommon_res(socRecv_1).getMsg())
msgP = PlatformCommon_res(socRecv_1)
data["resultH"] = msgP.getOriginalMsg()
data["parse"] = json.loads(msgP.getMsg())
except BaseException as e:
# 打印异常信息
traceback.print_exc()
......
......@@ -39,11 +39,14 @@ def porcessHeartBeatMsg():
msg = heartBeatProtocolObj.generateHeartBeatMsg()
cliSocket.send(msg)
socRecv = cliSocket.receive()
socRecv = str(socRecv)
socRecvo = str(socRecv)
cliSocket.close()
data["status"] = "200"
data["message"] = "Sucess: "
data["result"] = socRecv
data["msgSend"] = msg
data["result"] = socRecvo
data["rev"] = str(binascii.b2a_hex(socRecv))[2:][:-1]
data["orgRev"] = "*********返回的消息还未解析*********"
except BaseException as e:
# 打印异常信息
traceback.print_exc()
......@@ -80,11 +83,14 @@ def porcessLoginBeatMsg():
msg = loginProtocolObj.generateLoginMsg()
cliSocket.send(msg)
socRecv = cliSocket.receive()
socRecv = str(socRecv)
socRecvo = str(socRecv)
cliSocket.close()
data["status"] = "200"
data["message"] = "Sucess: "
data["result"] = socRecv
data["msgSend"] = msg
data["result"] = socRecvo
data["rev"] = str(binascii.b2a_hex(socRecv))[2:][:-1]
data["orgRev"] = "*********返回的消息还未解析*********"
except BaseException as e:
# 打印异常信息
traceback.print_exc()
......@@ -137,12 +143,14 @@ def porcessGPSMsg():
msg = GPSProtocolObj.generateGpsMsg()
cliSocket.send(msg)
socRecv = cliSocket.receive()
socRecv = str(socRecv)
# socRecv = str(binascii.b2a_hex(socRecv))
socRecvo = str(socRecv)
cliSocket.close()
data["status"] = "200"
data["message"] = "Sucess: "
data["result"] = socRecv
data["msgSend"] = msg
data["result"] = socRecvo
data["rev"] = str(binascii.b2a_hex(socRecv))[2:][:-1]
data["orgRev"] = "*********返回的消息还未解析*********"
except BaseException as e:
# 打印异常信息
traceback.print_exc()
......@@ -220,12 +228,14 @@ def porcessOBD_CAN_Msg():
msg = OBD_CAN_protocolObj.generateOBDReportCANMsg()
cliSocket.send(msg)
socRecv = cliSocket.receive()
socRecv = str(socRecv)
# socRecv = str(binascii.b2a_hex(socRecv))
socRecvo = str(socRecv)
cliSocket.close()
data["status"] = "200"
data["message"] = "Sucess: "
data["result"] = socRecv
data["msgSend"] = msg
data["result"] = socRecvo
data["rev"] = str(binascii.b2a_hex(socRecv))[2:][:-1]
data["orgRev"] = "*********返回的消息还未解析*********"
except BaseException as e:
# 打印异常信息
traceback.print_exc()
......@@ -269,11 +279,14 @@ def porcessSecurityStatusMsg():
msg = securityStatusProtocolObj.generateSecurityStatusMsg()
cliSocket.send(msg)
socRecv = cliSocket.receive()
socRecv = str(socRecv)
socRecvo = str(socRecv)
cliSocket.close()
data["status"] = "200"
data["message"] = "Sucess: "
data["result"] = socRecv
data["msgSend"] = msg
data["result"] = socRecvo
data["rev"] = str(binascii.b2a_hex(socRecv))[2:][:-1]
data["orgRev"] = "*********返回的消息还未解析*********"
except BaseException as e:
# 打印异常信息
traceback.print_exc()
......
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