mirror of
https://github.com/kepler155c/opus
synced 2025-01-17 10:52:53 +00:00
Distance filter in Sniffer
This commit is contained in:
parent
cd2024d7ce
commit
b3efbc7438
@ -73,13 +73,24 @@ local page = UI.Page {
|
|||||||
event = 'filter_add',
|
event = 'filter_add',
|
||||||
},
|
},
|
||||||
filterAllCheck = UI.Checkbox {
|
filterAllCheck = UI.Checkbox {
|
||||||
x = 13, y = 4,
|
x = 14, y = 8,
|
||||||
value = false,
|
value = false,
|
||||||
},
|
},
|
||||||
filterAddText = UI.Text {
|
filterAddText = UI.Text {
|
||||||
x = 17, y = 4,
|
x = 18, y = 8,
|
||||||
value = "Use ID filter",
|
value = "Use ID filter",
|
||||||
},
|
},
|
||||||
|
rangeText = UI.Text {
|
||||||
|
x = 15, y = 2,
|
||||||
|
value = "Distance filter",
|
||||||
|
},
|
||||||
|
rangeEntry = UI.TextEntry {
|
||||||
|
x = 15, y = 3,
|
||||||
|
width = 10,
|
||||||
|
limit = 8,
|
||||||
|
shadowText = 'Range',
|
||||||
|
transform = 'number',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
modemTab = UI.Tab {
|
modemTab = UI.Tab {
|
||||||
tabTitle = 'Modem',
|
tabTitle = 'Modem',
|
||||||
@ -268,8 +279,14 @@ function page.packetSlide:eventHandler(event)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function page.packetGrid:getDisplayValues(row)
|
||||||
|
local row = Util.shallowCopy(row)
|
||||||
|
row.distance = Util.toBytes(Util.round(row.distance), 2)
|
||||||
|
return row
|
||||||
|
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 (packet.distance <= (filterConfig.rangeEntry.value or math.huge)) and (not filterConfig.filterAllCheck.value or filterConfig.filterGrid.values[packet.portid]) then
|
||||||
page.index = page.index + 1
|
page.index = page.index + 1
|
||||||
local _, res = pcall(textutils.serialize, packet.message)
|
local _, res = pcall(textutils.serialize, packet.message)
|
||||||
packet.packetStr = res:gsub("\n%s*", "")
|
packet.packetStr = res:gsub("\n%s*", "")
|
||||||
|
Loading…
Reference in New Issue
Block a user