39 lines
893 B
C#
39 lines
893 B
C#
using System;
|
|
using ln.types.odb.attributes;
|
|
using ln.types.net;
|
|
namespace skyspot.hotspot.locator
|
|
{
|
|
public class MACLocation
|
|
{
|
|
[DocumentID]
|
|
Guid ID = Guid.NewGuid();
|
|
|
|
public MAC ClientMAC { get; }
|
|
public String ClientLocator { get; }
|
|
|
|
public DateTimeOffset Created { get; private set; }
|
|
public DateTimeOffset ValidThrough { get; set; }
|
|
|
|
private MACLocation()
|
|
{
|
|
Created = DateTimeOffset.Now;
|
|
ValidThrough = Created + TimeSpan.FromHours(1);
|
|
}
|
|
|
|
public MACLocation(MAC clientMAC,string locator)
|
|
:this()
|
|
{
|
|
ClientMAC = clientMAC;
|
|
ClientLocator = locator;
|
|
}
|
|
|
|
public void Release()
|
|
{
|
|
ValidThrough = DateTimeOffset.Now;
|
|
}
|
|
|
|
public bool IsValid => ValidThrough > DateTimeOffset.Now;
|
|
|
|
}
|
|
}
|