2023-07-10 03:31:56 +00:00
|
|
|
--
|
|
|
|
-- Pocket Connection Entry
|
|
|
|
--
|
|
|
|
|
|
|
|
local iocontrol = require("coordinator.iocontrol")
|
|
|
|
|
2023-09-02 02:24:31 +00:00
|
|
|
local style = require("coordinator.ui.style")
|
|
|
|
|
2023-07-10 03:31:56 +00:00
|
|
|
local core = require("graphics.core")
|
|
|
|
|
|
|
|
local Div = require("graphics.elements.div")
|
|
|
|
local TextBox = require("graphics.elements.textbox")
|
|
|
|
|
|
|
|
local DataIndicator = require("graphics.elements.indicators.data")
|
|
|
|
|
2023-10-04 03:16:46 +00:00
|
|
|
local ALIGN = core.ALIGN
|
2023-07-10 03:31:56 +00:00
|
|
|
|
|
|
|
local cpair = core.cpair
|
|
|
|
|
|
|
|
-- create a pocket list entry
|
|
|
|
---@param parent graphics_element parent
|
|
|
|
---@param id integer PKT session ID
|
|
|
|
local function init(parent, id)
|
2024-03-07 04:35:30 +00:00
|
|
|
local s_hi_box = style.fp_theme.highlight_box
|
|
|
|
local s_hi_bright = style.fp_theme.highlight_box_bright
|
|
|
|
|
|
|
|
local label_fg = style.fp.label_fg
|
|
|
|
|
2023-07-10 03:31:56 +00:00
|
|
|
local ps = iocontrol.get_db().fp.ps
|
|
|
|
|
|
|
|
-- root div
|
|
|
|
local root = Div{parent=parent,x=2,y=2,height=4,width=parent.get_width()-2,hidden=true}
|
2024-03-06 16:43:31 +00:00
|
|
|
local entry = Div{parent=root,x=2,y=1,height=3,fg_bg=s_hi_bright}
|
2023-07-10 03:31:56 +00:00
|
|
|
|
|
|
|
local ps_prefix = "pkt_" .. id .. "_"
|
|
|
|
|
2024-06-30 17:55:13 +00:00
|
|
|
TextBox{parent=entry,x=1,y=1,text="",width=8,fg_bg=s_hi_box}
|
|
|
|
local pkt_addr = TextBox{parent=entry,x=1,y=2,text="@ C ??",alignment=ALIGN.CENTER,width=8,fg_bg=s_hi_box,nav_active=cpair(colors.gray,colors.black)}
|
|
|
|
TextBox{parent=entry,x=1,y=3,text="",width=8,fg_bg=s_hi_box}
|
2023-07-10 03:31:56 +00:00
|
|
|
pkt_addr.register(ps, ps_prefix .. "addr", pkt_addr.set_value)
|
|
|
|
|
2024-06-30 17:55:13 +00:00
|
|
|
TextBox{parent=entry,x=10,y=2,text="FW:",width=3}
|
|
|
|
local pkt_fw_v = TextBox{parent=entry,x=14,y=2,text=" ------- ",width=20,fg_bg=label_fg}
|
2023-07-10 03:31:56 +00:00
|
|
|
pkt_fw_v.register(ps, ps_prefix .. "fw", pkt_fw_v.set_value)
|
|
|
|
|
2024-06-30 17:55:13 +00:00
|
|
|
TextBox{parent=entry,x=35,y=2,text="RTT:",width=4}
|
2024-03-06 16:43:31 +00:00
|
|
|
local pkt_rtt = DataIndicator{parent=entry,x=40,y=2,label="",unit="",format="%5d",value=0,width=5,fg_bg=label_fg}
|
2024-06-30 17:55:13 +00:00
|
|
|
TextBox{parent=entry,x=46,y=2,text="ms",width=4,fg_bg=label_fg}
|
2023-07-10 03:31:56 +00:00
|
|
|
pkt_rtt.register(ps, ps_prefix .. "rtt", pkt_rtt.update)
|
|
|
|
pkt_rtt.register(ps, ps_prefix .. "rtt_color", pkt_rtt.recolor)
|
|
|
|
|
|
|
|
return root
|
|
|
|
end
|
|
|
|
|
|
|
|
return init
|