3using System.Threading.Tasks;
19 [CollectionName(
"ScheduledActions")]
20 [Index(
"Timepoint",
"StateMachineId",
"Action")]
21 [Index(
"StateMachineId",
"Timepoint",
"Action")]
81 if (nextActionTimer != DateTime.MinValue)
84 nextActionTimer = DateTime.MinValue;
96 private static async Task<IEnumerable<ScheduledAction>> GetElapsedActions(
int MaxCount)
112 internal static async Task ScheduleNext()
116 if (nextActionTimer != DateTime.MinValue)
119 nextActionTimer = DateTime.MinValue;
123 if (nextAction is
null)
134 internal static async Task ExecutePendingActions(
object _)
136 nextActionTimer = DateTime.MinValue;
145 IEnumerable<ScheduledAction> Actions = await GetElapsedActions(N);
158 if (!(Machine is
null))
164 EvaluationArguments Arguments =
new EvaluationArguments(
Variables,
165 Machine,
null, Rec.CurrentState, Rec.Legal, Rec.EDaler,
173 if (!
string.IsNullOrEmpty(
Action.BeforeActionScript))
176 await Action2.Execute(Arguments);
202 await ScheduleNext();
207 private static DateTime nextActionTimer = DateTime.MinValue;
Static class managing the application event log. Applications and services log events on this static ...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Static class managing the runtime environment of the IoT Gateway.
static DateTime ScheduleEvent(Action< object > Callback, DateTime When, object State)
Schedules a one-time event.
static bool CancelScheduledEvent(DateTime When)
Cancels a scheduled event.
Represents a case-insensitive string.
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static async Task Delete(object Object)
Deletes an object in the database.
static Task< IEnumerable< object > > Find(string Collection, params string[] SortOrder)
Finds objects in a given collection.
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
This filter selects objects that have a named field lesser or equal to a given value.
ProfilerThread GetThread(string Name, ProfilerThreadType Type)
Gets a profiler thread. If none is available, a new is created.
Class that keeps track of events and timing for one thread.
void Low()
Sets the (binary) state to "low".
void High()
Sets the (binary) state to "high".
Profiler Profiler
Profiler reference.
Represents a named semaphore, i.e. an object, identified by a name, that allows single concurrent wri...
Static class of application-wide semaphores that can be used to order access to editable objects.
static async Task< Semaphore > BeginWrite(string Key)
Waits until the semaphore identified by Key is ready for writing. Each call to BeginWrite must be fo...
Class managing a script expression.
static Task< object > EvalAsync(string Script)
Evaluates script, in string format.
Exception related to state machine.
Represents an action definition.
string Action
Action to execute.
DateTime Timepoint
Timepoint
ScheduledAction()
A scheduled action.
string BeforeActionScript
Any script that needs to be executed before calling the action.
CaseInsensitiveString StateMachineId
State Machine ID.
Class representing a state machine.
bool TryGetAction(string Id, out Model.Actions.Action Action)
Tries to get an action.
ProfilerThreadType
Type of profiler thread.