This commit is contained in:
Generated
+64
-40
@@ -30,6 +30,8 @@
|
||||
{
|
||||
this.Connect = new System.Windows.Forms.Button();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.Disconnect = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
@@ -67,11 +69,12 @@
|
||||
this.TXTPPName = new System.Windows.Forms.TextBox();
|
||||
this.TXTPPLines = new System.Windows.Forms.TextBox();
|
||||
this.groupBox5 = new System.Windows.Forms.GroupBox();
|
||||
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.Disconnect = new System.Windows.Forms.Button();
|
||||
this.TXTNow = new System.Windows.Forms.TextBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.Error = new System.Windows.Forms.TextBox();
|
||||
this.panel1.SuspendLayout();
|
||||
this.tableLayoutPanel3.SuspendLayout();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
@@ -84,7 +87,6 @@
|
||||
this.tabControl2.SuspendLayout();
|
||||
this.tabPage3.SuspendLayout();
|
||||
this.groupBox5.SuspendLayout();
|
||||
this.tableLayoutPanel3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// Connect
|
||||
@@ -118,6 +120,33 @@
|
||||
this.panel1.TabIndex = 1;
|
||||
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
|
||||
//
|
||||
// tableLayoutPanel3
|
||||
//
|
||||
this.tableLayoutPanel3.ColumnCount = 2;
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel3.Controls.Add(this.Disconnect, 1, 0);
|
||||
this.tableLayoutPanel3.Controls.Add(this.Connect, 0, 0);
|
||||
this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 92);
|
||||
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
|
||||
this.tableLayoutPanel3.RowCount = 1;
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel3.Size = new System.Drawing.Size(632, 29);
|
||||
this.tableLayoutPanel3.TabIndex = 6;
|
||||
//
|
||||
// Disconnect
|
||||
//
|
||||
this.Disconnect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Disconnect.Enabled = false;
|
||||
this.Disconnect.Location = new System.Drawing.Point(319, 3);
|
||||
this.Disconnect.Name = "Disconnect";
|
||||
this.Disconnect.Size = new System.Drawing.Size(310, 23);
|
||||
this.Disconnect.TabIndex = 1;
|
||||
this.Disconnect.Text = "Disconnect";
|
||||
this.Disconnect.UseVisualStyleBackColor = true;
|
||||
this.Disconnect.Click += new System.EventHandler(this.Disconnect_Click);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@@ -322,7 +351,7 @@
|
||||
this.tableLayoutPanel1.ColumnCount = 3;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.76253F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 49.23747F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 285F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 286F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.groupBox2, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.groupBox4, 2, 0);
|
||||
@@ -341,7 +370,7 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox2.Controls.Add(this.TXTMsg);
|
||||
this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.groupBox2.Location = new System.Drawing.Point(164, 3);
|
||||
this.groupBox2.Location = new System.Drawing.Point(163, 3);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(150, 265);
|
||||
this.groupBox2.TabIndex = 28;
|
||||
@@ -368,7 +397,7 @@
|
||||
this.groupBox1.Controls.Add(this.TXTAlmNc);
|
||||
this.groupBox1.Location = new System.Drawing.Point(3, 3);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(155, 265);
|
||||
this.groupBox1.Size = new System.Drawing.Size(154, 265);
|
||||
this.groupBox1.TabIndex = 27;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Nc";
|
||||
@@ -382,7 +411,7 @@
|
||||
this.TXTAlmNc.Multiline = true;
|
||||
this.TXTAlmNc.Name = "TXTAlmNc";
|
||||
this.TXTAlmNc.ReadOnly = true;
|
||||
this.TXTAlmNc.Size = new System.Drawing.Size(143, 240);
|
||||
this.TXTAlmNc.Size = new System.Drawing.Size(142, 240);
|
||||
this.TXTAlmNc.TabIndex = 20;
|
||||
//
|
||||
// groupBox4
|
||||
@@ -392,9 +421,9 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox4.Controls.Add(this.tabControl1);
|
||||
this.groupBox4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.groupBox4.Location = new System.Drawing.Point(320, 3);
|
||||
this.groupBox4.Location = new System.Drawing.Point(319, 3);
|
||||
this.groupBox4.Name = "groupBox4";
|
||||
this.groupBox4.Size = new System.Drawing.Size(280, 265);
|
||||
this.groupBox4.Size = new System.Drawing.Size(281, 265);
|
||||
this.groupBox4.TabIndex = 29;
|
||||
this.groupBox4.TabStop = false;
|
||||
this.groupBox4.Text = "Path";
|
||||
@@ -408,7 +437,7 @@
|
||||
this.tabControl1.Location = new System.Drawing.Point(6, 21);
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(267, 238);
|
||||
this.tabControl1.Size = new System.Drawing.Size(268, 238);
|
||||
this.tabControl1.TabIndex = 0;
|
||||
//
|
||||
// tabPage1
|
||||
@@ -417,7 +446,7 @@
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(259, 212);
|
||||
this.tabPage1.Size = new System.Drawing.Size(260, 212);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "Path 1";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
@@ -431,7 +460,7 @@
|
||||
this.TXTAlm.Multiline = true;
|
||||
this.TXTAlm.Name = "TXTAlm";
|
||||
this.TXTAlm.ReadOnly = true;
|
||||
this.TXTAlm.Size = new System.Drawing.Size(247, 203);
|
||||
this.TXTAlm.Size = new System.Drawing.Size(248, 203);
|
||||
this.TXTAlm.TabIndex = 18;
|
||||
//
|
||||
// groupBox3
|
||||
@@ -554,33 +583,6 @@
|
||||
this.groupBox5.TabStop = false;
|
||||
this.groupBox5.Text = "Nc Info";
|
||||
//
|
||||
// tableLayoutPanel3
|
||||
//
|
||||
this.tableLayoutPanel3.ColumnCount = 2;
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel3.Controls.Add(this.Disconnect, 1, 0);
|
||||
this.tableLayoutPanel3.Controls.Add(this.Connect, 0, 0);
|
||||
this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 92);
|
||||
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
|
||||
this.tableLayoutPanel3.RowCount = 1;
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel3.Size = new System.Drawing.Size(632, 29);
|
||||
this.tableLayoutPanel3.TabIndex = 6;
|
||||
//
|
||||
// Disconnect
|
||||
//
|
||||
this.Disconnect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Disconnect.Enabled = false;
|
||||
this.Disconnect.Location = new System.Drawing.Point(319, 3);
|
||||
this.Disconnect.Name = "Disconnect";
|
||||
this.Disconnect.Size = new System.Drawing.Size(310, 23);
|
||||
this.Disconnect.TabIndex = 1;
|
||||
this.Disconnect.Text = "Disconnect";
|
||||
this.Disconnect.UseVisualStyleBackColor = true;
|
||||
this.Disconnect.Click += new System.EventHandler(this.Disconnect_Click);
|
||||
//
|
||||
// TXTNow
|
||||
//
|
||||
this.TXTNow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@@ -600,11 +602,31 @@
|
||||
this.label7.TabIndex = 26;
|
||||
this.label7.Text = "Nc Time:";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(15, 755);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(32, 13);
|
||||
this.label10.TabIndex = 28;
|
||||
this.label10.Text = "Error:";
|
||||
//
|
||||
// Error
|
||||
//
|
||||
this.Error.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Error.Location = new System.Drawing.Point(53, 752);
|
||||
this.Error.Name = "Error";
|
||||
this.Error.ReadOnly = true;
|
||||
this.Error.Size = new System.Drawing.Size(462, 20);
|
||||
this.Error.TabIndex = 27;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(641, 784);
|
||||
this.Controls.Add(this.Error);
|
||||
this.Controls.Add(this.label10);
|
||||
this.Controls.Add(this.tableLayoutPanel2);
|
||||
this.Controls.Add(this.label9);
|
||||
this.Controls.Add(this.TXTTime);
|
||||
@@ -615,6 +637,7 @@
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.tableLayoutPanel3.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
@@ -632,7 +655,6 @@
|
||||
this.tabPage3.PerformLayout();
|
||||
this.groupBox5.ResumeLayout(false);
|
||||
this.groupBox5.PerformLayout();
|
||||
this.tableLayoutPanel3.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -683,6 +705,8 @@
|
||||
private System.Windows.Forms.Button Disconnect;
|
||||
private System.Windows.Forms.TextBox TXTNow;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.TextBox Error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+149
-104
@@ -1,34 +1,23 @@
|
||||
using CMS_CORE;
|
||||
using CMS_CORE.Demo;
|
||||
using CMS_CORE.Exceptions;
|
||||
using CMS_CORE.Fanuc;
|
||||
using CMS_CORE.Osai;
|
||||
using CMS_CORE.Siemens;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.ServiceModel;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static CMS_CORE.Nc;
|
||||
using static CMS_CORE_Library.DataStructures;
|
||||
|
||||
namespace CMS_CORE_Application
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
static Nc N;
|
||||
static String NCType;
|
||||
static String NCIp;
|
||||
static ushort NCPort;
|
||||
static String NCType;
|
||||
static String NCIp;
|
||||
static ushort NCPort;
|
||||
Thread t;
|
||||
|
||||
public Form1()
|
||||
@@ -38,7 +27,7 @@ namespace CMS_CORE_Application
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void connectDemo_Click(object sender, EventArgs e)
|
||||
@@ -48,15 +37,15 @@ namespace CMS_CORE_Application
|
||||
if (NcCombo.SelectedItem == null)
|
||||
return;
|
||||
|
||||
NCType = NcCombo.SelectedItem.ToString().Trim();
|
||||
NCIp = TXTip.Text.Trim();
|
||||
NCPort = ushort.Parse(TXTport.Text.Trim());
|
||||
if(NCType != "")
|
||||
NCType = NcCombo.SelectedItem.ToString().Trim();
|
||||
NCIp = TXTip.Text.Trim();
|
||||
NCPort = ushort.Parse(TXTport.Text.Trim());
|
||||
if (NCType != "")
|
||||
{
|
||||
Connect.Enabled = false;
|
||||
Disconnect.Enabled = true;
|
||||
t.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void test()
|
||||
@@ -69,106 +58,162 @@ namespace CMS_CORE_Application
|
||||
String SFTVersion = "";
|
||||
String PPName = "";
|
||||
DateTime NcTime = new DateTime();
|
||||
Dictionary<String, double> Axes = new Dictionary<String,double>();
|
||||
Dictionary<String, double> Axes = new Dictionary<String, double>();
|
||||
Stopwatch sw = new Stopwatch();
|
||||
List<String> Alm = new List<string>();
|
||||
List<String> Msg = new List<string>();
|
||||
List<String> Alm2 = new List<string>();
|
||||
List<String> Lines = new List<string>();
|
||||
PrePowerOnModel prePowerOn = new PrePowerOnModel();
|
||||
|
||||
try
|
||||
|
||||
if (NCType == "Siemens")
|
||||
N = new Nc_Siemens(500);
|
||||
if (NCType == "Demo")
|
||||
N = new Nc_Demo(NCIp, NCPort);
|
||||
if (NCType == "Osai")
|
||||
N = new Nc_Osai(NCIp, NCPort, 500);
|
||||
if (NCType == "Fanuc")
|
||||
N = new Nc_Fanuc(NCIp, NCPort, 500);
|
||||
|
||||
CmsError cmsError = N.NC_Connect();
|
||||
cmsError = N.NC_RModelName(ref ModelName);
|
||||
N.NC_RProcessesNum(ref procnum);
|
||||
N.NC_RMachineNumber(ref MachNumber);
|
||||
bool error = false;
|
||||
while (true)
|
||||
{
|
||||
if (NCType == "Siemens")
|
||||
N = new Nc_Siemens(500);
|
||||
if (NCType == "Demo")
|
||||
N = new Nc_Demo(NCIp, NCPort);
|
||||
if (NCType == "Osai")
|
||||
N = new Nc_Osai(NCIp, NCPort,500);
|
||||
if (NCType == "Fanuc")
|
||||
N = new Nc_Fanuc(NCIp, NCPort, 500);
|
||||
|
||||
CmsError cmsError = N.NC_Connect();
|
||||
cmsError = N.NC_RModelName(ref ModelName);
|
||||
N.NC_RProcessesNum(ref procnum);
|
||||
N.NC_RMachineNumber(ref MachNumber);
|
||||
|
||||
while (true)
|
||||
sw.Restart();
|
||||
cmsError = N.PROC_RMode(1, ref mode);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
sw.Restart();
|
||||
N.PROC_RMode(1,ref mode);
|
||||
N.PROC_RStatus(1, ref status);
|
||||
N.PROC_RActiveAlarms(1,ref Alm);
|
||||
N.NC_RActiveAlarms(ref Alm2);
|
||||
N.PLC_RActiveMessages(ref Msg);
|
||||
N.NC_RSoftwareVersion(ref SFTVersion);
|
||||
N.PROC_RPPLines(1,ref Lines);
|
||||
N.PROC_RPPName(1, ref PPName);
|
||||
N.NC_RDateTime(ref NcTime);
|
||||
|
||||
|
||||
|
||||
if (!this.IsDisposed && this.InvokeRequired)
|
||||
{
|
||||
this.Invoke((ThreadStart)delegate ()
|
||||
{
|
||||
TXTPath1.Text = mode.ToString();
|
||||
TXTStat1.Text = status.ToString();
|
||||
TXTNProcess.Text = procnum.ToString();
|
||||
TXTName.Text = ModelName;
|
||||
TXTMachNum.Text = MachNumber;
|
||||
TXTSft.Text = SFTVersion;
|
||||
TXTTime.Text = sw.ElapsedMilliseconds.ToString()+" mS";
|
||||
TXTAlm.Text = String.Join(Environment.NewLine, Alm);
|
||||
TXTAlmNc.Text = String.Join(Environment.NewLine, Alm2);
|
||||
TXTMsg.Text = String.Join(Environment.NewLine, Msg);
|
||||
TXTPPName.Text = PPName;
|
||||
TXTNow.Text = NcTime.ToString();
|
||||
|
||||
TXTPPLines.Text = String.Join(Environment.NewLine, Lines);
|
||||
Connect.Enabled = false;
|
||||
Disconnect.Enabled = true;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//sw.Stop();
|
||||
if ((200 - (int)sw.ElapsedMilliseconds) < 0)
|
||||
Debug.WriteLine("Ritardo");
|
||||
|
||||
Thread.Sleep(200);
|
||||
error = true;
|
||||
SetError(Lines, cmsError);
|
||||
}
|
||||
}
|
||||
catch (Nc_Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
cmsError = N.PROC_RStatus(1, ref status);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
error = true;
|
||||
SetError(Lines, cmsError);
|
||||
}
|
||||
cmsError = N.PROC_RActiveAlarms(1, ref Alm);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
error = true;
|
||||
SetError(Lines, cmsError);
|
||||
}
|
||||
cmsError = N.NC_RActiveAlarms(ref Alm2);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
error = true;
|
||||
SetError(Lines, cmsError);
|
||||
}
|
||||
cmsError = N.PLC_RActiveMessages(ref Msg);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
error = true;
|
||||
SetError(Lines, cmsError);
|
||||
}
|
||||
cmsError = N.NC_RSoftwareVersion(ref SFTVersion);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
error = true;
|
||||
SetError(Lines, cmsError);
|
||||
}
|
||||
cmsError = N.PROC_RPPLines(1, ref Lines);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
error = true;
|
||||
SetError(Lines, cmsError);
|
||||
}
|
||||
cmsError = N.PROC_RPPName(1, ref PPName);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
error = true;
|
||||
SetError(Lines, cmsError);
|
||||
}
|
||||
cmsError = N.NC_RDateTime(ref NcTime);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
error = true;
|
||||
SetError(Lines, cmsError);
|
||||
}
|
||||
prePowerOn = new PrePowerOnModel()
|
||||
{
|
||||
PowerOn = true,
|
||||
ProtectionStatus = false,
|
||||
AirPressure = false,
|
||||
EmergencyButtons = false,
|
||||
SettingMode = false,
|
||||
StartingKey = true
|
||||
};
|
||||
|
||||
if (!this.IsDisposed && this.InvokeRequired)
|
||||
cmsError = N.Nc_RWPrePowerOnFunctions(Nc.W, ref prePowerOn);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
error = true;
|
||||
SetError(Lines, cmsError);
|
||||
}
|
||||
|
||||
if (!error && !this.IsDisposed && this.InvokeRequired)
|
||||
{
|
||||
this.Invoke((ThreadStart)delegate ()
|
||||
{
|
||||
TXTPath1.Text = "";
|
||||
TXTStat1.Text = "";
|
||||
TXTNProcess.Text = "";
|
||||
TXTName.Text = "";
|
||||
TXTMachNum.Text = "";
|
||||
TXTSft.Text = "";
|
||||
TXTTime.Text = "";
|
||||
TXTAlm.Text = "";
|
||||
TXTAlmNc.Text = "";
|
||||
TXTMsg.Text = "";
|
||||
TXTPPName.Text = "";
|
||||
TXTNow.Text = "";
|
||||
TXTPPLines.Text = "";
|
||||
TXTPath1.Text = mode.ToString();
|
||||
TXTStat1.Text = status.ToString();
|
||||
TXTNProcess.Text = procnum.ToString();
|
||||
TXTName.Text = ModelName;
|
||||
TXTMachNum.Text = MachNumber;
|
||||
TXTSft.Text = SFTVersion;
|
||||
TXTTime.Text = sw.ElapsedMilliseconds.ToString() + " mS";
|
||||
TXTAlm.Text = String.Join(Environment.NewLine, Alm);
|
||||
TXTAlmNc.Text = String.Join(Environment.NewLine, Alm2);
|
||||
TXTMsg.Text = String.Join(Environment.NewLine, Msg);
|
||||
TXTPPName.Text = PPName;
|
||||
TXTNow.Text = NcTime.ToString();
|
||||
Error.Text = "";
|
||||
|
||||
TXTPPLines.Text = String.Join(Environment.NewLine, Lines);
|
||||
Connect.Enabled = true;
|
||||
Disconnect.Enabled = false;
|
||||
Connect.Enabled = false;
|
||||
Disconnect.Enabled = true;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//sw.Stop();
|
||||
if ((200 - (int)sw.ElapsedMilliseconds) < 0)
|
||||
Debug.WriteLine("Ritardo");
|
||||
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetError(List<String> Lines, CmsError cmsError)
|
||||
{
|
||||
if (!this.IsDisposed && this.InvokeRequired)
|
||||
{
|
||||
this.Invoke((ThreadStart)delegate ()
|
||||
{
|
||||
TXTPath1.Text = "";
|
||||
TXTStat1.Text = "";
|
||||
TXTNProcess.Text = "";
|
||||
TXTName.Text = "";
|
||||
TXTMachNum.Text = "";
|
||||
TXTSft.Text = "";
|
||||
TXTTime.Text = "";
|
||||
TXTAlm.Text = "";
|
||||
TXTAlmNc.Text = "";
|
||||
TXTMsg.Text = "";
|
||||
TXTPPName.Text = "";
|
||||
TXTNow.Text = "";
|
||||
TXTPPLines.Text = "";
|
||||
Error.Text = cmsError.message;
|
||||
|
||||
TXTPPLines.Text = String.Join(Environment.NewLine, Lines);
|
||||
Connect.Enabled = true;
|
||||
Disconnect.Enabled = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
@@ -178,7 +223,7 @@ namespace CMS_CORE_Application
|
||||
TXTip.Enabled = false;
|
||||
TXTport.Enabled = false;
|
||||
}
|
||||
else if(NcCombo.SelectedItem.ToString().Equals("Fanuc"))
|
||||
else if (NcCombo.SelectedItem.ToString().Equals("Fanuc"))
|
||||
{
|
||||
TXTip.Enabled = true;
|
||||
TXTport.Enabled = true;
|
||||
@@ -206,7 +251,7 @@ namespace CMS_CORE_Application
|
||||
|
||||
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if(t != null)
|
||||
if (t != null)
|
||||
t.Abort();
|
||||
}
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DataStructures.cs" />
|
||||
<Compile Include="Demo\ILibraryService.cs" />
|
||||
<Compile Include="Demo\Models\BinaryMemoryModel.cs" />
|
||||
<Compile Include="Demo\Models\FileModel.cs" />
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CMS_CORE_Library
|
||||
{
|
||||
public static class DataStructures
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#region Cms Errors Codes
|
||||
|
||||
public enum CMS_ERROR_CODES : uint
|
||||
{
|
||||
OK = 0,
|
||||
NC_PROD_ERROR = 1,
|
||||
NOT_CONNECTED = 2,
|
||||
PROC_NOT_FOUND = 3,
|
||||
FUNCTION_NOT_ALLOWED = 4,
|
||||
BIT_NOT_IN_RANGE = 5,
|
||||
BYTE_NOT_IN_RANGE = 6,
|
||||
INTERNAL_ERROR = 7,
|
||||
INCORRECT_PARAMETERS = 8,
|
||||
NC_LANGUAGE_ERROR = 9,
|
||||
SIEMENS_ENVIRONMENT_NOT_FOUND = 10,
|
||||
SIEMENS_HMI_NOT_RUNNING = 11
|
||||
}
|
||||
|
||||
|
||||
public class CmsError
|
||||
{
|
||||
public CMS_ERROR_CODES errorCode;
|
||||
public string message;
|
||||
|
||||
public CmsError(CMS_ERROR_CODES errorCode, string message)
|
||||
{
|
||||
this.errorCode = errorCode;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public bool IsError()
|
||||
{
|
||||
if (errorCode == CMS_ERROR_CODES.OK)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
public static CmsError InternalError(string message)
|
||||
{
|
||||
return new CmsError(CMS_ERROR_CODES.INTERNAL_ERROR, message);
|
||||
}
|
||||
|
||||
public static CmsError NcError(string message)
|
||||
{
|
||||
return new CmsError(CMS_ERROR_CODES.NC_PROD_ERROR, message);
|
||||
}
|
||||
}
|
||||
|
||||
internal static CmsError NO_ERROR = new CmsError(CMS_ERROR_CODES.OK, "");
|
||||
internal static CmsError NOT_CONNECTED_ERROR = new CmsError(CMS_ERROR_CODES.NOT_CONNECTED, "CMS-Core-Error: Nc not Connected");
|
||||
internal static CmsError PROC_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.FUNCTION_NOT_ALLOWED, "CMS-Core-Error: Function not allowed for this type of NC");
|
||||
internal static CmsError FUNCTION_NOT_ALLOWED_ERROR = new CmsError(CMS_ERROR_CODES.FUNCTION_NOT_ALLOWED, "CMS-Core-Error: Function not allowed for this type of NC");
|
||||
internal static CmsError BIT_NOT_IN_RANGE_ERROR = new CmsError(CMS_ERROR_CODES.BIT_NOT_IN_RANGE, "CMS-Core-Error: Bit - number must be between 0 and 7");
|
||||
internal static CmsError BYTE_NOT_IN_RANGE_ERROR = new CmsError(CMS_ERROR_CODES.BYTE_NOT_IN_RANGE, "CMS-Core-Error: Byte - number must be between 0 and 1");
|
||||
internal static CmsError INCORRECT_PARAMETERS_ERROR = new CmsError(CMS_ERROR_CODES.INCORRECT_PARAMETERS, "CMS-Core-Error: Incorrect Parameters error");
|
||||
internal static CmsError LANGUAGE_ERROR = new CmsError(CMS_ERROR_CODES.NC_LANGUAGE_ERROR, "CMS-Core-Error: Incorrect Language");
|
||||
internal static CmsError SIEMENS_ENVIRONMENT_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND, "CMS-Core-Error: Siemens Environment not found");
|
||||
internal static CmsError SIEMENS_HMI_NOT_RUNNING_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING, "CMS-Core-Error: Siemens HMI is not Running / Ready");
|
||||
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#region Data structor models
|
||||
|
||||
public class PrePowerOnModel
|
||||
{
|
||||
public bool PowerOn;
|
||||
public bool AirPressure;
|
||||
public bool ProtectionStatus;
|
||||
public bool EmergencyButtons;
|
||||
public bool SettingMode;
|
||||
public bool StartingKey;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,11 @@ using System.Linq;
|
||||
using System.ServiceModel;
|
||||
using System.ServiceModel.Description;
|
||||
using CMS_CORE.Demo.Models;
|
||||
using CMS_CORE.Exceptions;
|
||||
using CMS_CORE_Library.Demo.Models;
|
||||
using Nc_Demo_Application.Server.Service;
|
||||
using CMS_CORE.Utils;
|
||||
using static CMS_CORE_Library.DataStructures;
|
||||
using System.Collections;
|
||||
|
||||
namespace CMS_CORE.Demo
|
||||
{
|
||||
@@ -75,7 +76,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -95,7 +96,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -115,7 +116,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -135,7 +136,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -155,7 +156,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ThrowNCException(ex);
|
||||
ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -174,7 +175,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ThrowNCException(ex);
|
||||
ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -197,7 +198,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -209,6 +210,69 @@ namespace CMS_CORE.Demo
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError Nc_RWPrePowerOnFunctions(bool bWrite, ref PrePowerOnModel prePowerOnData)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Read case: Read bit
|
||||
if (bWrite == R)
|
||||
{
|
||||
byte readedByte = 0;
|
||||
// read data from server
|
||||
CmsError cmsError = MEM_RWByte(bWrite, 0, 0, 0, 0, ref readedByte);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
// Convert a byte into PrePowerOn model
|
||||
bool[] bits = new bool[8];
|
||||
// Convert 1/0 to true/false
|
||||
bits = Convert.ToString(readedByte, 2).Select(s => s.Equals('1')).Reverse().ToArray();
|
||||
|
||||
prePowerOnData = new PrePowerOnModel()
|
||||
{
|
||||
PowerOn = bits[0],
|
||||
AirPressure = bits[1],
|
||||
ProtectionStatus = bits[2],
|
||||
EmergencyButtons = bits[3],
|
||||
SettingMode = bits[4],
|
||||
StartingKey = bits[5]
|
||||
};
|
||||
}
|
||||
// Write case: write bit
|
||||
else
|
||||
{
|
||||
// Create an array
|
||||
bool[] bitsArray = new bool[8]
|
||||
{
|
||||
prePowerOnData.PowerOn,
|
||||
prePowerOnData.AirPressure,
|
||||
prePowerOnData.ProtectionStatus,
|
||||
prePowerOnData.EmergencyButtons,
|
||||
prePowerOnData.SettingMode,
|
||||
prePowerOnData.StartingKey,
|
||||
false,false
|
||||
};
|
||||
// Create 1/0 string
|
||||
string bits = "";
|
||||
for(int i = 7; i >= 0; i--)
|
||||
{
|
||||
bits += bitsArray[i] ? "1" : "0";
|
||||
}
|
||||
// Convert to byte
|
||||
byte writeByte = Convert.ToByte(bits, 2);
|
||||
// Send data to server
|
||||
CmsError cmsError = MEM_RWByte(bWrite, 0, 0, 0, 0, ref writeByte);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -236,7 +300,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -263,7 +327,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -285,7 +349,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -310,7 +374,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -346,7 +410,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -371,7 +435,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -396,7 +460,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -421,7 +485,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -445,7 +509,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -482,7 +546,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -504,7 +568,6 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
else // Write case
|
||||
{
|
||||
|
||||
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
|
||||
binaryMemoryModel.binary = Value;
|
||||
serverService.PutByte(MemIndex.ToString(), binaryMemoryModel);
|
||||
@@ -512,7 +575,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -541,7 +604,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -570,7 +633,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -599,7 +662,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -628,7 +691,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -650,7 +713,7 @@ namespace CMS_CORE.Demo
|
||||
|
||||
public override CmsError MEM_RWWord(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref ushort Value)
|
||||
{
|
||||
return MEM_RWWord(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
|
||||
return MEM_RWWord(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
|
||||
}
|
||||
|
||||
public override CmsError MEM_RWShort(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref short Value)
|
||||
@@ -721,7 +784,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -750,7 +813,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -779,7 +842,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -808,7 +871,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -837,7 +900,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -891,7 +954,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -915,7 +978,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -940,7 +1003,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -959,7 +1022,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ThrowNCException(ex);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -990,10 +1053,9 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
|
||||
//Manage the Exception Launch
|
||||
private CmsError ThrowNCException(Exception ex)
|
||||
private CmsError ManageException(Exception ex)
|
||||
{
|
||||
if (!(ex is Nc_Exception))
|
||||
Connected = false;
|
||||
Connected = false;
|
||||
|
||||
//Catch the .Net exceptions
|
||||
if (ex is EndpointNotFoundException)
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using CMS_CORE.Utils;
|
||||
using static CMS_CORE_Library.DataStructures;
|
||||
using CMS_CORE_Library;
|
||||
|
||||
#pragma warning disable 1591
|
||||
@@ -36,7 +37,6 @@ namespace CMS_CORE.Fanuc
|
||||
* <summary>
|
||||
* Instantiate The NC-Fanuc Class
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <param name="IpAddress">Remote Ip-Address of the Nc</param>
|
||||
* <param name="RemotePort">Remote Port of the Nc</param>
|
||||
* <param name="ConnectionTimeOut">Send/Recieve timeout connection [mS]</param>
|
||||
@@ -258,7 +258,10 @@ namespace CMS_CORE.Fanuc
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError Nc_RWPrePowerOnFunctions(bool bWrite, ref PrePowerOnModel prePowerOnData)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
//Get the process status
|
||||
public override CmsError PROC_RStatus(ushort Number, ref PROC_Status Status)
|
||||
|
||||
+65
-126
@@ -4,10 +4,9 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static CMS_CORE_Library.DataStructures;
|
||||
|
||||
|
||||
namespace CMS_CORE
|
||||
{
|
||||
@@ -91,7 +90,6 @@ namespace CMS_CORE
|
||||
* <para>
|
||||
* Compatibility: Osai
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* </summary>
|
||||
* */
|
||||
public Boolean LIB_GetWindowsProxy() { return UseProxy; }
|
||||
@@ -103,7 +101,6 @@ namespace CMS_CORE
|
||||
* <para>
|
||||
* Compatibility: Osai
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* </summary>
|
||||
* */
|
||||
public void LIB_SetWindowsProxy(Boolean proxy) { UseProxy = proxy; }
|
||||
@@ -115,7 +112,6 @@ namespace CMS_CORE
|
||||
* <para>
|
||||
* Compatibility: Osai
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* </summary>
|
||||
* */
|
||||
public string LIB_GetPlcMsgsPath() { return OSAI_PlcMessagesPath; }
|
||||
@@ -127,7 +123,6 @@ namespace CMS_CORE
|
||||
* <para>
|
||||
* Compatibility: Osai
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* </summary>
|
||||
* */
|
||||
public void LIB_SetPlcMsgsPath(string folder) { OSAI_PlcMessagesPath = folder; }
|
||||
@@ -139,7 +134,6 @@ namespace CMS_CORE
|
||||
* <para>
|
||||
* Compatibility: Osai
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* </summary>
|
||||
* */
|
||||
public string LIB_GetWinNbiPath() { return OSAI_WinNbiPath; }
|
||||
@@ -151,7 +145,6 @@ namespace CMS_CORE
|
||||
* <para>
|
||||
* Compatibility: Osai
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* </summary>
|
||||
* */
|
||||
public void LIB_SetWinNbiPath(string folder) { OSAI_WinNbiPath = folder; }
|
||||
@@ -168,7 +161,7 @@ namespace CMS_CORE
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* </summary>
|
||||
* */
|
||||
public abstract CmsError NC_Connect();
|
||||
@@ -180,7 +173,7 @@ namespace CMS_CORE
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* </summary>
|
||||
* */
|
||||
public abstract CmsError NC_Disconnect();
|
||||
@@ -193,7 +186,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* */
|
||||
public Boolean NC_IsConnected() { return Connected; }
|
||||
|
||||
@@ -205,7 +198,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ActualTime">Reference of a DateTime Variable where data will be saved</param>
|
||||
* */
|
||||
public abstract CmsError NC_RDateTime(ref DateTime ActualTime);
|
||||
@@ -218,7 +211,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="SN">Reference of a String Variable where data will be saved</param>
|
||||
* */
|
||||
public abstract CmsError NC_RSerialNumber(ref String SN);
|
||||
@@ -230,7 +223,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ModelName">Reference of a String Variable where data will be saved</param>
|
||||
* */
|
||||
public abstract CmsError NC_RModelName(ref String ModelName);
|
||||
@@ -242,7 +235,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="SWV">Reference of a String Variable where data will be saved</param>
|
||||
* */
|
||||
public abstract CmsError NC_RSoftwareVersion(ref String SWV);
|
||||
@@ -254,7 +247,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="MachNumber">Reference of a String Variable where data will be saved</param>
|
||||
* */
|
||||
public abstract CmsError NC_RMachineNumber(ref String MachNumber);
|
||||
@@ -266,7 +259,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Reference of a ushort Variable where data will be saved</param>
|
||||
* */
|
||||
public abstract CmsError NC_RProcessesNum(ref ushort ProcNumber);
|
||||
@@ -278,7 +271,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="Language">Reference of a CultureInfo Variable where data will be saved</param>
|
||||
* */
|
||||
public abstract CmsError NC_RLanguage(ref CultureInfo Language);
|
||||
@@ -291,12 +284,22 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <param name="Alarms">Reference of a List of String Variables where data will be saved</param>
|
||||
* */
|
||||
public abstract CmsError NC_RActiveAlarms(ref List<String> Alarms);
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* </summary>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="W"/>/<see cref="R"/>)</param>
|
||||
**/
|
||||
public abstract CmsError Nc_RWPrePowerOnFunctions(Boolean bWrite, ref PrePowerOnModel prePowerOnData);
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -308,7 +311,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="Index">Index of the parameter</param>
|
||||
* <param name="Bit">Set the Bit to Read. (0..7)</param>
|
||||
* <param name="Value">Reference of a variable with Param values</param>
|
||||
@@ -321,7 +324,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="Index">Index of the parameter</param>
|
||||
* <param name="Value">Reference of a variable with Param values</param>
|
||||
* */
|
||||
@@ -333,7 +336,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="Index">Index of the parameter</param>
|
||||
* <param name="Value">Reference of a variable with Param values</param>
|
||||
* */
|
||||
@@ -345,7 +348,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="Index">Index of the parameter</param>
|
||||
* <param name="Value">Reference of a variable with Param values</param>
|
||||
* */
|
||||
@@ -357,12 +360,11 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="Index">Index of the parameter</param>
|
||||
* <param name="Value">Reference of a variable with Param values</param>
|
||||
* */
|
||||
public abstract CmsError NC_RParam(short Index, ref double Value);
|
||||
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -375,7 +377,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="Alarms">Reference of a List of String Variables where data will be saved</param>
|
||||
* */
|
||||
public abstract CmsError PLC_RActiveMessages(ref List<String> Alarms);
|
||||
@@ -393,7 +395,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <param name="Status">Reference of a PROC_Status Variable where data will be saved</param>
|
||||
* */
|
||||
@@ -407,7 +409,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <param name="Mode">Reference of a PROC_Mode Variable where data will be saved</param>
|
||||
* */
|
||||
@@ -421,7 +423,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <param name="Alarms">Reference of a List of String Variables where data will be saved</param>
|
||||
* */
|
||||
@@ -435,7 +437,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <param name="Lines">Reference of a List of String Variables where data will be saved</param>
|
||||
* */
|
||||
@@ -449,7 +451,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <param name="Name">Reference of a String Variables where data will be saved</param>
|
||||
* */
|
||||
@@ -468,7 +470,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
|
||||
* */
|
||||
@@ -482,7 +484,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
|
||||
* */
|
||||
@@ -495,7 +497,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
|
||||
* */
|
||||
@@ -508,7 +510,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
|
||||
* */
|
||||
@@ -521,7 +523,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
|
||||
* */
|
||||
@@ -539,7 +541,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -555,7 +557,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -574,7 +576,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -590,7 +592,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -609,7 +611,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -625,7 +627,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -644,7 +646,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -660,7 +662,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -679,7 +681,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>uW
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -695,7 +697,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>uW
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -714,7 +716,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -730,7 +732,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -752,7 +754,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -769,7 +771,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -789,7 +791,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -805,7 +807,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -824,7 +826,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -840,7 +842,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -859,7 +861,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -875,7 +877,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -894,7 +896,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or Nc.<see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -910,7 +912,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or Nc.<see cref="Nc.UNDEF_PROC"/>)</param>
|
||||
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
|
||||
@@ -932,7 +934,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="partProgramPath">Path of the Part Program stored in the Nc</param>
|
||||
* <param name="partProgramLocalName">Name of the Part Program and name of new local file</param>
|
||||
* <param name="localFile">Reference to the new local file where the NC Part Program data will be saved</param>
|
||||
@@ -945,7 +947,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="partProgramPath">Path of the Part Program stored in the Nc</param>
|
||||
* <param name="localFile">Reference to the local Part Program file</param>
|
||||
* */
|
||||
@@ -957,7 +959,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="partProgramPath">Path where the Part Program is saved in the NC</param>
|
||||
* <param name="newPartProgramPath">Path of the copy Part Program destination</param>
|
||||
* <param name="failIfExist"></param>
|
||||
@@ -970,7 +972,7 @@ namespace CMS_CORE
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="partProgramPath">Path where the Nc Part Program is saved in the NC</param>
|
||||
* <param name="partProgramName">Name of the Part Program file</param>
|
||||
* */
|
||||
@@ -1172,7 +1174,6 @@ namespace CMS_CORE
|
||||
SubAddress = SubAddr;
|
||||
Size = Sz;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Lingua CN
|
||||
@@ -1188,67 +1189,5 @@ namespace CMS_CORE
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#region Cms Errors Codes
|
||||
|
||||
public enum CMS_ERROR_CODES : uint
|
||||
{
|
||||
OK = 0,
|
||||
NC_PROD_ERROR = 1,
|
||||
NOT_CONNECTED = 2,
|
||||
PROC_NOT_FOUND = 3,
|
||||
FUNCTION_NOT_ALLOWED = 4,
|
||||
BIT_NOT_IN_RANGE = 5,
|
||||
BYTE_NOT_IN_RANGE = 6,
|
||||
INTERNAL_ERROR = 7,
|
||||
INCORRECT_PARAMETERS = 8,
|
||||
NC_LANGUAGE_ERROR = 9,
|
||||
SIEMENS_ENVIRONMENT_NOT_FOUND = 10,
|
||||
SIEMENS_HMI_NOT_RUNNING = 11
|
||||
}
|
||||
|
||||
|
||||
public class CmsError
|
||||
{
|
||||
public CMS_ERROR_CODES errorCode;
|
||||
public string message;
|
||||
|
||||
public CmsError(CMS_ERROR_CODES errorCode, string message)
|
||||
{
|
||||
this.errorCode = errorCode;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public bool IsError()
|
||||
{
|
||||
if (errorCode == CMS_ERROR_CODES.OK)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
public static CmsError InternalError(string message)
|
||||
{
|
||||
return new CmsError(CMS_ERROR_CODES.INTERNAL_ERROR, message);
|
||||
}
|
||||
|
||||
public static CmsError NcError(string message)
|
||||
{
|
||||
return new CmsError(CMS_ERROR_CODES.NC_PROD_ERROR, message);
|
||||
}
|
||||
}
|
||||
|
||||
internal static CmsError NO_ERROR = new CmsError(CMS_ERROR_CODES.OK, "");
|
||||
internal static CmsError NOT_CONNECTED_ERROR = new CmsError(CMS_ERROR_CODES.NOT_CONNECTED, "CMS-Core-Error: Nc not Connected");
|
||||
internal static CmsError PROC_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.FUNCTION_NOT_ALLOWED, "CMS-Core-Error: Function not allowed for this type of NC");
|
||||
internal static CmsError FUNCTION_NOT_ALLOWED_ERROR = new CmsError(CMS_ERROR_CODES.FUNCTION_NOT_ALLOWED, "CMS-Core-Error: Function not allowed for this type of NC");
|
||||
internal static CmsError BIT_NOT_IN_RANGE_ERROR = new CmsError(CMS_ERROR_CODES.BIT_NOT_IN_RANGE, "CMS-Core-Error: Bit - number must be between 0 and 7");
|
||||
internal static CmsError BYTE_NOT_IN_RANGE_ERROR = new CmsError(CMS_ERROR_CODES.BYTE_NOT_IN_RANGE, "CMS-Core-Error: Byte - number must be between 0 and 1");
|
||||
internal static CmsError INCORRECT_PARAMETERS_ERROR = new CmsError(CMS_ERROR_CODES.INCORRECT_PARAMETERS, "CMS-Core-Error: Incorrect Parameters error");
|
||||
internal static CmsError LANGUAGE_ERROR = new CmsError(CMS_ERROR_CODES.NC_LANGUAGE_ERROR, "CMS-Core-Error: Incorrect Language");
|
||||
internal static CmsError SIEMENS_ENVIRONMENT_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND, "CMS-Core-Error: Siemens Environment not found");
|
||||
internal static CmsError SIEMENS_HMI_NOT_RUNNING_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING, "CMS-Core-Error: Siemens HMI is not Running / Ready");
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,15 @@ using CndexLinkDotNet;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.ServiceModel;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using CMS_CORE_Library.OPENControl;
|
||||
using System.ComponentModel;
|
||||
using static CMS_CORE_Library.DataStructures;
|
||||
|
||||
|
||||
namespace CMS_CORE.Osai
|
||||
{
|
||||
@@ -43,7 +41,6 @@ namespace CMS_CORE.Osai
|
||||
* <summary>
|
||||
* Instantiate The NC-Osai Class
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <param name="IpAddress">Remote Ip-Address of the Nc</param>
|
||||
* <param name="RemotePort">Remote Port of the Nc</param>
|
||||
* <param name="ConnectionTimeOut">Send/Recieve timeout connection [mS]</param>
|
||||
@@ -241,7 +238,10 @@ namespace CMS_CORE.Osai
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError Nc_RWPrePowerOnFunctions(bool bWrite, ref PrePowerOnModel prePowerOnData)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
//Get the PLC Active Alarms
|
||||
public override CmsError PLC_RActiveMessages(ref List<String> Alarms)
|
||||
@@ -1585,7 +1585,7 @@ namespace CMS_CORE.Osai
|
||||
|
||||
|
||||
//Read Language Configuration
|
||||
private void LanguageConfig()
|
||||
private CmsError LanguageConfig()
|
||||
{
|
||||
String[] ConfigLines;
|
||||
String LangLine;
|
||||
@@ -1601,7 +1601,6 @@ namespace CMS_CORE.Osai
|
||||
|
||||
//Check if i found it
|
||||
if (String.IsNullOrEmpty(LangLine))
|
||||
|
||||
throw new Nc_Exception("'ID_LANGUAGE' Line in Osai Config File not Found");
|
||||
|
||||
|
||||
@@ -1613,17 +1612,19 @@ namespace CMS_CORE.Osai
|
||||
//Setup the variable
|
||||
OsaiLanguages = SPlitted[1].ToLower();
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Nc_Exception("Error in reading OSAI Configuration File:\n" + ex.Message);
|
||||
return ManageException(ex);
|
||||
//throw new Nc_Exception("Error in reading OSAI Configuration File:\n" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Read Plc Messages
|
||||
private void ReadPlcMessages()
|
||||
private CmsError ReadPlcMessages()
|
||||
{
|
||||
String[] SPlitted;
|
||||
String Path;
|
||||
@@ -1642,10 +1643,12 @@ namespace CMS_CORE.Osai
|
||||
if (SPlitted.Length > 1)
|
||||
PlcMessages[i] = SPlitted[1];
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Nc_Exception("Error in reading OSAI PLC Messages:\n" + ex.Message);
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
using CMS_CORE;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Siemens.Sinumerik.Operate.Services;
|
||||
using CMS_CORE.Exceptions;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
using CMS_CORE.Utils;
|
||||
using static CMS_CORE_Library.DataStructures;
|
||||
using CMS_CORE_Library;
|
||||
|
||||
namespace CMS_CORE.Siemens
|
||||
{
|
||||
@@ -67,7 +64,6 @@ namespace CMS_CORE.Siemens
|
||||
* Instantiate The NC-Siemens Class
|
||||
* </summary>
|
||||
* <param name="ConnectionTimeOut">Send/Recieve timeout connection [mS]</param>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* */
|
||||
public Nc_Siemens(ushort ConnectionTimeOut)
|
||||
{
|
||||
@@ -249,7 +245,10 @@ namespace CMS_CORE.Siemens
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError Nc_RWPrePowerOnFunctions(bool bWrite, ref PrePowerOnModel prePowerOnData)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
//Get the process Mode
|
||||
public override CmsError PROC_RMode(ushort ProcNumber, ref PROC_Mode Mode)
|
||||
@@ -508,19 +507,22 @@ namespace CMS_CORE.Siemens
|
||||
DataSvc Data = new DataSvc();
|
||||
Data.Timeout = TimeoutConn;
|
||||
Data.PriorityFlag = SlPriority.highPriority;
|
||||
Item Item = new Item(ConvertMemToPath(MemType, MemTable, MemIndex, MemBit, 1, 'X'));
|
||||
|
||||
cmsError = ConvertMemToPath(MemType, MemTable, MemIndex, MemBit, 1, 'X', out string itemString);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
Item item = new Item(itemString);
|
||||
|
||||
//Read-Write Data
|
||||
if (bWrite)
|
||||
{
|
||||
Item.Value = Value;
|
||||
Data.Write(Item);
|
||||
item.Value = Value;
|
||||
Data.Write(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.Read(Item);
|
||||
Value = (bool)Item.Value;
|
||||
Data.Read(item);
|
||||
Value = (bool)item.Value;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -553,23 +555,27 @@ namespace CMS_CORE.Siemens
|
||||
DataSvc Data = new DataSvc();
|
||||
Data.Timeout = TimeoutConn;
|
||||
Data.PriorityFlag = SlPriority.highPriority;
|
||||
Item Item = new Item(ConvertMemToPath(MemType, MemTable, MemIndex, 0, (bWrite) ? Value.Count : Number, 'B'));
|
||||
|
||||
cmsError = ConvertMemToPath(MemType, MemTable, MemIndex, 0, (bWrite) ? Value.Count : Number, 'B', out string itemString);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
Item item = new Item(itemString);
|
||||
|
||||
//Read-Write Data
|
||||
if (bWrite)
|
||||
{
|
||||
Item.Value = Value.ToArray();
|
||||
Data.Write(Item);
|
||||
item.Value = Value.ToArray();
|
||||
Data.Write(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.Read(Item);
|
||||
if (Item.Value.GetType().IsArray)
|
||||
Value = ((object[])Item.Value).Cast<byte>().ToList();
|
||||
Data.Read(item);
|
||||
if (item.Value.GetType().IsArray)
|
||||
Value = ((object[])item.Value).Cast<byte>().ToList();
|
||||
else
|
||||
{
|
||||
Value.Clear();
|
||||
Value.Add((byte)(uint)Item.Value);
|
||||
Value.Add((byte)(uint)item.Value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -620,23 +626,27 @@ namespace CMS_CORE.Siemens
|
||||
DataSvc Data = new DataSvc();
|
||||
Data.Timeout = TimeoutConn;
|
||||
Data.PriorityFlag = SlPriority.highPriority;
|
||||
Item Item = new Item(ConvertMemToPath(MemType, MemTable, MemIndex, 0, (bWrite) ? Value.Count : Number, 'W'));
|
||||
cmsError = ConvertMemToPath(MemType, MemTable, MemIndex, 0, (bWrite) ? Value.Count : Number, 'W', out string itemString);
|
||||
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
Item item = new Item(itemString);
|
||||
|
||||
//Read-Write Data
|
||||
if (bWrite)
|
||||
{
|
||||
Item.Value = Value.ToArray();
|
||||
Data.Write(Item);
|
||||
item.Value = Value.ToArray();
|
||||
Data.Write(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.Read(Item);
|
||||
if (Item.Value.GetType().IsArray)
|
||||
Value = Array.ConvertAll(((object[])Item.Value).Cast<uint>().ToArray(), input => (ushort)input).ToList();
|
||||
Data.Read(item);
|
||||
if (item.Value.GetType().IsArray)
|
||||
Value = Array.ConvertAll(((object[])item.Value).Cast<uint>().ToArray(), input => (ushort)input).ToList();
|
||||
else
|
||||
{
|
||||
Value.Clear();
|
||||
Value.Add(Convert.ToUInt16((uint)Item.Value));
|
||||
Value.Add(Convert.ToUInt16((uint)item.Value));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -684,23 +694,27 @@ namespace CMS_CORE.Siemens
|
||||
DataSvc Data = new DataSvc();
|
||||
Data.Timeout = TimeoutConn;
|
||||
Data.PriorityFlag = SlPriority.highPriority;
|
||||
Item Item = new Item(ConvertMemToPath(MemType, MemTable, MemIndex, 0, (bWrite) ? Value.Count : Number, 'W'));
|
||||
cmsError = ConvertMemToPath(MemType, MemTable, MemIndex, 0, (bWrite) ? Value.Count : Number, 'W', out string itemString);
|
||||
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
Item item = new Item(itemString);
|
||||
|
||||
//Read-Write Data
|
||||
if (bWrite)
|
||||
{
|
||||
Item.Value = Value.ToArray();
|
||||
Data.Write(Item);
|
||||
item.Value = Value.ToArray();
|
||||
Data.Write(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.Read(Item);
|
||||
if (Item.Value.GetType().IsArray)
|
||||
Value = Array.ConvertAll(((object[])Item.Value).Cast<uint>().ToArray(), input => unchecked((short)input)).ToList();
|
||||
Data.Read(item);
|
||||
if (item.Value.GetType().IsArray)
|
||||
Value = Array.ConvertAll(((object[])item.Value).Cast<uint>().ToArray(), input => unchecked((short)input)).ToList();
|
||||
else
|
||||
{
|
||||
Value.Clear();
|
||||
Value.Add(unchecked((short)(uint)Item.Value));
|
||||
Value.Add(unchecked((short)(uint)item.Value));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -748,23 +762,26 @@ namespace CMS_CORE.Siemens
|
||||
DataSvc Data = new DataSvc();
|
||||
Data.Timeout = TimeoutConn;
|
||||
Data.PriorityFlag = SlPriority.highPriority;
|
||||
Item Item = new Item(ConvertMemToPath(MemType, MemTable, MemIndex, 0, (bWrite) ? Value.Count : Number, 'D'));
|
||||
cmsError = ConvertMemToPath(MemType, MemTable, MemIndex, 0, (bWrite) ? Value.Count : Number, 'D', out string itemString);
|
||||
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
Item item = new Item(itemString);
|
||||
//Read-Write Data
|
||||
if (bWrite)
|
||||
{
|
||||
Item.Value = Value.ToArray();
|
||||
Data.Write(Item);
|
||||
item.Value = Value.ToArray();
|
||||
Data.Write(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.Read(Item);
|
||||
if (Item.Value.GetType().IsArray)
|
||||
Value = ((object[])Item.Value).Cast<uint>().ToList();
|
||||
Data.Read(item);
|
||||
if (item.Value.GetType().IsArray)
|
||||
Value = ((object[])item.Value).Cast<uint>().ToList();
|
||||
else
|
||||
{
|
||||
Value.Clear();
|
||||
Value.Add((uint)Item.Value);
|
||||
Value.Add((uint)item.Value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -813,23 +830,27 @@ namespace CMS_CORE.Siemens
|
||||
DataSvc Data = new DataSvc();
|
||||
Data.Timeout = TimeoutConn;
|
||||
Data.PriorityFlag = SlPriority.highPriority;
|
||||
Item Item = new Item(ConvertMemToPath(MemType, MemTable, MemIndex, 0, (bWrite) ? Value.Count : Number, 'D'));
|
||||
cmsError = ConvertMemToPath(MemType, MemTable, MemIndex, 0, (bWrite) ? Value.Count : Number, 'D', out string itemString);
|
||||
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
Item item = new Item(itemString);
|
||||
|
||||
//Read-Write Data
|
||||
if (bWrite)
|
||||
{
|
||||
Item.Value = Value.ToArray();
|
||||
Data.Write(Item);
|
||||
item.Value = Value.ToArray();
|
||||
Data.Write(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.Read(Item);
|
||||
if (Item.Value.GetType().IsArray)
|
||||
Value = Array.ConvertAll(((object[])Item.Value).Cast<uint>().ToArray(), input => unchecked((int)input)).ToList();
|
||||
Data.Read(item);
|
||||
if (item.Value.GetType().IsArray)
|
||||
Value = Array.ConvertAll(((object[])item.Value).Cast<uint>().ToArray(), input => unchecked((int)input)).ToList();
|
||||
else
|
||||
{
|
||||
Value.Clear();
|
||||
Value.Add(unchecked((int)(uint)Item.Value));
|
||||
Value.Add(unchecked((int)(uint)item.Value));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1121,20 +1142,25 @@ namespace CMS_CORE.Siemens
|
||||
|
||||
|
||||
//Check if Memory Area is corrected
|
||||
private String ConvertMemToPath(MEMORY_Type MemoryType, int Address, int SubAddress, int SubBit, int Qty, char MemAccess)
|
||||
private CmsError ConvertMemToPath(MEMORY_Type MemoryType, int Address, int SubAddress, int SubBit, int Qty, char MemAccess, out string item)
|
||||
{
|
||||
char[] allowedAccess = { 'X', 'B', 'W', 'D' };
|
||||
|
||||
//Check if is the right area and allowed type
|
||||
if (!MemoryType.ToString().StartsWith(SIEMENS_MEMTYPE) || !allowedAccess.Contains(MemAccess) || Qty < 1)
|
||||
throw new Nc_Exception("Incorrect Parameters error");
|
||||
{
|
||||
item = "";
|
||||
return INCORRECT_PARAMETERS_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
//If is Bit Access change access type
|
||||
if (MemAccess == 'X')
|
||||
return "DB" + Address + ".DB" + MemAccess + SubAddress + "." + SubBit;
|
||||
item = "DB" + Address + ".DB" + MemAccess + SubAddress + "." + SubBit;
|
||||
else
|
||||
return "DB" + Address + ".DB" + MemAccess + SubAddress + "[" + Qty + "]";
|
||||
item = "DB" + Address + ".DB" + MemAccess + SubAddress + "[" + Qty + "]";
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1208,7 +1234,11 @@ namespace CMS_CORE.Siemens
|
||||
Item ItemConfChannelNo = new Item(PathConfChannelNo);
|
||||
Item ItemLanguage = new Item(PathLanguage);
|
||||
Item ItemSerialNumber = new Item(PathSerialNumber);
|
||||
Item ItemMachineNumber = new Item(ConvertMemToPath(MATR_MACCH_SIEMENS.MemType, MATR_MACCH_SIEMENS.Address, MATR_MACCH_SIEMENS.SubAddress, 0, 1, 'W'));
|
||||
cmsError = ConvertMemToPath(MATR_MACCH_SIEMENS.MemType, MATR_MACCH_SIEMENS.Address, MATR_MACCH_SIEMENS.SubAddress, 0, 1, 'W', out string itemString);
|
||||
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
Item ItemMachineNumber = new Item(itemString);
|
||||
|
||||
//Read All Data
|
||||
ReadStaticData.Read(ItemNcType);
|
||||
|
||||
Reference in New Issue
Block a user