#MANTIS - Make DLINK cache time configureable

This commit is contained in:
Applevangelist 2025-05-15 08:49:21 +02:00
parent 2b83d516d5
commit 6ff2725a1d
2 changed files with 32 additions and 8 deletions

View File

@ -22,7 +22,7 @@
-- @module Functional.Mantis
-- @image Functional.Mantis.jpg
--
-- Last Update: Apr 2025
-- Last Update: May 2025
-------------------------------------------------------------------------
--- **MANTIS** class, extends Core.Base#BASE
@ -62,7 +62,8 @@
-- @field #table FilterZones Table of Core.Zone#ZONE Zones Consider SAM groups in this zone(s) only for this MANTIS instance, must be handed as #table of Zone objects.
-- @field #boolean SmokeDecoy If true, smoke short range SAM units as decoy if a plane is in firing range.
-- @field #number SmokeDecoyColor Color to use, defaults to SMOKECOLOR.White
-- @field #number checkcounter Counter for SAM Table refreshes
-- @field #number checkcounter Counter for SAM Table refreshes.
-- @field #number DLinkCacheTime Seconds after which cached contacts in DLink will decay.
-- @extends Core.Base#BASE
@ -321,6 +322,7 @@ MANTIS = {
SmokeDecoy = false,
SmokeDecoyColor = SMOKECOLOR.White,
checkcounter = 1,
DLinkCacheTime = 120,
}
--- Advanced state enumerator
@ -612,6 +614,7 @@ do
self.advAwacs = false
end
self:SetDLinkCacheTime()
-- Set the string id for output to DCS.log file.
self.lid=string.format("MANTIS %s | ", self.name)
@ -676,7 +679,7 @@ do
-- TODO Version
-- @field #string version
self.version="0.9.28"
self.version="0.9.29"
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
--- FSM Functions ---
@ -1027,6 +1030,15 @@ do
return self
end
--- Function to set how long INTEL DLINK remembers contacts.
-- @param #MANTIS self
-- @param #number seconds Remember this many seconds
-- @return #MANTIS self
function MANTIS:SetDLinkCacheTime(seconds)
self.DLinkCacheTime = math.abs(seconds or 120)
return self
end
--- Function to set the detection interval
-- @param #MANTIS self
-- @param #number interval The interval in seconds
@ -1418,7 +1430,9 @@ do
--IntelTwo:SetClusterRadius(5000)
IntelTwo:Start()
local IntelDlink = INTEL_DLINK:New({IntelOne,IntelTwo},self.name.." DLINK",22,300)
local CacheTime = self.DLinkCacheTime or 120
local IntelDlink = INTEL_DLINK:New({IntelOne,IntelTwo},self.name.." DLINK",22,CacheTime)
IntelDlink:__Start(1)
self:SetUsingDLink(IntelDlink)

View File

@ -2324,7 +2324,7 @@ INTEL_DLINK = {
verbose = 0,
lid = nil,
alias = nil,
cachetime = 300,
cachetime = 120,
interval = 20,
contacts = {},
clusters = {},
@ -2333,7 +2333,7 @@ INTEL_DLINK = {
--- Version string
-- @field #string version
INTEL_DLINK.version = "0.0.1"
INTEL_DLINK.version = "0.0.2"
--- Function to instantiate a new object
-- @param #INTEL_DLINK self
@ -2385,7 +2385,7 @@ function INTEL_DLINK:New(Intels, Alias, Interval, Cachetime)
end
-- Cache time
self.cachetime = Cachetime or 300
self:SetDLinkCacheTime(Cachetime or 120)
-- Interval
self.interval = Interval or 20
@ -2477,6 +2477,16 @@ function INTEL_DLINK:onafterStart(From, Event, To)
return self
end
--- Function to set how long INTEL DLINK remembers contacts.
-- @param #INTEL_DLINK self
-- @param #number seconds Remember this many seconds. Defaults to 180.
-- @return #INTEL_DLINK self
function INTEL_DLINK:SetDLinkCacheTime(seconds)
self.cachetime = math.abs(seconds or 120)
self:I(self.lid.."Caching for "..self.cachetime.." seconds.")
return self
end
--- Function to collect data from the various #INTEL
-- @param #INTEL_DLINK self
-- @param #string From The From state