From c53ddf16385c8b19a991fa9c266bd3b6d9bf7b71 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Fri, 13 May 2022 10:27:57 -0400 Subject: [PATCH] renamed RTU_ADVERT_TYPES to RTU_UNIT_TYPES --- rtu/rtu.lua | 4 ++-- scada-common/comms.lua | 38 +++++++++++++++++++------------------- supervisor/session/rtu.lua | 16 ++++++++-------- supervisor/supervisor.lua | 2 +- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/rtu/rtu.lua b/rtu/rtu.lua index 637be54..ec963b8 100644 --- a/rtu/rtu.lua +++ b/rtu/rtu.lua @@ -12,7 +12,7 @@ local rtu_t = types.rtu_t local PROTOCOLS = comms.PROTOCOLS local SCADA_MGMT_TYPES = comms.SCADA_MGMT_TYPES -local RTU_ADVERT_TYPES = comms.RTU_ADVERT_TYPES +local RTU_UNIT_TYPES = comms.RTU_UNIT_TYPES local print = util.print local println = util.println @@ -262,7 +262,7 @@ rtu.comms = function (modem, local_port, server_port, conn_watchdog) unit.reactor } - if type == RTU_ADVERT_TYPES.REDSTONE then + if type == RTU_UNIT_TYPES.REDSTONE then insert(advert, unit.device) end diff --git a/scada-common/comms.lua b/scada-common/comms.lua index 6b4deef..bffd98f 100644 --- a/scada-common/comms.lua +++ b/scada-common/comms.lua @@ -48,8 +48,8 @@ local SCADA_MGMT_TYPES = { REMOTE_LINKED = 3 -- remote device linked } ----@alias RTU_ADVERT_TYPES integer -local RTU_ADVERT_TYPES = { +---@alias RTU_UNIT_TYPES integer +local RTU_UNIT_TYPES = { REDSTONE = 0, -- redstone I/O BOILER = 1, -- boiler BOILER_VALVE = 2, -- boiler mekanism 10.1+ @@ -63,7 +63,7 @@ comms.PROTOCOLS = PROTOCOLS comms.RPLC_TYPES = RPLC_TYPES comms.RPLC_LINKING = RPLC_LINKING comms.SCADA_MGMT_TYPES = SCADA_MGMT_TYPES -comms.RTU_ADVERT_TYPES = RTU_ADVERT_TYPES +comms.RTU_UNIT_TYPES = RTU_UNIT_TYPES -- generic SCADA packet object comms.scada_packet = function () @@ -562,44 +562,44 @@ end -- convert rtu_t to RTU advertisement type ---@param type rtu_t ----@return RTU_ADVERT_TYPES|nil +---@return RTU_UNIT_TYPES|nil comms.rtu_t_to_advert_type = function (type) if type == rtu_t.redstone then - return RTU_ADVERT_TYPES.REDSTONE + return RTU_UNIT_TYPES.REDSTONE elseif type == rtu_t.boiler then - return RTU_ADVERT_TYPES.BOILER + return RTU_UNIT_TYPES.BOILER elseif type == rtu_t.boiler_valve then - return RTU_ADVERT_TYPES.BOILER_VALVE + return RTU_UNIT_TYPES.BOILER_VALVE elseif type == rtu_t.turbine then - return RTU_ADVERT_TYPES.TURBINE + return RTU_UNIT_TYPES.TURBINE elseif type == rtu_t.turbine_valve then - return RTU_ADVERT_TYPES.TURBINE_VALVE + return RTU_UNIT_TYPES.TURBINE_VALVE elseif type == rtu_t.energy_machine then - return RTU_ADVERT_TYPES.EMACHINE + return RTU_UNIT_TYPES.EMACHINE elseif type == rtu_t.induction_matrix then - return RTU_ADVERT_TYPES.IMATRIX + return RTU_UNIT_TYPES.IMATRIX end return nil end -- convert RTU advertisement type to rtu_t ----@param atype RTU_ADVERT_TYPES +---@param atype RTU_UNIT_TYPES ---@return rtu_t|nil comms.advert_type_to_rtu_t = function (atype) - if atype == RTU_ADVERT_TYPES.REDSTONE then + if atype == RTU_UNIT_TYPES.REDSTONE then return rtu_t.redstone - elseif atype == RTU_ADVERT_TYPES.BOILER then + elseif atype == RTU_UNIT_TYPES.BOILER then return rtu_t.boiler - elseif atype == RTU_ADVERT_TYPES.BOILER_VALVE then + elseif atype == RTU_UNIT_TYPES.BOILER_VALVE then return rtu_t.boiler_valve - elseif atype == RTU_ADVERT_TYPES.TURBINE then + elseif atype == RTU_UNIT_TYPES.TURBINE then return rtu_t.turbine - elseif atype == RTU_ADVERT_TYPES.TURBINE_VALVE then + elseif atype == RTU_UNIT_TYPES.TURBINE_VALVE then return rtu_t.turbine_valve - elseif atype == RTU_ADVERT_TYPES.EMACHINE then + elseif atype == RTU_UNIT_TYPES.EMACHINE then return rtu_t.energy_machine - elseif atype == RTU_ADVERT_TYPES.IMATRIX then + elseif atype == RTU_UNIT_TYPES.IMATRIX then return rtu_t.induction_matrix end diff --git a/supervisor/session/rtu.lua b/supervisor/session/rtu.lua index fd30fd0..5dab40c 100644 --- a/supervisor/session/rtu.lua +++ b/supervisor/session/rtu.lua @@ -12,7 +12,7 @@ local rtu = {} local PROTOCOLS = comms.PROTOCOLS local SCADA_MGMT_TYPES = comms.SCADA_MGMT_TYPES -local RTU_ADVERT_TYPES = comms.RTU_ADVERT_TYPES +local RTU_UNIT_TYPES = comms.RTU_UNIT_TYPES local print = util.print local println = util.println @@ -65,19 +65,19 @@ rtu.new_session = function (id, in_queue, out_queue, advertisement) local u_type = unit_advert.type -- create unit by type - if u_type == RTU_ADVERT_TYPES.REDSTONE then + if u_type == RTU_UNIT_TYPES.REDSTONE then - elseif u_type == RTU_ADVERT_TYPES.BOILER then + elseif u_type == RTU_UNIT_TYPES.BOILER then unit = svrs_boiler.new(self.id, unit_advert, self.out_q) - elseif u_type == RTU_ADVERT_TYPES.BOILER_VALVE then + elseif u_type == RTU_UNIT_TYPES.BOILER_VALVE then -- @todo Mekanism 10.1+ - elseif u_type == RTU_ADVERT_TYPES.TURBINE then + elseif u_type == RTU_UNIT_TYPES.TURBINE then unit = svrs_turbine.new(self.id, unit_advert, self.out_q) - elseif u_type == RTU_ADVERT_TYPES.TURBINE_VALVE then + elseif u_type == RTU_UNIT_TYPES.TURBINE_VALVE then -- @todo Mekanism 10.1+ - elseif u_type == RTU_ADVERT_TYPES.EMACHINE then + elseif u_type == RTU_UNIT_TYPES.EMACHINE then unit = svrs_emachine.new(self.id, unit_advert, self.out_q) - elseif u_type == RTU_ADVERT_TYPES.IMATRIX then + elseif u_type == RTU_UNIT_TYPES.IMATRIX then -- @todo Mekanism 10.1+ end diff --git a/supervisor/supervisor.lua b/supervisor/supervisor.lua index 7924e9f..5596cb8 100644 --- a/supervisor/supervisor.lua +++ b/supervisor/supervisor.lua @@ -10,7 +10,7 @@ local PROTOCOLS = comms.PROTOCOLS local RPLC_TYPES = comms.RPLC_TYPES local RPLC_LINKING = comms.RPLC_LINKING local SCADA_MGMT_TYPES = comms.SCADA_MGMT_TYPES -local RTU_ADVERT_TYPES = comms.RTU_ADVERT_TYPES +local RTU_UNIT_TYPES = comms.RTU_UNIT_TYPES local SESSION_TYPE = svsessions.SESSION_TYPE