Chronos Plugins 5.11.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
MockPlugin.Tasks.MockUseMultipleDevicesTask Class Reference

For some special cases it can be necessary to have a single task communicate with two different devices. More...

Inheritance diagram for MockPlugin.Tasks.MockUseMultipleDevicesTask:
Collaboration diagram for MockPlugin.Tasks.MockUseMultipleDevicesTask:

Public Member Functions

void PreValidate ()
 Called before the schedule construction is completed.
void PostValidate ()
 Called after the schedule construction is completed.
void Execute ()
 Showing how to use our device(s) from the task.
string GetTaskAction ()
 Description of the tasks's action (for hints/time table)
void SetDevice (IDevice yourDevice)
 Will be called by chronos when building the schedule.

Properties

IDevice SecondCoffeeMakerOrPal3 [get, set]
IDevice ThirdAnyDevice [get, set]

Events

Action< string > WriteToRunlog
Events inherited from AxelSemrau.Chronos.Plugin.IHaveRunlogOutput
Action< string > WriteToRunlog
 Use this event to send output to the Run Control / Runlog page and, if applicable, to the runlog file.

Private Member Functions

string NameOrNotSet (IDevice dev)

Private Attributes

IDevice mDevice1

Detailed Description

For some special cases it can be necessary to have a single task communicate with two different devices.

Definition at line 16 of file MockUseMultipleDevicesTask.cs.

Member Function Documentation

◆ Execute()

void MockPlugin.Tasks.MockUseMultipleDevicesTask.Execute ( )

Showing how to use our device(s) from the task.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 35 of file MockUseMultipleDevicesTask.cs.

36 {
37 if (mDevice1 is IPAL3Services pal && pal.Simulating)
38 {
39 WriteToRunlog?.Invoke("Running simulation for validation");
40 }
41 else
42 {
43 WriteToRunlog?.Invoke($"Running {GetTaskAction()}");
44 foreach (var dev in new[] {SecondCoffeeMakerOrPal3, ThirdAnyDevice}.OfType<MockDevice>())
45 {
46 dev.SomeDummyMethod();
47 }
48 }
49 }

References mDevice1, SecondCoffeeMakerOrPal3, AxelSemrau.Chronos.Plugin.IPAL3Services.Simulating, ThirdAnyDevice, and WriteToRunlog.

◆ GetTaskAction()

string MockPlugin.Tasks.MockUseMultipleDevicesTask.GetTaskAction ( )

Description of the tasks's action (for hints/time table)

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 51 of file MockUseMultipleDevicesTask.cs.

52 {
53 return $"Task for devices {NameOrNotSet(mDevice1)}, {NameOrNotSet(SecondCoffeeMakerOrPal3)}, {NameOrNotSet(ThirdAnyDevice)}";
54 }

◆ NameOrNotSet()

string MockPlugin.Tasks.MockUseMultipleDevicesTask.NameOrNotSet ( IDevice dev)
private

Definition at line 56 of file MockUseMultipleDevicesTask.cs.

57 {
58 return dev?.Name ?? "(not set)";
59 }
string Name
User-selected name for the device instance.

References AxelSemrau.Chronos.Plugin.IDevice.Name.

◆ PostValidate()

void MockPlugin.Tasks.MockUseMultipleDevicesTask.PostValidate ( )

Called after the schedule construction is completed.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 27 of file MockUseMultipleDevicesTask.cs.

28 {
29
30 }

◆ PreValidate()

void MockPlugin.Tasks.MockUseMultipleDevicesTask.PreValidate ( )

Called before the schedule construction is completed.

Implements AxelSemrau.Chronos.Plugin.ITask.

Definition at line 22 of file MockUseMultipleDevicesTask.cs.

23 {
24
25 }

◆ SetDevice()

void MockPlugin.Tasks.MockUseMultipleDevicesTask.SetDevice ( IDevice yourDevice)

Will be called by chronos when building the schedule.

Parameters
yourDevice

Implements AxelSemrau.Chronos.Plugin.ITaskForDevice.

Definition at line 62 of file MockUseMultipleDevicesTask.cs.

63 {
64 mDevice1 = yourDevice;
65 }

References mDevice1.

Member Data Documentation

◆ mDevice1

IDevice MockPlugin.Tasks.MockUseMultipleDevicesTask.mDevice1
private

Definition at line 18 of file MockUseMultipleDevicesTask.cs.

Referenced by Execute(), and SetDevice().

Property Documentation

◆ SecondCoffeeMakerOrPal3

IDevice MockPlugin.Tasks.MockUseMultipleDevicesTask.SecondCoffeeMakerOrPal3
getset

Definition at line 70 of file MockUseMultipleDevicesTask.cs.

70{ get; set; }

Referenced by Execute().

◆ ThirdAnyDevice

IDevice MockPlugin.Tasks.MockUseMultipleDevicesTask.ThirdAnyDevice
getset

Definition at line 72 of file MockUseMultipleDevicesTask.cs.

72{ get; set; }

Referenced by Execute().

Event Documentation

◆ WriteToRunlog

Action<string> MockPlugin.Tasks.MockUseMultipleDevicesTask.WriteToRunlog

Definition at line 76 of file MockUseMultipleDevicesTask.cs.

Referenced by Execute().


The documentation for this class was generated from the following file: