Commit 6109db68 authored by liyuanhong's avatar liyuanhong

完成批量数据上传消息

parent f3cf20d4
This diff is collapsed.
...@@ -3,14 +3,17 @@ import binascii ...@@ -3,14 +3,17 @@ import binascii
import socket import socket
from time import sleep from time import sleep
from lib.protocol.LocationDataBatchUpdate_msg import LocationDataBatchUpdate_msg
from lib.protocol.message.DataUpstreamTransport_msg import DataUpstreamTransport_msg from lib.protocol.message.DataUpstreamTransport_msg import DataUpstreamTransport_msg
from lib.protocol.message.Location_msg import Location_msg from lib.protocol.message.Location_msg import Location_msg
from lib.protocol.message.MessageBase import MessageBase from lib.protocol.message.MessageBase import MessageBase
from lib.protocol.message.QueryTerminalParam_res import QueryTerminalParam_res from lib.protocol.message.QueryTerminalParam_res import QueryTerminalParam_res
from lib.protocol.message.QueryTerminalProperty_res import QueryTerminalProperty_res
from lib.protocol.message.TerminalAuthenticate_msg import TerminalAuthenticate_msg from lib.protocol.message.TerminalAuthenticate_msg import TerminalAuthenticate_msg
from lib.protocol.message.TerminalCommonMsgRes_msg import TerminalCommonMsgRes_msg from lib.protocol.message.TerminalCommonMsgRes_msg import TerminalCommonMsgRes_msg
from lib.protocol.message.TerminalHeartbeat_msg import TerminalHeartbeat_msg from lib.protocol.message.TerminalHeartbeat_msg import TerminalHeartbeat_msg
from lib.protocol.message.TerminalRegister_msg import TerminalRegister_msg from lib.protocol.message.TerminalRegister_msg import TerminalRegister_msg
from lib.protocol.message.TerminalUpdateResult_msg import TerminalUpdataResult_msg
from lib.protocol.message.TerminalVersionInfo_msg import TerminalVersionInfo_msg from lib.protocol.message.TerminalVersionInfo_msg import TerminalVersionInfo_msg
from lib.protocol.message.data.TerminalCancle_msg import TerminalCancle_msg from lib.protocol.message.data.TerminalCancle_msg import TerminalCancle_msg
from lib.protocol.messagePlateform.PlatformCommon_res import PlatformCommon_res from lib.protocol.messagePlateform.PlatformCommon_res import PlatformCommon_res
...@@ -26,9 +29,12 @@ port = 9001 ...@@ -26,9 +29,12 @@ port = 9001
# msg = TerminalCancle_msg().generateMsg() #终端注销 # msg = TerminalCancle_msg().generateMsg() #终端注销
# msg = TerminalAuthenticate_msg().generateMsg() #终端鉴权 # msg = TerminalAuthenticate_msg().generateMsg() #终端鉴权
# msg = TerminalVersionInfo_msg().generateMsg() #终端版本信息上报 # msg = TerminalVersionInfo_msg().generateMsg() #终端版本信息上报
msg = QueryTerminalParam_res().generateMsg() #查询终端参数应答 # msg = QueryTerminalParam_res().generateMsg() #查询终端参数应答
# msg = QueryTerminalProperty_res().generateMsg() #查询终端属性应答消息
# msg = Location_msg().generateMsg() #位置信息汇报 # msg = Location_msg().generateMsg() #位置信息汇报
# msg = DataUpstreamTransport_msg().generateMsg() #数据上行透传消息 # msg = DataUpstreamTransport_msg().generateMsg() #数据上行透传消息
# msg = TerminalUpdataResult_msg().generateMsg() #终端升级结果通知
msg = LocationDataBatchUpdate_msg().generateMsg() #定位数据批量上传
#发送单条消息 #发送单条消息
def sendSingleMsg(msg): def sendSingleMsg(msg):
...@@ -42,8 +48,8 @@ def sendSingleMsg(msg): ...@@ -42,8 +48,8 @@ def sendSingleMsg(msg):
# client.send(bytes.fromhex(msg)) # client.send(bytes.fromhex(msg))
data = client.recv(BUF_SIZE) data = client.recv(BUF_SIZE)
print(data) print(data)
print(PlatformCommon_res(data).getMsg()) print(PlatformCommon_res(data).getMsg()) #终端通用应答消息
# print(TerminalRegister_res(data).getMsg()) # print(TerminalRegister_res(data).getMsg()) #终端注册应答消息
client.close() client.close()
def closeSocket(soc): def closeSocket(soc):
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<option value="0"></option> <option value="0"></option>
<option value="8192"></option> <option value="8192"></option>
</select> </select>
<label id="subPkg_label" style="color:grey;">分包个数:</label><input disabled="disabled" id="pkgCounts" type="text" class="form-control" value="2" style="width:60px;"> <label id="subPkg_label" style="color:grey;">分包个数:</label><input disabled="disabled" id="pkgCounts" type="text" class="form-control" value="0" style="width:60px;">
</div> </div>
<H3 style="border-bottom: 1px solid #eee;">设置心跳消息内容:</H3> <H3 style="border-bottom: 1px solid #eee;">设置心跳消息内容:</H3>
<ul class="protocol_content" style="padding:0px;"> <ul class="protocol_content" style="padding:0px;">
...@@ -96,8 +96,9 @@ ...@@ -96,8 +96,9 @@
success:function(data){ success:function(data){
if(data.status == 200){ if(data.status == 200){
//window.location.reload() //window.location.reload()
var theShow = "原始数据: " + data.result + "\n" var theShow = "原始数据: " + data.original + "\n";
theShow = theShow + "解析数据: " + JSON.stringify(data.parse) + "\n" theShow = theShow + "收到数据: " + data.result + "\n";
theShow = theShow + "解析数据: " + JSON.stringify(data.parse) + "\n";
$("#showFeedback").val(theShow) $("#showFeedback").val(theShow)
}else{ }else{
$("#showFeedback").val(data.message) $("#showFeedback").val(data.message)
......
...@@ -46,6 +46,7 @@ def porcessHeartBeatMsg(): ...@@ -46,6 +46,7 @@ def porcessHeartBeatMsg():
cliSocket.close() cliSocket.close()
data["status"] = "200" data["status"] = "200"
data["message"] = "Sucess: " data["message"] = "Sucess: "
data["original"] = msg
data["result"] = socRecv_2 data["result"] = socRecv_2
data["parse"] = PlatformCommon_res(socRecv_1).getMsg() data["parse"] = PlatformCommon_res(socRecv_1).getMsg()
except BaseException as e: except BaseException as e:
......
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