50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace SCMCncLib
|
|
{
|
|
public enum NC_DEVICE_TYPE { VIRTUAL = 1, NUM_10x0, OSAI_510, ESAGV_KVARA, FILE_DEVICE };
|
|
|
|
/// <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)
|
|
public NC_DEVICE_TYPE DeviceType = 0; // store type of device if needed
|
|
|
|
|
|
/// <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() {}
|
|
|
|
}
|
|
}
|