Chronos Plugins 5.9.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.
 
- Public Member Functions inherited from AxelSemrau.Chronos.Plugin.ITaskForDevice
- Public Member Functions inherited from AxelSemrau.Chronos.Plugin.ITask

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 }
An object implementing this interface is provided by Chronos and passed to the PAL3task just before e...
bool Simulating
Gets a value indicating whether this IPAL3Services is simulating.
A chronos plugin implementation for a fake device. We pretend we are controlling a mixture of coffee ...
Definition MockDevice.cs:53

References MockPlugin.Tasks.MockUseMultipleDevicesTask.mDevice1, MockPlugin.Tasks.MockUseMultipleDevicesTask.SecondCoffeeMakerOrPal3, AxelSemrau.Chronos.Plugin.IPAL3Services.Simulating, MockPlugin.Tasks.MockUseMultipleDevicesTask.ThirdAnyDevice, and MockPlugin.Tasks.MockUseMultipleDevicesTask.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 MockPlugin.Tasks.MockUseMultipleDevicesTask.mDevice1.

Member Data Documentation

◆ mDevice1

IDevice MockPlugin.Tasks.MockUseMultipleDevicesTask.mDevice1
private

Property Documentation

◆ SecondCoffeeMakerOrPal3

IDevice MockPlugin.Tasks.MockUseMultipleDevicesTask.SecondCoffeeMakerOrPal3
getset

Definition at line 70 of file MockUseMultipleDevicesTask.cs.

70{ get; set; }

Referenced by MockPlugin.Tasks.MockUseMultipleDevicesTask.Execute().

◆ ThirdAnyDevice

IDevice MockPlugin.Tasks.MockUseMultipleDevicesTask.ThirdAnyDevice
getset

Definition at line 72 of file MockUseMultipleDevicesTask.cs.

72{ get; set; }

Referenced by MockPlugin.Tasks.MockUseMultipleDevicesTask.Execute().

Event Documentation

◆ WriteToRunlog

Action<string> MockPlugin.Tasks.MockUseMultipleDevicesTask.WriteToRunlog

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