Chronos Plugins  5.2.0
This documentation covers the plugin interfaces definitions and an example implementation.
MockPlugin.Device.TrainPart Class Reference

The device part (well, train part) can't do much, just send status messages when the doors are opened/closed. More...

+ Inheritance diagram for MockPlugin.Device.TrainPart:
+ Collaboration diagram for MockPlugin.Device.TrainPart:

Public Member Functions

override string ToString ()
 Important! Without overriding ToString here, you will not be able to pick the device from an autosampler column in the sample list. More...
 
void Connect ()
 You may have connected to the device before this, but make sure you are connected after this. More...
 
void Disconnect ()
 You may disconnect now. More...
 
 TrainPart (Train parent, TrainPartType myType)
 

Properties

string DisplayedTypeName [get]
 
string DeviceTypeDescription [get]
 
string Name [get, set]
 We have to return a descriptive name that also allows identification of the base device - just do it like the PAL3 and return BaseName + ":" + PartName More...
 
int Num [get, set]
 
bool?? DoorsOpen [get, set]
 
Action< ConnectionStateConnectionStateChanged
 Not used. More...
 
- Properties inherited from AxelSemrau.Chronos.Plugin.IDevice
string DisplayedTypeName [get]
 Text which is displayed in the instruments settings "Autosampler Type" column and in many other places. More...
 
string DeviceTypeDescription [get]
 Text which is displayed to make clear which kind of device a named sampler is. More...
 
string Name [get, set]
 User-selected name for the device instance. More...
 

Events

Action< string > SetStatusMessage
 
- Events inherited from AxelSemrau.Chronos.Plugin.IDevice
Action< ConnectionStateConnectionStateChanged
 Raise this event when your connection state has changed. More...
 
- Events inherited from AxelSemrau.Chronos.Plugin.IProvideStatusMessages
Action< string > SetStatusMessage
 Raise this event to set your current status while doing something on the device. Messages passed to this event will be shown in the "Autosampler status" line. More...
 

Private Member Functions

string BuildName ()
 

Private Attributes

readonly Train mTrain
 
readonly TrainPartType mMyType
 
bool mDoorsAreOpen
 

Detailed Description

The device part (well, train part) can't do much, just send status messages when the doors are opened/closed.

Definition at line 75 of file Train.cs.

Constructor & Destructor Documentation

◆ TrainPart()

MockPlugin.Device.TrainPart.TrainPart ( Train  parent,
TrainPartType  myType 
)

Definition at line 122 of file Train.cs.

123  {
124  mTrain = parent;
125  mMyType = myType;
126  }
readonly TrainPartType mMyType
Definition: Train.cs:78
readonly Train mTrain
Definition: Train.cs:77

References MockPlugin.Device.TrainPart.mMyType, and MockPlugin.Device.TrainPart.mTrain.

Member Function Documentation

◆ BuildName()

string MockPlugin.Device.TrainPart.BuildName ( )
private

Definition at line 99 of file Train.cs.

100  {
101  switch (mMyType)
102  {
103  case TrainPartType.DiningCar:
104  return $"{mTrain.Name}:Diner";
105  case TrainPartType.Locomotive:
106  return $"{mTrain.Name}:Locomotive";
107  default:
108  return $"{mTrain.Name}:Car{Num}";
109  }
110  }

References MockPlugin.Device.TrainPart.mMyType.

◆ Connect()

void MockPlugin.Device.TrainPart.Connect ( )

You may have connected to the device before this, but make sure you are connected after this.

Implements AxelSemrau.Chronos.Plugin.IDevice.

Definition at line 112 of file Train.cs.

113  {
114 
115  }

◆ Disconnect()

void MockPlugin.Device.TrainPart.Disconnect ( )

You may disconnect now.

Implements AxelSemrau.Chronos.Plugin.IDevice.

Definition at line 117 of file Train.cs.

118  {
119 
120  }

◆ ToString()

override string MockPlugin.Device.TrainPart.ToString ( )

Important! Without overriding ToString here, you will not be able to pick the device from an autosampler column in the sample list.

Returns

Member Data Documentation

◆ mDoorsAreOpen

bool MockPlugin.Device.TrainPart.mDoorsAreOpen
private

Definition at line 128 of file Train.cs.

◆ mMyType

readonly TrainPartType MockPlugin.Device.TrainPart.mMyType
private

◆ mTrain

readonly Train MockPlugin.Device.TrainPart.mTrain
private

Definition at line 77 of file Train.cs.

Referenced by MockPlugin.Device.TrainPart.TrainPart().

Property Documentation

◆ ConnectionStateChanged

Action<ConnectionState> MockPlugin.Device.TrainPart.ConnectionStateChanged
addremove

Not used.

Definition at line 149 of file Train.cs.

150  {
151  add { }
152  remove { }
153  }

◆ DeviceTypeDescription

string MockPlugin.Device.TrainPart.DeviceTypeDescription
get

Definition at line 80 of file Train.cs.

◆ DisplayedTypeName

string MockPlugin.Device.TrainPart.DisplayedTypeName
get

Definition at line 79 of file Train.cs.

◆ DoorsOpen

bool?? MockPlugin.Device.TrainPart.DoorsOpen
getset

Definition at line 129 of file Train.cs.

130  {
131  get => mDoorsAreOpen;
132  set
133  {
134  if (value != mDoorsAreOpen)
135  {
136  mDoorsAreOpen = value;
137  SetStatusMessage?.Invoke($"Doors are {(value ? "open" : "closed")}");
138  if (!value)
139  {
140  mTrain.ClosedSomeDoor();
141  }
142  }
143  }
144  }
Action< string > SetStatusMessage
Definition: Train.cs:155

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

◆ Name

string MockPlugin.Device.TrainPart.Name
getset

We have to return a descriptive name that also allows identification of the base device - just do it like the PAL3 and return BaseName + ":" + PartName

Definition at line 85 of file Train.cs.

86  {
87  get => BuildName();
88  set { var dummy = value; }
89  }

◆ Num

int MockPlugin.Device.TrainPart.Num
getset

Definition at line 97 of file Train.cs.

97 { get; set; }

Event Documentation

◆ SetStatusMessage

Action<string> MockPlugin.Device.TrainPart.SetStatusMessage

Definition at line 155 of file Train.cs.


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