fix logging

This commit is contained in:
2021-11-04 10:43:01 -05:00
parent 3d29ea86e3
commit 982518403c
+17 -13
View File
@@ -745,19 +745,19 @@ if (Controls) then
return dump .. hex .. string.rep( " ", 8 - len % 8 ) .. asc return dump .. hex .. string.rep( " ", 8 - len % 8 ) .. asc
end end
function processResponse(data) -- function processResponse(data)
local response = "" -- local response = ""
for k,v in pairs(data) do -- for k,v in pairs(data) do
response = response .. string.pack("B", v) -- response = response .. string.pack("B", v)
end -- end
print("Processing Packet") -- print("Processing Packet")
print(hex_dump(response)) -- print(hex_dump(response))
if data == getCmdString(NovaStar.Response.Connected) then -- if data == getCmdString(NovaStar.Response.Connected) then
print("Successful Connection Response Received") -- print("Successful Connection Response Received")
NovaStar.setStatus(0,"Connected - " .. Properties['IP Address'].Value) -- NovaStar.setStatus(0,"Connected - " .. Properties['IP Address'].Value)
end -- end
end -- end
NovaStar.socket.Connected = function() NovaStar.socket.Connected = function()
print("TCP Connection Established to NovaStar @ " .. Properties['IP Address'].Value) print("TCP Connection Established to NovaStar @ " .. Properties['IP Address'].Value)
@@ -773,7 +773,11 @@ if (Controls) then
NovaStar.socket.Data = function () NovaStar.socket.Data = function ()
print("Reading " .. NovaStar.socket.BufferLength .. " Bytes") print("Reading " .. NovaStar.socket.BufferLength .. " Bytes")
local data = NovaStar.socket:Read(NovaStar.socket.BufferLength); local data = NovaStar.socket:Read(NovaStar.socket.BufferLength);
processResponse(data) print(hex_dump(data))
if data == getCmdString(NovaStar.Response.Connected) then
print("Successful Connection Response Received")
NovaStar.setStatus(0,"Connected - " .. Properties['IP Address'].Value)
end
end end
NovaStar.socket.Closed = function() NovaStar.socket.Closed = function()