Fix Siemens connection for non-active software
This commit is contained in:
@@ -128,6 +128,11 @@ namespace CMS_CORE_Library.Siemens
|
||||
private static Dictionary<string, double> InterpAxesPosition = new Dictionary<string, double>();
|
||||
private static Dictionary<string, double> ProgrammedAxisPosition = new Dictionary<string, double>();
|
||||
|
||||
Boolean EnableAxes;
|
||||
Boolean EnableAlarms;
|
||||
Boolean EnableTools;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region Contructor & global methods
|
||||
@@ -141,15 +146,38 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
public Nc_Siemens(ushort ConnectionTimeOut)
|
||||
{
|
||||
// Set Connected to FALSE and close the session
|
||||
//Connected = false;
|
||||
//Setup options
|
||||
this.EnableAxes = true;
|
||||
this.EnableAlarms = true;
|
||||
this.EnableTools = true;
|
||||
|
||||
//Setup timeout
|
||||
TimeoutConn = ConnectionTimeOut;
|
||||
SiemensAlarms = new Alarm[] { };
|
||||
}
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* Instantiate The NC-Siemens Class
|
||||
* </summary>
|
||||
* <param name="ConnectionTimeOut">Send/Recieve timeout connection [mS]</param>
|
||||
* <param name="EnableAxes">Enable Axes Svc</param>
|
||||
* <param name="EnableAlarms">Enable Alarms Svc</param>
|
||||
* <param name="EnableTools">Enable Tools Svc</param>
|
||||
* */
|
||||
|
||||
public Nc_Siemens(ushort ConnectionTimeOut, Boolean EnableAxes, Boolean EnableAlarms, Boolean EnableTools)
|
||||
{
|
||||
//Setup options
|
||||
this.EnableAxes = EnableAxes;
|
||||
this.EnableAlarms = EnableAlarms;
|
||||
this.EnableTools = EnableTools;
|
||||
|
||||
//Setup timeout
|
||||
TimeoutConn = ConnectionTimeOut;
|
||||
SiemensAlarms = new Alarm[] { };
|
||||
}
|
||||
|
||||
//Connect Method
|
||||
public override CmsError NC_Connect()
|
||||
{
|
||||
// Try to get information
|
||||
@@ -168,8 +196,11 @@ namespace CMS_CORE_Library.Siemens
|
||||
Connected = true;
|
||||
|
||||
// InitializeSiemens objects
|
||||
if (AxesSvc == null)
|
||||
AxesSvc = new DataSvc();
|
||||
if(this.EnableAxes)
|
||||
{
|
||||
if (AxesSvc == null)
|
||||
AxesSvc = new DataSvc();
|
||||
}
|
||||
|
||||
if (SelectedProcessSvc == null)
|
||||
{
|
||||
@@ -188,31 +219,37 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
//Setup the alarms (Only managed in this way (Siemens Thread)
|
||||
|
||||
SiemensAlarms = new Alarm[] { };
|
||||
SiemensAlmSvc = new AlarmSvc(ConvertToSTEPLanguage(SiemensLanguage).ThreeLetterISOLanguageName);
|
||||
SiemensAlmSvc.Subscribe(AlarmsChanged);
|
||||
Infrastructure.SubscribeLanguageChanged(NcLanguageChanged);
|
||||
|
||||
// Setup tooltable listeners
|
||||
if (SiemensToolSvc == null)
|
||||
if (this.EnableAlarms)
|
||||
{
|
||||
SiemensToolSvc = new ToolMngmntSvc(1);
|
||||
ToolMngmtListGuid = SiemensToolSvc.Subscribe(ToolMngmtSvcHandler);
|
||||
SetupToolTableData();
|
||||
SiemensAlarms = new Alarm[] { };
|
||||
SiemensAlmSvc = new AlarmSvc(ConvertToSTEPLanguage(SiemensLanguage).ThreeLetterISOLanguageName);
|
||||
SiemensAlmSvc.Subscribe(AlarmsChanged);
|
||||
Infrastructure.SubscribeLanguageChanged(NcLanguageChanged);
|
||||
}
|
||||
|
||||
// Setup magazine position listener
|
||||
if (MagazinePositionSvc == null)
|
||||
if (this.EnableTools)
|
||||
{
|
||||
MagazinePositionSvc = new DataSvc();
|
||||
SetupMagazinePositionListener();
|
||||
}
|
||||
// Setup tooltable listeners
|
||||
if (SiemensToolSvc == null)
|
||||
{
|
||||
SiemensToolSvc = new ToolMngmntSvc(1);
|
||||
ToolMngmtListGuid = SiemensToolSvc.Subscribe(ToolMngmtSvcHandler);
|
||||
SetupToolTableData();
|
||||
}
|
||||
|
||||
// Setup magazine action
|
||||
if(MagazineActionsSvc == null)
|
||||
{
|
||||
MagazineActionsSvc = new DataSvc();
|
||||
SetupMagazineActionListener();
|
||||
// Setup magazine position listener
|
||||
if (MagazinePositionSvc == null)
|
||||
{
|
||||
MagazinePositionSvc = new DataSvc();
|
||||
SetupMagazinePositionListener();
|
||||
}
|
||||
|
||||
// Setup magazine action
|
||||
if (MagazineActionsSvc == null)
|
||||
{
|
||||
MagazineActionsSvc = new DataSvc();
|
||||
SetupMagazineActionListener();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user