Chronos Plugins 5.9.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
MockPlugin.Device.DeviceSurveillance Class Reference

Shows how you can directly interact with all configured devices. More...

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

Public Member Functions

 DeviceSurveillance (IDeviceInfoProvider infoProv)
 Requesting the device info provider via the constructor, not via "Helpers" - makes it easier to write tests for the plugin code.
 
void DoYourJob ()
 Will be triggered when the user clicks on the button. The button will be disabled until you return from here.
 
- Public Member Functions inherited from AxelSemrau.Chronos.Plugin.IWorkWithSampleLists

Properties

string ButtonCaption [get]
 Shown on the sample list page.
 
Icon ButtonIcon [get]
 Shown in the button, preferred size 22x22.
 
IEnumerable< IDeviceConfiguredDevices [set]
 List of IDevice for all configured devices in Chronos.
 
- Properties inherited from AxelSemrau.Chronos.Plugin.IWorkWithSampleLists
- Properties inherited from AxelSemrau.Chronos.Plugin.IDirectDeviceAccess

Events

EventHandler< TraceWriteEventArgsTraceWrite
 
- Events inherited from AxelSemrau.Chronos.Plugin.ITraceLogger
EventHandler< TraceWriteEventArgsTraceWrite
 Chronos will subscribe to this event and log the text provided in the event args.
 

Private Member Functions

void Trace (string txt)
 

Private Attributes

readonly IDeviceInfoProvider mDeviceInfoProvider
 

Detailed Description

Shows how you can directly interact with all configured devices.

This way of interacting is only for very rare scenarios - you should use IToolbox or ITaskForDevice for device access whenever possible.

Definition at line 17 of file DeviceSurveillance.cs.

Constructor & Destructor Documentation

◆ DeviceSurveillance()

MockPlugin.Device.DeviceSurveillance.DeviceSurveillance ( IDeviceInfoProvider infoProv)

Requesting the device info provider via the constructor, not via "Helpers" - makes it easier to write tests for the plugin code.

Parameters
infoProv

Definition at line 25 of file DeviceSurveillance.cs.

26 {
27 mDeviceInfoProvider = infoProv;
28 }
readonly IDeviceInfoProvider mDeviceInfoProvider

References MockPlugin.Device.DeviceSurveillance.mDeviceInfoProvider.

Member Function Documentation

◆ DoYourJob()

void MockPlugin.Device.DeviceSurveillance.DoYourJob ( )

Will be triggered when the user clicks on the button. The button will be disabled until you return from here.

Please note that this will not be run from the main GUI thread. If you have to do something on the GUI thread, use the Helpers.Gui members.

Implements AxelSemrau.Chronos.Plugin.IWorkWithSampleLists.

Definition at line 34 of file DeviceSurveillance.cs.

35 {
36 // nothing to see here
37 }

◆ Trace()

void MockPlugin.Device.DeviceSurveillance.Trace ( string txt)
private

Definition at line 63 of file DeviceSurveillance.cs.

64 {
65 TraceWrite?.Invoke(this,new TraceWriteEventArgs(txt));
66 }
For future extension (categories, priorities...)
EventHandler< TraceWriteEventArgs > TraceWrite

References MockPlugin.Device.DeviceSurveillance.TraceWrite.

Member Data Documentation

◆ mDeviceInfoProvider

readonly IDeviceInfoProvider MockPlugin.Device.DeviceSurveillance.mDeviceInfoProvider
private

Property Documentation

◆ ButtonCaption

string MockPlugin.Device.DeviceSurveillance.ButtonCaption
get

Shown on the sample list page.

You can update this using INotifyPropertyChanged.

Implements AxelSemrau.Chronos.Plugin.IWorkWithSampleLists.

Definition at line 32 of file DeviceSurveillance.cs.

◆ ButtonIcon

Icon MockPlugin.Device.DeviceSurveillance.ButtonIcon
get

Shown in the button, preferred size 22x22.

You can update this using INotifyPropertyChanged.

Implements AxelSemrau.Chronos.Plugin.IWorkWithSampleLists.

Definition at line 33 of file DeviceSurveillance.cs.

◆ ConfiguredDevices

IEnumerable<IDevice> MockPlugin.Device.DeviceSurveillance.ConfiguredDevices
set

List of IDevice for all configured devices in Chronos.

Use with caution!

Implements AxelSemrau.Chronos.Plugin.IDirectDeviceAccess.

Definition at line 43 of file DeviceSurveillance.cs.

44 {
45 set
46 {
47 // You could save the list for later use,
48 // you could filter the list for specific interfaces,
49 // you could call methods of the devices at any time -
50 // just make sure you know what you are doing and don't mess with
51 // toolboxes and sequence execution.
52 Trace("** Start device list dump");
53 foreach (var someDev in value)
54 {
55 Trace($"{someDev.Name} of type {someDev.GetType().FullName}, connection state {mDeviceInfoProvider.Single(info => info.Device == someDev).ConnectionState}");
56 }
57 Trace("** End device list dump");
58 }
59 }

Event Documentation

◆ TraceWrite

EventHandler<TraceWriteEventArgs> MockPlugin.Device.DeviceSurveillance.TraceWrite

Definition at line 69 of file DeviceSurveillance.cs.

Referenced by MockPlugin.Device.DeviceSurveillance.Trace().


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