#400 start of peripherals list app
This commit is contained in:
parent
83e29abea7
commit
e3d0692dcc
0
pocket/ui/apps/devices.lua
Normal file
0
pocket/ui/apps/devices.lua
Normal file
@ -55,7 +55,8 @@ local MGMT_TYPE = {
|
|||||||
DIAG_TONE_GET = 6, -- (API) diagnostic: get alarm tones
|
DIAG_TONE_GET = 6, -- (API) diagnostic: get alarm tones
|
||||||
DIAG_TONE_SET = 7, -- (API) diagnostic: set alarm tones
|
DIAG_TONE_SET = 7, -- (API) diagnostic: set alarm tones
|
||||||
DIAG_ALARM_SET = 8, -- (API) diagnostic: set alarm to simulate audio for
|
DIAG_ALARM_SET = 8, -- (API) diagnostic: set alarm to simulate audio for
|
||||||
INFO_LIST_CMP = 9 -- (API) info: list all computers on the network
|
INFO_LIST_CMP = 9, -- (API) info: list all computers on the network
|
||||||
|
INFO_LIST_PERI = 10 -- (API) info: list all peripherals on the network
|
||||||
}
|
}
|
||||||
|
|
||||||
---@enum CRDN_TYPE
|
---@enum CRDN_TYPE
|
||||||
|
|||||||
@ -226,6 +226,46 @@ function pocket.new_session(id, s_addr, i_seq_num, in_queue, out_queue, timeout,
|
|||||||
end
|
end
|
||||||
|
|
||||||
_send_mgmt(MGMT_TYPE.INFO_LIST_CMP, devices)
|
_send_mgmt(MGMT_TYPE.INFO_LIST_CMP, devices)
|
||||||
|
elseif pkt.type == MGMT_TYPE.INFO_LIST_PERI then
|
||||||
|
local data = {}
|
||||||
|
|
||||||
|
local fac = db.facility
|
||||||
|
local proc = process.get_control_states().process
|
||||||
|
|
||||||
|
-- unit data
|
||||||
|
for i = 1, #db.units do
|
||||||
|
local u = db.units[i]
|
||||||
|
|
||||||
|
data[i] = {}
|
||||||
|
|
||||||
|
data[i].boilers = {}
|
||||||
|
for idx, blr in ipairs(u.boiler_data_tbl) do
|
||||||
|
data[i].boilers[idx] = {}
|
||||||
|
|
||||||
|
if blr.formed ~= nil then
|
||||||
|
data[i].boilers[idx] = { blr.formed, blr.build.min_pos, blr.build.max_pos, blr.build.length, blr.build.width, blr.build.height }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
data[i].turbines = {}
|
||||||
|
for idx, trb in ipairs(u.turbine_data_tbl) do
|
||||||
|
data[i].turbines[idx] = {}
|
||||||
|
|
||||||
|
if trb.formed ~= nil then
|
||||||
|
data[i].turbines[idx] = { trb.formed, trb.build.min_pos, trb.build.max_pos, trb.build.length, trb.build.width, trb.build.height }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
data[i].tanks = {}
|
||||||
|
for idx, trb in ipairs(u.tank_data_tbl) do
|
||||||
|
data[i].turbines[idx] = {}
|
||||||
|
|
||||||
|
if trb.formed ~= nil then
|
||||||
|
data[i].turbines[idx] = { trb.formed, trb.build.min_pos, trb.build.max_pos, trb.build.length, trb.build.width, trb.build.height }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
log.debug(log_tag .. "handler received unsupported SCADA_MGMT packet type " .. pkt.type)
|
log.debug(log_tag .. "handler received unsupported SCADA_MGMT packet type " .. pkt.type)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user