#580 comment updates, rtu listen fix, and trusted range init change
This commit is contained in:
@@ -559,16 +559,16 @@ function plc.comms(version, nic, reactor, rps, conn_watchdog)
|
||||
max_burn_rate = nil
|
||||
}
|
||||
|
||||
if nic.isWireless() then
|
||||
if config.WirelessModem then
|
||||
comms.set_trusted_range(config.TrustedRange)
|
||||
end
|
||||
|
||||
-- PRIVATE FUNCTIONS --
|
||||
|
||||
-- configure network channels
|
||||
nic.closeAll()
|
||||
nic.open(config.PLC_Channel)
|
||||
|
||||
--#region PRIVATE FUNCTIONS --
|
||||
|
||||
-- send an RPLC packet
|
||||
---@param msg_type RPLC_TYPE
|
||||
---@param msg table
|
||||
@@ -825,7 +825,9 @@ function plc.comms(version, nic, reactor, rps, conn_watchdog)
|
||||
end
|
||||
end
|
||||
|
||||
-- PUBLIC FUNCTIONS --
|
||||
--#endregion
|
||||
|
||||
--#region PUBLIC FUNCTIONS --
|
||||
|
||||
---@class plc_comms
|
||||
local public = {}
|
||||
@@ -835,10 +837,6 @@ function plc.comms(version, nic, reactor, rps, conn_watchdog)
|
||||
function public.switch_nic(_nic)
|
||||
nic.closeAll()
|
||||
|
||||
if _nic.isWireless() then
|
||||
comms.set_trusted_range(config.TrustedRange)
|
||||
end
|
||||
|
||||
-- configure receive channels
|
||||
_nic.closeAll()
|
||||
_nic.open(config.PLC_Channel)
|
||||
@@ -1123,6 +1121,8 @@ function plc.comms(version, nic, reactor, rps, conn_watchdog)
|
||||
---@nodiscard
|
||||
function public.is_linked() return self.linked end
|
||||
|
||||
--#endregion
|
||||
|
||||
return public
|
||||
end
|
||||
|
||||
|
||||
20
rtu/rtu.lua
20
rtu/rtu.lua
@@ -306,7 +306,15 @@ function rtu.comms(version, nic, conn_watchdog)
|
||||
|
||||
local insert = table.insert
|
||||
|
||||
-- PRIVATE FUNCTIONS --
|
||||
if config.WirelessModem then
|
||||
comms.set_trusted_range(config.TrustedRange)
|
||||
end
|
||||
|
||||
-- configure network channels
|
||||
nic.closeAll()
|
||||
nic.open(config.RTU_Channel)
|
||||
|
||||
--#region PRIVATE FUNCTIONS --
|
||||
|
||||
-- send a scada management packet
|
||||
---@param msg_type MGMT_TYPE
|
||||
@@ -347,7 +355,9 @@ function rtu.comms(version, nic, conn_watchdog)
|
||||
return advertisement
|
||||
end
|
||||
|
||||
-- PUBLIC FUNCTIONS --
|
||||
--#endregion
|
||||
|
||||
--#region PUBLIC FUNCTIONS --
|
||||
|
||||
---@class rtu_comms
|
||||
local public = {}
|
||||
@@ -357,10 +367,6 @@ function rtu.comms(version, nic, conn_watchdog)
|
||||
function public.switch_nic(_nic)
|
||||
nic.closeAll()
|
||||
|
||||
if _nic.isWireless() then
|
||||
comms.set_trusted_range(config.TrustedRange)
|
||||
end
|
||||
|
||||
-- configure receive channels
|
||||
_nic.closeAll()
|
||||
_nic.open(config.RTU_Channel)
|
||||
@@ -617,6 +623,8 @@ function rtu.comms(version, nic, conn_watchdog)
|
||||
end
|
||||
end
|
||||
|
||||
--#endregion
|
||||
|
||||
return public
|
||||
end
|
||||
|
||||
|
||||
@@ -164,12 +164,14 @@ function supervisor.comms(_version, fp_ok, facility)
|
||||
last_est_acks = {} ---@type ESTABLISH_ACK[]
|
||||
}
|
||||
|
||||
comms.set_trusted_range(config.TrustedRange)
|
||||
if config.WirelessModem then
|
||||
comms.set_trusted_range(config.TrustedRange)
|
||||
end
|
||||
|
||||
-- pass system data and objects to svsessions
|
||||
svsessions.init(fp_ok, config, facility)
|
||||
|
||||
-- PRIVATE FUNCTIONS --
|
||||
--#region PRIVATE FUNCTIONS --
|
||||
|
||||
-- send an establish request response
|
||||
---@param nic nic
|
||||
@@ -376,7 +378,9 @@ function supervisor.comms(_version, fp_ok, facility)
|
||||
|
||||
--#endregion
|
||||
|
||||
-- PUBLIC FUNCTIONS --
|
||||
--#endregion
|
||||
|
||||
--#region PUBLIC FUNCTIONS --
|
||||
|
||||
---@class superv_comms
|
||||
local public = {}
|
||||
@@ -601,6 +605,8 @@ function supervisor.comms(_version, fp_ok, facility)
|
||||
end
|
||||
end
|
||||
|
||||
--#endregion
|
||||
|
||||
return public
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user