68 lines
1.9 KiB
C#
68 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace MotoTRBO_SOC
|
|
{
|
|
public class UnitsMonitoring
|
|
{
|
|
//private MemoryCache mem = new MemoryCache("UnitsMonitoring");
|
|
|
|
public UnitsMonitoring()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Method which will gestion the presence notification for units
|
|
/// </summary>
|
|
/// <param name="isOn">Value indicating if the units is present or not</param>
|
|
/// <param name="radioID">The unit id which changed it's status</param>
|
|
public void OnARSReceived(bool isOn, string radioID)
|
|
{
|
|
/*
|
|
// remove the
|
|
if (!isOn)
|
|
mem.Remove(radioID);
|
|
else
|
|
{
|
|
if (mem.Contains(radioID))
|
|
;
|
|
else
|
|
{
|
|
UnitStat unitStat = new UnitStat() { };
|
|
CacheItemPolicy itemPoliciy = new CacheItemPolicy()
|
|
{ AbsoluteExpiration = DateTime.UtcNow.AddSeconds(unitStat.ReportingInterval * 2) };
|
|
itemPoliciy.RemovedCallback += new CacheEntryRemovedCallback(delegate(CacheEntryRemovedArguments arg)
|
|
{
|
|
arg.RemovedReason == CacheEntryRemovedReason.
|
|
});
|
|
mem.Add(radioID + "", unitStat, itemPoliciy);
|
|
}
|
|
}
|
|
*/
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public class UnitStat
|
|
{
|
|
public DateTime ARSTime;
|
|
public DateTime LastReportingTime;
|
|
public int NumberOfPositions;
|
|
public int ReportingInterval;
|
|
|
|
public UnitStat()
|
|
{
|
|
ARSTime = DateTime.Now;
|
|
LastReportingTime = DateTime.Now;
|
|
NumberOfPositions = 0;
|
|
ReportingInterval = 300;
|
|
}
|
|
}
|
|
}
|