tbf/Workplace/IDevice.cs

47 lines
1.8 KiB
C#

///
/// Copyright (c) 2020-2021 Sensus Slovensko a.s.
///
namespace Workplace
{
public interface IDevice
{
string Name { get; }
/// <summary>
/// Invoked once on program start-up before the state machine is started,
/// before RunDeviceBefore() functions of all devices and before Start()
/// functions of all operations.
/// </summary>
void Initialize();
/// <summary>
/// This function is invoked regularly each 1000 ms (once per second)
/// just before Start(), Run() and Stop() functions of acrive operations.
///
/// It runs in a thread created by class Machine (not the user interface thread).
/// The function should not block (otherwise it blocks all other devices) !!!
/// In case needed, the device must create its own thread to handle hardware
/// without any interference with the rest of the system.
/// </summary>
void RunDeviceBefore();
/// <summary>
/// This function is invoked regularly each 1000 ms (once per second)
/// just before Start(), Run() and Stop() functions of acrive operations.
///
/// It runs in a thread created by class Machine (not the user interface thread).
/// The function should not block (otherwise it blocks all other devices) !!!
/// In case needed, the device must create its own thread to handle hardware
/// without any interference with the rest of the system.
/// </summary>
void RunDeviceAfter();
/// <summary>
/// Invoked once on program shut-down after state machine is stopped,
/// after all Stop() functions for all runing operations were called
/// and after all RunDeviceAfter() of all devices.
/// </summary>
void StopDevice();
}
}