66 lines
1.4 KiB
C#
66 lines
1.4 KiB
C#
using TBF.BenchControl.Network.Telnet;
|
|
|
|
namespace TBF.BenchControl.Network.Camera.RoI
|
|
{
|
|
public class RoiDetectionOp : IOperation
|
|
{
|
|
readonly CLP1611.Camera camera;
|
|
readonly Telnet.TelnetClient telnet;
|
|
readonly string command;
|
|
|
|
bool roiDetectionCommandSent;
|
|
|
|
Boxes.IntBox oroiX;
|
|
Boxes.IntBox oroiY;
|
|
Boxes.IntBox oroiWid;
|
|
Boxes.IntBox oroiHgh;
|
|
|
|
|
|
/// <summary>
|
|
/// Events: Event.None or Event.Error
|
|
/// </summary>
|
|
/// <param name="camera">CLP1611.Camera reference</param>
|
|
public RoiDetectionOp(RoI roi, CLP1611.Camera camera, Telnet.TelnetClient telnet, string command,
|
|
Boxes.IntBox oroiX,
|
|
Boxes.IntBox oroiY,
|
|
Boxes.IntBox oroiWid,
|
|
Boxes.IntBox oroiHgh)
|
|
{
|
|
this.camera = camera;
|
|
this.telnet = telnet;
|
|
this.command = command;
|
|
this.oroiX = oroiX;
|
|
this.oroiY = oroiY;
|
|
this.oroiWid = oroiWid;
|
|
this.oroiHgh = oroiHgh;
|
|
}
|
|
|
|
|
|
public void Start()
|
|
{
|
|
roiDetectionCommandSent = false;
|
|
}
|
|
|
|
public Event Run()
|
|
{
|
|
if (!roiDetectionCommandSent)
|
|
{
|
|
if (telnet.State == TelnetClient.TelnetState.Inactive)
|
|
{
|
|
telnet.Enqueue(new Telnet.Command(Telnet.CmdAction.SEND_COMMAND, command));
|
|
roiDetectionCommandSent = true;
|
|
}
|
|
}
|
|
return Event.None;
|
|
}
|
|
|
|
public void Stop()
|
|
{
|
|
if (roiDetectionCommandSent)
|
|
{
|
|
telnet.Enqueue(new Telnet.Command(Telnet.CmdAction.SEND_COMMAND, Telnet.TelnetClient.CtrlCCommand));
|
|
}
|
|
}
|
|
}
|
|
}
|