190 lines
4.4 KiB
C#
190 lines
4.4 KiB
C#
using Aurora.Api;
|
|
using AuroraLBAD.Device;
|
|
using Hermes;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using static AuroraLBAD.Device.LBAD_PILOT;
|
|
|
|
|
|
namespace AuroraLBAD
|
|
{
|
|
public class LBAD : Aurora.Api.Device
|
|
{
|
|
protected Logger Log = new Logger("LBAD");
|
|
|
|
private ILBAD _ILBAD;
|
|
private bool _IsSimulBySetting;
|
|
|
|
public LBADConfig Config { get; set; }
|
|
|
|
#region Constructor
|
|
public LBAD(string deviceId, bool isSimul)
|
|
{
|
|
_IsSimulBySetting = isSimul;
|
|
DeviceId = deviceId;
|
|
_ILBAD = new LBAD_PILOT(deviceId , isSimul);
|
|
}
|
|
#endregion
|
|
|
|
protected override int DoActivate(IDeviceConfig config)
|
|
{
|
|
Config = config as LBADConfig;
|
|
IsSimul = Config.IsSimul || _IsSimulBySetting;
|
|
if (IsSimul)
|
|
{
|
|
return E1.OK;
|
|
}
|
|
|
|
if (_ILBAD == null)
|
|
return -1;
|
|
return _ILBAD.Open(Config);
|
|
}
|
|
|
|
protected override int DoDeactivate()
|
|
{
|
|
if (_ILBAD != null)
|
|
_ILBAD.DisConnect();
|
|
|
|
return E1.OK;
|
|
}
|
|
|
|
public int SendCellData()
|
|
{
|
|
if (!IsActivated) {
|
|
return E2.NOT_CONNECTED;
|
|
}
|
|
if (IsSimul) {
|
|
return E1.OK;
|
|
}
|
|
|
|
return _ILBAD.SendCellData();
|
|
}
|
|
|
|
public int SendCellData(string strLotID, string strCellID, int nRecipeID, int nModelID)
|
|
{
|
|
if (!IsActivated) {
|
|
return E2.NOT_CONNECTED;
|
|
}
|
|
if (IsSimul) {
|
|
return E1.OK;
|
|
}
|
|
|
|
return _ILBAD.SendCellData(strLotID, strCellID, nRecipeID, nModelID);
|
|
}
|
|
|
|
public int GetResult(out Int16 result)
|
|
{
|
|
if (!IsActivated) {
|
|
result = -1;
|
|
return E2.NOT_CONNECTED;
|
|
}
|
|
|
|
result = _ILBAD.GetResult();
|
|
return E1.OK;
|
|
}
|
|
|
|
public int GetResultDataList(out List<stReceiveData> ResultList)
|
|
{
|
|
if (!IsActivated) {
|
|
ResultList = null;
|
|
return E2.NOT_CONNECTED;
|
|
}
|
|
|
|
int result = _ILBAD.GetResultDataList(out ResultList);
|
|
return result;
|
|
}
|
|
|
|
public int Open(LBADConfig Config)
|
|
{
|
|
if (Config == null) {
|
|
return -1;
|
|
}
|
|
|
|
if (Config.IsSimul) {
|
|
return E1.OK;
|
|
}
|
|
|
|
return _ILBAD.Open(Config);
|
|
}
|
|
|
|
public void DisConnect()
|
|
{
|
|
if (!IsActivated) {
|
|
return;
|
|
}
|
|
|
|
_ILBAD.DisConnect();
|
|
}
|
|
|
|
public bool GetConnected()
|
|
{
|
|
if (!IsActivated) {
|
|
return false;
|
|
}
|
|
|
|
if (IsSimul) {
|
|
return true;
|
|
}
|
|
|
|
return _ILBAD.GetConnected();
|
|
}
|
|
|
|
public unsafe int SendInfoData(string strLotID, string strCellID, int nRecipeID, int nModelID)
|
|
{
|
|
if (!IsActivated) {
|
|
return E2.NOT_CONNECTED;
|
|
}
|
|
|
|
return _ILBAD.SendInfoData(strLotID, strCellID, nRecipeID, nModelID);
|
|
}
|
|
|
|
public void ClearResultDataList()
|
|
{
|
|
if (!IsActivated) {
|
|
return;
|
|
}
|
|
|
|
_ILBAD.ClearResultDataList();
|
|
}
|
|
|
|
public void SetReadybyAuto(bool isSeqInitialize)
|
|
{
|
|
if (!IsActivated) {
|
|
return;
|
|
}
|
|
|
|
_ILBAD.SetReadybyAuto(isSeqInitialize);
|
|
}
|
|
|
|
public bool GetReadybyAuto()
|
|
{
|
|
if (!IsActivated) {
|
|
return false;
|
|
}
|
|
|
|
return _ILBAD.GetReadybyAuto();
|
|
}
|
|
|
|
}
|
|
|
|
public interface ILBAD
|
|
{
|
|
int Open(LBADConfig Config);
|
|
void DisConnect();
|
|
bool GetConnected();
|
|
Int16 GetResult();
|
|
int GetAlarm();
|
|
int GetEnable();
|
|
|
|
int SendCellData();
|
|
int SendCellData(string strLotID, string strCellID, int nRecipeID, int nModelID);
|
|
|
|
int GetResultDataList(out List<stReceiveData> ResultList);
|
|
unsafe int SendInfoData(string strLotID, string strCellID, int nRecipeID, int nModelID);
|
|
void ClearResultDataList();
|
|
|
|
void SetReadybyAuto(bool isSeqInitialize);
|
|
bool GetReadybyAuto();
|
|
}
|
|
}
|