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