278 lines
6.6 KiB
C#
278 lines
6.6 KiB
C#
using Aurora.Api;
|
|
using Aurora.Api.Devices;
|
|
using AuroraLaser.Coherent.Arm;
|
|
using AuroraLaser.IPG.YLPN;
|
|
using AuroraLaser.IPG.YLS;
|
|
using Hermes;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AuroraLaser.IPG.YLPP
|
|
{
|
|
public class LaserDeviceYLPP : Device, ILaserDeviceIPG
|
|
{
|
|
|
|
protected Logger Log = new Logger("LaserDeviceYLPP");
|
|
|
|
public LaserYLPPConfig Config { get; set; }
|
|
private LaserYLPPSocketConn _laserYLPPSocketConn;
|
|
|
|
public LaserDeviceYLPP(string deviceId)
|
|
{
|
|
CommType = CommunicationType.Socket;
|
|
DeviceId = deviceId;
|
|
}
|
|
|
|
protected override int DoActivate(IDeviceConfig config)
|
|
{
|
|
Config = config as LaserYLPPConfig;
|
|
return ActivateDevice();
|
|
}
|
|
|
|
protected override int DoDeactivate()
|
|
{
|
|
return DeactivateDevice();
|
|
}
|
|
|
|
public int ActivateDevice()
|
|
{
|
|
if (IsActivated || IsActivated_InAllLaserDevice) {
|
|
return E1.OK;
|
|
}
|
|
if (IsSimul) {
|
|
return E1.OK;
|
|
}
|
|
|
|
_laserYLPPSocketConn = new LaserYLPPSocketConn(DeviceId, IsSimul);
|
|
|
|
if (_laserYLPPSocketConn == null) {
|
|
Log.E(string.Format("LaserObj is Null"));
|
|
return E1.ARGUMENT;
|
|
}
|
|
return _laserYLPPSocketConn.Open(Config.ConnConfig as SocketConnConfig);
|
|
}
|
|
|
|
public int DeactivateDevice()
|
|
{
|
|
if (IsSimul) {
|
|
return E1.OK;
|
|
}
|
|
if (_laserYLPPSocketConn != null) {
|
|
_laserYLPPSocketConn.DisConnect();
|
|
}
|
|
|
|
return E1.OK;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// Laser Interface 추가
|
|
|
|
// All LaserDevice 에서 선택하여 Device 가 생성될 때 사용되며, All LaserDevice 가 Activated 일 때만 true 가 됨.
|
|
public bool IsActivated_InAllLaserDevice = false;
|
|
private bool CanCallLaserFunction()
|
|
{
|
|
if (IsActivated_InAllLaserDevice == false && IsActivated == false) {
|
|
return false;
|
|
}
|
|
if (_laserYLPPSocketConn == null) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public int LaserOn()
|
|
{
|
|
if (IsSimul) {
|
|
return E1.OK;
|
|
}
|
|
if (CanCallLaserFunction() == false) {
|
|
return E1.GENERIC;
|
|
}
|
|
|
|
return _laserYLPPSocketConn.LaserOn();
|
|
}
|
|
|
|
public int LaserOff()
|
|
{
|
|
if (IsSimul) {
|
|
return E1.OK;
|
|
}
|
|
if (CanCallLaserFunction() == false) {
|
|
return E1.GENERIC;
|
|
}
|
|
|
|
return _laserYLPPSocketConn.LaserOff();
|
|
}
|
|
|
|
public int PilotLaserOn()
|
|
{
|
|
if (IsSimul) {
|
|
return E1.OK;
|
|
}
|
|
if (CanCallLaserFunction() == false) {
|
|
return E1.GENERIC;
|
|
}
|
|
|
|
return _laserYLPPSocketConn.PilotLaserOn();
|
|
}
|
|
|
|
public int PilotLaserOff()
|
|
{
|
|
if (IsSimul) {
|
|
return E1.OK;
|
|
}
|
|
if (CanCallLaserFunction() == false) {
|
|
return E1.GENERIC;
|
|
}
|
|
|
|
return _laserYLPPSocketConn.PilotLaserOff();
|
|
}
|
|
|
|
public bool GetPilotLaserStatus()
|
|
{
|
|
if (IsSimul) {
|
|
return true;
|
|
}
|
|
if (CanCallLaserFunction() == false) {
|
|
return false;
|
|
}
|
|
|
|
return _laserYLPPSocketConn.GetPilotLaserStatus();
|
|
}
|
|
|
|
public bool GetLaserReady()
|
|
{
|
|
if (IsSimul) {
|
|
return true;
|
|
}
|
|
if (CanCallLaserFunction() == false) {
|
|
return false;
|
|
}
|
|
|
|
return _laserYLPPSocketConn.GetLaserReady();
|
|
}
|
|
|
|
public bool GetPilotLaserSetBitStatus()
|
|
{
|
|
if (IsSimul) {
|
|
return true;
|
|
}
|
|
if (CanCallLaserFunction() == false) {
|
|
return false;
|
|
}
|
|
|
|
return _laserYLPPSocketConn.GetPilotLaserSetBitStatus();
|
|
}
|
|
|
|
public bool GetConnected()
|
|
{
|
|
if (IsSimul) {
|
|
return true;
|
|
}
|
|
if (CanCallLaserFunction() == false) {
|
|
return false;
|
|
}
|
|
|
|
return _laserYLPPSocketConn.GetConnected();
|
|
}
|
|
|
|
public int SetData(int nTarget, int value)
|
|
{
|
|
if (IsSimul) {
|
|
return E1.OK;
|
|
}
|
|
if (CanCallLaserFunction() == false) {
|
|
return E1.GENERIC;
|
|
}
|
|
|
|
return _laserYLPPSocketConn.SetData(nTarget, value);
|
|
}
|
|
|
|
public int ResetLaser()
|
|
{
|
|
if (IsSimul) {
|
|
return E1.OK;
|
|
}
|
|
if (CanCallLaserFunction() == false) {
|
|
return E1.GENERIC;
|
|
}
|
|
|
|
return _laserYLPPSocketConn.ResetLaser();
|
|
}
|
|
public string GetControlMode()
|
|
{
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
public bool GetControlModeSetStatus()
|
|
{
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
public bool GetEmissionStatus()
|
|
{
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
public bool GetEStop()
|
|
{
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
public bool GetInitCommunication()
|
|
{
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
public bool GetLaserError()
|
|
{
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
public bool GetLaserResetSetBitStatus()
|
|
{
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
public bool GetLaserStartSetBitStatus()
|
|
{
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
public string GetPowerCenter()
|
|
{
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
public string GetPowerRing()
|
|
{
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
public bool GetStartLaserSetBitStatus()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public bool GetWarningStatus()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
public bool GetLaserInterlock()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
}
|
|
}
|