From f267a4e56941e4f1d23a402aa090c14da050014b Mon Sep 17 00:00:00 2001 From: Mikayla Date: Wed, 30 Aug 2023 21:15:42 +0000 Subject: [PATCH] #300 comms device type cleanup --- coordinator/coordinator.lua | 2 +- scada-common/comms.lua | 12 +++--------- supervisor/supervisor.lua | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/coordinator/coordinator.lua b/coordinator/coordinator.lua index 2a20e06..aa29ee8 100644 --- a/coordinator/coordinator.lua +++ b/coordinator/coordinator.lua @@ -316,7 +316,7 @@ function coordinator.comms(version, nic, num_units, crd_channel, svr_channel, pk -- attempt connection establishment local function _send_establish() - _send_sv(PROTOCOL.SCADA_MGMT, MGMT_TYPE.ESTABLISH, { comms.version, version, DEVICE_TYPE.CRDN }) + _send_sv(PROTOCOL.SCADA_MGMT, MGMT_TYPE.ESTABLISH, { comms.version, version, DEVICE_TYPE.CRD }) end -- keep alive ack diff --git a/scada-common/comms.lua b/scada-common/comms.lua index f01a3e5..081950e 100644 --- a/scada-common/comms.lua +++ b/scada-common/comms.lua @@ -21,7 +21,7 @@ comms.version = "2.3.0" ---@enum PROTOCOL local PROTOCOL = { - MODBUS_TCP = 0, -- our "MODBUS TCP"-esque protocol + MODBUS_TCP = 0, -- the "MODBUS TCP"-esque protocol RPLC = 1, -- reactor PLC protocol SCADA_MGMT = 2, -- SCADA supervisor management, device advertisements, etc SCADA_CRDN = 3 -- data/control packets for coordinators to/from supervisory controllers @@ -74,14 +74,8 @@ local ESTABLISH_ACK = { BAD_VERSION = 3 -- link denied due to comms version mismatch } ----@enum DEVICE_TYPE -local DEVICE_TYPE = { - PLC = 0, -- PLC device type for establish - RTU = 1, -- RTU device type for establish - SV = 2, -- supervisor device type for establish - CRDN = 3, -- coordinator device type for establish - PKT = 4 -- pocket device type for establish -} +---@enum DEVICE_TYPE device types for establish messages +local DEVICE_TYPE = { PLC = 0, RTU = 1, SVR = 2, CRD = 3, PKT = 4 } ---@enum PLC_AUTO_ACK local PLC_AUTO_ACK = { diff --git a/supervisor/supervisor.lua b/supervisor/supervisor.lua index 3c25110..498a51d 100644 --- a/supervisor/supervisor.lua +++ b/supervisor/supervisor.lua @@ -291,7 +291,7 @@ function supervisor.comms(_version, nic, fp_ok) end _send_establish(packet.scada_frame, ESTABLISH_ACK.BAD_VERSION) - elseif dev_type == DEVICE_TYPE.CRDN then + elseif dev_type == DEVICE_TYPE.CRD then -- this is an attempt to establish a new coordinator session local s_id = svsessions.establish_crd_session(src_addr, firmware_v)