#367 RTU fail enum and logging messages

This commit is contained in:
Mikayla
2024-08-22 16:42:57 +00:00
parent a1b6ff4bcc
commit a087eda0ee
6 changed files with 72 additions and 36 deletions

View File

@@ -2,6 +2,8 @@
-- RTU ID Check Failure Entry
--
local types = require("scada-common.types")
local style = require("supervisor.panel.style")
local core = require("graphics.core")
@@ -25,10 +27,10 @@ local function init(parent, msg, fail_code)
local fg_bg = cpair(colors.black,colors.yellow)
local tag = "MISSING"
if fail_code == 1 then
if fail_code == types.RTU_ID_FAIL.OUT_OF_RANGE then
fg_bg = cpair(colors.black,colors.orange)
tag = "BAD INDEX"
elseif fail_code == 2 then
elseif fail_code == types.RTU_ID_FAIL.DUPLICATE then
fg_bg = cpair(colors.black,colors.red)
tag = "DUPLICATE"
end

View File

@@ -109,6 +109,7 @@ function pgi.delete_pdg_entry(session_id)
end
-- add a device ID check failure entry to the CHK list
---@note this assumes only one type of failure can occur per each RTU gateway session's RTU, which is the case
---@param unit unit_session RTU session
---@param fail_code integer failure code
---@param msg string description to show the user
@@ -130,6 +131,7 @@ function pgi.create_chk_entry(unit, fail_code, msg)
end
-- delete a device ID check failure entry from the CHK list
---@note this assumes only one type of failure can occur per each RTU gateway session's RTU, which is the case
---@param unit unit_session RTU session
function pgi.delete_chk_entry(unit)
local gw_session = unit.get_session_id()