mirror of
https://github.com/kepler155c/opus
synced 2025-01-03 20:30:28 +00:00
Show serialized packet in packetGrid
This commit is contained in:
parent
f1b9dcc4f4
commit
ae2ea81d1d
@ -13,7 +13,7 @@ table.insert(gridColumns, { heading = '#', key = 'id', width = 5, align = 'righ
|
|||||||
table.insert(gridColumns, { heading = 'Port', key = 'portid', width = 5, align = 'right' })
|
table.insert(gridColumns, { heading = 'Port', key = 'portid', width = 5, align = 'right' })
|
||||||
table.insert(gridColumns, { heading = 'Reply', key = 'replyid', width = 5, align = 'right' })
|
table.insert(gridColumns, { heading = 'Reply', key = 'replyid', width = 5, align = 'right' })
|
||||||
if UI.defaultDevice.width > 50 then table.insert(gridColumns, { heading = 'Dist', key = 'distance', width = 6, align = 'right' }) end
|
if UI.defaultDevice.width > 50 then table.insert(gridColumns, { heading = 'Dist', key = 'distance', width = 6, align = 'right' }) end
|
||||||
table.insert(gridColumns, { heading = 'Msg', key = 'message' })
|
table.insert(gridColumns, { heading = 'Msg', key = 'packetStr' })
|
||||||
|
|
||||||
local page = UI.Page {
|
local page = UI.Page {
|
||||||
paused = false,
|
paused = false,
|
||||||
@ -269,6 +269,8 @@ end
|
|||||||
function page.packetGrid:addPacket(packet)
|
function page.packetGrid:addPacket(packet)
|
||||||
if not page.paused and (not filterConfig.filterAllCheck.value or filterConfig.filterGrid.values[packet.portid]) then
|
if not page.paused and (not filterConfig.filterAllCheck.value or filterConfig.filterGrid.values[packet.portid]) then
|
||||||
page.index = page.index + 1
|
page.index = page.index + 1
|
||||||
|
local p, res = pcall(textutils.serialize, packet.message)
|
||||||
|
packet.packetStr = res:gsub("\n%s*", "")
|
||||||
table.insert(self.values, packet)
|
table.insert(self.values, packet)
|
||||||
end
|
end
|
||||||
if #self.values > self.maxPacket then
|
if #self.values > self.maxPacket then
|
||||||
@ -341,7 +343,7 @@ function page:eventHandler(event)
|
|||||||
end
|
end
|
||||||
|
|
||||||
Event.on('modem_message', function(event, side, chan, reply, msg, dist)
|
Event.on('modem_message', function(event, side, chan, reply, msg, dist)
|
||||||
if modemConfig.currentModem.side == side then
|
if modemConfig.currentModem.side == side then
|
||||||
page.packetGrid:addPacket({
|
page.packetGrid:addPacket({
|
||||||
id = page.index,
|
id = page.index,
|
||||||
portid = chan,
|
portid = chan,
|
||||||
|
Loading…
Reference in New Issue
Block a user