47 lines
1.0 KiB
C#
47 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
namespace EsaCncLib
|
|
{
|
|
|
|
/// <summary>
|
|
/// Base class for devices
|
|
/// </summary>
|
|
public class thdNcBase
|
|
{
|
|
public bool Connected = false;
|
|
protected bool requestStop = false;
|
|
protected int PlcDelay;
|
|
|
|
public bool Finished = false; // this flag will be true when execution is stopped (after a RequestStop)
|
|
|
|
public string DeviceName = ""; // name of the device (just for display purpose)
|
|
|
|
|
|
/// <summary>
|
|
/// Initialization: common operations for all devices.
|
|
/// </summary>
|
|
/// <param name="fIni">The f ini.</param>
|
|
public thdNcBase(IniFile fIni)
|
|
{
|
|
// set delay for execution cycle
|
|
PlcDelay = fIni.ReadInteger("NC", "PlcDelay", 10);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Request to stop the thread
|
|
/// </summary>
|
|
public void RequestStop()
|
|
{
|
|
requestStop = true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Virtual method for thread main execution
|
|
/// </summary>
|
|
public virtual void Execute() { }
|
|
|
|
}
|
|
}
|