#201 functional pocket comms with supervisor and coordinator, adjusted some UI element positioning, bugfixes with apisessions and svsessions
This commit is contained in:
@@ -45,6 +45,7 @@ function pocket.new_session(id, in_queue, out_queue, timeout)
|
||||
last_rtt = 0,
|
||||
-- periodic messages
|
||||
periodics = {
|
||||
last_update = 0,
|
||||
keep_alive = 0
|
||||
},
|
||||
-- when to next retry one of these requests
|
||||
@@ -95,6 +96,9 @@ function pocket.new_session(id, in_queue, out_queue, timeout)
|
||||
self.r_seq_num = pkt.scada_frame.seq_num()
|
||||
end
|
||||
|
||||
-- feed watchdog
|
||||
self.conn_watchdog.feed()
|
||||
|
||||
-- process packet
|
||||
if pkt.scada_frame.protocol() == PROTOCOL.SCADA_MGMT then
|
||||
---@cast pkt mgmt_frame
|
||||
|
||||
@@ -216,7 +216,7 @@ end
|
||||
function svsessions.find_rtu_session(remote_port)
|
||||
-- check RTU sessions
|
||||
local session = _find_session(self.sessions.rtu, remote_port)
|
||||
---@cast session rtu_session_struct
|
||||
---@cast session rtu_session_struct|nil
|
||||
return session
|
||||
end
|
||||
|
||||
@@ -227,7 +227,7 @@ end
|
||||
function svsessions.find_plc_session(remote_port)
|
||||
-- check PLC sessions
|
||||
local session = _find_session(self.sessions.plc, remote_port)
|
||||
---@cast session plc_session_struct
|
||||
---@cast session plc_session_struct|nil
|
||||
return session
|
||||
end
|
||||
|
||||
@@ -246,15 +246,18 @@ function svsessions.find_device_session(remote_port)
|
||||
return session
|
||||
end
|
||||
|
||||
-- find a coordinator session by the remote port<br>
|
||||
-- only one coordinator is allowed, but this is kept to be consistent with all other session tables
|
||||
-- find a coordinator or diagnostic access session by the remote port
|
||||
---@nodiscard
|
||||
---@param remote_port integer
|
||||
---@return coord_session_struct|nil
|
||||
function svsessions.find_coord_session(remote_port)
|
||||
---@return coord_session_struct|diag_session_struct|nil
|
||||
function svsessions.find_svctl_session(remote_port)
|
||||
-- check coordinator sessions
|
||||
local session = _find_session(self.sessions.coord, remote_port)
|
||||
---@cast session coord_session_struct
|
||||
|
||||
-- check diagnostic sessions
|
||||
if session == nil then session = _find_session(self.sessions.diag, remote_port) end
|
||||
---@cast session coord_session_struct|diag_session_struct|nil
|
||||
|
||||
return session
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user