forked from Ken98045/On-Guard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPendingItem.cs
57 lines (48 loc) · 1.67 KB
/
PendingItem.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Diagnostics;
namespace SAAI
{
/// <summary>
/// A class to store information for recently changed/motion files.
/// It tracks that information through the whole process of sending the information
/// to the AI
/// </summary>
public class PendingItem
{
public Guid AOIid { get; }
public string CameraPath { get; }
public string PendingFile { get; set; } // The file we want the AI to look at
public DateTime TimeEnqueued { get; set; } // The time we put it in the queue waiting for the AI
public DateTime TimeDispatched { get; set; } // The time the queue dispatched it to the AI
public DateTime TimeCompleted { get; set; } // The time the AI completed the project and returned the item list
public CameraData CamData { get; set; }
public PendingItem(CameraData camData, string fileName)
{
CamData = camData;
PendingFile = fileName;
TimeEnqueued = DateTime.Now; // we only create one when we are ready to put it in the queue
TimeCompleted = TimeEnqueued;
TimeDispatched = TimeEnqueued;
}
public TimeSpan TimeInQueue()
{
return DateTime.Now - TimeEnqueued;
}
// Only call this when we are are ready to dispatch
public TimeSpan TimeToDispatch()
{
TimeDispatched = DateTime.Now;
return TimeDispatched - TimeEnqueued;
}
public TimeSpan TimeProcessingByAI()
{
TimeCompleted = DateTime.Now;
return TimeCompleted - TimeDispatched;
}
public TimeSpan TotalProcessingTime()
{
TimeSpan result = TimeCompleted - TimeEnqueued;
return result;
}
}
}