diff --git a/CMS_CORE_Library/Siemens/Nc_Siemens.cs b/CMS_CORE_Library/Siemens/Nc_Siemens.cs index 92d7f33..6b3f28d 100644 --- a/CMS_CORE_Library/Siemens/Nc_Siemens.cs +++ b/CMS_CORE_Library/Siemens/Nc_Siemens.cs @@ -128,6 +128,11 @@ namespace CMS_CORE_Library.Siemens private static Dictionary InterpAxesPosition = new Dictionary(); private static Dictionary ProgrammedAxisPosition = new Dictionary(); + 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[] { }; + } + + /** + * + * Instantiate The NC-Siemens Class + * + * Send/Recieve timeout connection [mS] + * Enable Axes Svc + * Enable Alarms Svc + * Enable Tools Svc + * */ + + 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)