This commit is contained in:
Lucio Maranta
2018-01-09 15:16:49 +00:00
parent 60347a55be
commit 4d7ebdcc12
6 changed files with 1996 additions and 1488 deletions
+5 -6
View File
@@ -19,6 +19,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using static CMS_CORE.Nc;
namespace CMS_CORE_Application
{
@@ -55,9 +56,7 @@ namespace CMS_CORE_Application
Connect.Enabled = false;
Disconnect.Enabled = true;
t.Start();
}
}
}
private void test()
@@ -87,9 +86,9 @@ namespace CMS_CORE_Application
N = new Nc_Osai(NCIp, NCPort,500);
if (NCType == "Fanuc")
N = new Nc_Fanuc(NCIp, NCPort, 500);
N.NC_Connect();
N.NC_RModelName(ref ModelName);
CmsError cmsError = N.NC_Connect();
cmsError = N.NC_RModelName(ref ModelName);
N.NC_RProcessesNum(ref procnum);
N.NC_RMachineNumber(ref MachNumber);
+289 -169
View File
@@ -29,7 +29,7 @@ namespace CMS_CORE.Demo
Port = RemotePort;
}
public override void NC_Connect()
public override CmsError NC_Connect()
{
// Create new connection to the demo server
String url = "http://" + Ip + ":" + Port + "/api";
@@ -39,25 +39,31 @@ namespace CMS_CORE.Demo
cf.Endpoint.EndpointBehaviors.Add(new WebHttpBehavior());
serverService = cf.CreateChannel();
Connected = true;
return NO_ERROR;
}
public override void NC_Disconnect()
public override CmsError NC_Disconnect()
{
cf.Close();
Connected = false;
return NO_ERROR;
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region High level methods
public override void NC_RDateTime(ref DateTime ActualTime)
public override CmsError NC_RDateTime(ref DateTime ActualTime)
{
//Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -69,14 +75,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void NC_RSerialNumber(ref String SN)
public override CmsError NC_RSerialNumber(ref String SN)
{
//Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -85,15 +95,19 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
//Get the NC model Name
public override void NC_RModelName(ref string ModelName)
public override CmsError NC_RModelName(ref string ModelName)
{
//Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -101,14 +115,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void NC_RSoftwareVersion(ref String SWV)
public override CmsError NC_RSoftwareVersion(ref String SWV)
{
//Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -117,14 +135,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void NC_RMachineNumber(ref string MachNumber)
public override CmsError NC_RMachineNumber(ref string MachNumber)
{
//Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -135,12 +157,16 @@ namespace CMS_CORE.Demo
{
ThrowNCException(ex);
}
return NO_ERROR;
}
public override void NC_RProcessesNum(ref ushort ProcNumber)
public override CmsError NC_RProcessesNum(ref ushort ProcNumber)
{
//Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{ // Get Process Cout from Demo server
@@ -150,12 +176,16 @@ namespace CMS_CORE.Demo
{
ThrowNCException(ex);
}
return NO_ERROR;
}
public override void NC_RLanguage(ref CultureInfo Language)
public override CmsError NC_RLanguage(ref CultureInfo Language)
{
//Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -167,23 +197,29 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void NC_RActiveAlarms(ref List<string> Alarms)
public override CmsError NC_RActiveAlarms(ref List<string> Alarms)
{
Alarms.Clear();
return NO_ERROR;
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PLC High-level data
public override void PLC_RActiveMessages(ref List<String> Alarms)
public override CmsError PLC_RActiveMessages(ref List<String> Alarms)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -199,8 +235,10 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
#endregion
@@ -208,10 +246,12 @@ namespace CMS_CORE.Demo
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PROCESS (PATH) High-level data
public override void PROC_RStatus(ushort ProcNumber, ref PROC_Status Status)
public override CmsError PROC_RStatus(ushort ProcNumber, ref PROC_Status Status)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -222,14 +262,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void PROC_RMode(ushort ProcNumber, ref PROC_Mode Mode)
public override CmsError PROC_RMode(ushort ProcNumber, ref PROC_Mode Mode)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -240,14 +284,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void PROC_RActiveAlarms(ushort ProcNumber, ref List<string> Alarms)
public override CmsError PROC_RActiveAlarms(ushort ProcNumber, ref List<string> Alarms)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -260,13 +308,15 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void PROC_RPPLines(ushort ProcNumber, ref List<string> Lines)
public override CmsError PROC_RPPLines(ushort ProcNumber, ref List<string> Lines)
{
ThrowNCException(new Nc_Exception(getError(FUNC_NOTALL_NC_ERROR)));
return FUNCTION_NOT_ALLOWED_ERROR;
}
#endregion
@@ -274,32 +324,38 @@ namespace CMS_CORE.Demo
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PROCESS-AXES (PATH) High-level data
public override void AXES_RInterpPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
public override CmsError AXES_RInterpPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
{
// Get axes position from Demo Server
serverService.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
// Parse server response
foreach(NcAxisModel demoAxis in demoAxes)
foreach (NcAxisModel demoAxis in demoAxes)
{
Axes.Add(demoAxis.name, demoAxis.actual);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void AXES_RProgrPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
public override CmsError AXES_RProgrPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -313,15 +369,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void AXES_RMachinePosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
public override CmsError AXES_RMachinePosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
// Get Axes Position from server
@@ -335,14 +394,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void AXES_RFollowingError(ushort ProcNumber, ref Dictionary<string, double> Axes)
public override CmsError AXES_RFollowingError(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -356,14 +419,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void AXES_RDistanceToGo(ushort ProcNumber, ref Dictionary<string, double> Axes)
public override CmsError AXES_RDistanceToGo(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -376,8 +443,10 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
#endregion
@@ -385,12 +454,16 @@ namespace CMS_CORE.Demo
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC Low-level function: single valiable in memory
public override void MEM_RWBoolean(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemBit, ref bool Value)
public override CmsError MEM_RWBoolean(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemBit, ref bool Value)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
CheckBitRange(MemBit);
cmsError = CheckBitRange(MemBit);
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -407,14 +480,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void MEM_RWByte(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByte, ref byte Value)
public override CmsError MEM_RWByte(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByte, ref byte Value)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -433,14 +510,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void MEM_RWWord(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref ushort Value)
public override CmsError MEM_RWWord(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref ushort Value)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -458,14 +539,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void MEM_RWShort(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref short Value)
public override CmsError MEM_RWShort(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref short Value)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -483,14 +568,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void MEM_RWDWord(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref uint Value)
public override CmsError MEM_RWDWord(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref uint Value)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -508,14 +597,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void MEM_RWInteger(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref int Value)
public override CmsError MEM_RWInteger(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref int Value)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -533,8 +626,10 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
@@ -542,58 +637,58 @@ namespace CMS_CORE.Demo
//--------------------------------------------------------------------------------------------------------------------------
// Siemens Version of Memory-Access Methods
public override void MEM_RWBoolean(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemBit, ref bool Value)
public override CmsError MEM_RWBoolean(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemBit, ref bool Value)
{
MEM_RWBoolean(bWrite, Process, MemType, MemIndex, MemBit, ref Value);
return MEM_RWBoolean(bWrite, Process, MemType, MemIndex, MemBit, ref Value);
}
public override void MEM_RWByte(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByte, ref byte Value)
public override CmsError MEM_RWByte(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByte, ref byte Value)
{
MEM_RWByte(bWrite, Process, MemType, MemIndex, MemByte, ref Value);
return MEM_RWByte(bWrite, Process, MemType, MemIndex, MemByte, ref Value);
}
public override void MEM_RWWord(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref ushort Value)
public override CmsError MEM_RWWord(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref ushort Value)
{
MEM_RWWord(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
return MEM_RWWord(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
}
public override void MEM_RWShort(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref short Value)
public override CmsError MEM_RWShort(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref short Value)
{
MEM_RWShort(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
return MEM_RWShort(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
}
public override void MEM_RWDWord(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref uint Value)
public override CmsError MEM_RWDWord(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref uint Value)
{
MEM_RWDWord(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
return MEM_RWDWord(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
}
public override void MEM_RWInteger(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref int Value)
public override CmsError MEM_RWInteger(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref int Value)
{
MEM_RWInteger(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
return MEM_RWInteger(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
}
public override void MEM_RWByteList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
{
MEM_RWByteList(bWrite, Process, MemType, MemIndex, MemByteStart, Number, ref Value);
return MEM_RWByteList(bWrite, Process, MemType, MemIndex, MemByteStart, Number, ref Value);
}
public override void MEM_RWWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<ushort> Value)
public override CmsError MEM_RWWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<ushort> Value)
{
MEM_RWWordList(bWrite, Process, MemType, MemIndex, Number, ref Value);
return MEM_RWWordList(bWrite, Process, MemType, MemIndex, Number, ref Value);
}
public override void MEM_RWShortList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<short> Value)
public override CmsError MEM_RWShortList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<short> Value)
{
MEM_RWShortList(bWrite, Process, MemType, MemIndex, Number, ref Value);
return MEM_RWShortList(bWrite, Process, MemType, MemIndex, Number, ref Value);
}
public override void MEM_RWDWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<uint> Value)
public override CmsError MEM_RWDWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<uint> Value)
{
MEM_RWDWordList(bWrite, Process, MemType, MemIndex, Number, ref Value);
return MEM_RWDWordList(bWrite, Process, MemType, MemIndex, Number, ref Value);
}
public override void MEM_RWIntegerList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<int> Value)
public override CmsError MEM_RWIntegerList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<int> Value)
{
MEM_RWIntegerList(bWrite, Process, MemType, MemIndex, Number, ref Value);
return MEM_RWIntegerList(bWrite, Process, MemType, MemIndex, Number, ref Value);
}
#endregion
@@ -601,10 +696,12 @@ namespace CMS_CORE.Demo
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC Low-level function: variables List in memory
public override void MEM_RWByteList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -622,14 +719,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void MEM_RWWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<ushort> Value)
public override CmsError MEM_RWWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<ushort> Value)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -647,14 +748,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void MEM_RWShortList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<short> Value)
public override CmsError MEM_RWShortList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<short> Value)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -672,14 +777,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void MEM_RWIntegerList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<int> Value)
public override CmsError MEM_RWIntegerList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<int> Value)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -697,14 +806,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void MEM_RWDWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<uint> Value)
public override CmsError MEM_RWDWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<uint> Value)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -722,8 +835,10 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
#endregion
@@ -731,55 +846,61 @@ namespace CMS_CORE.Demo
#region NC Low-level function: Parameters
public override void NC_RParam(short Index, short Bit, ref bool Value)
public override CmsError NC_RParam(short Index, short Bit, ref bool Value)
{
throw new Nc_Exception(getError(FUNC_NOTALL_NC_ERROR));
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override void NC_RParam(short Index, ref byte Value)
public override CmsError NC_RParam(short Index, ref byte Value)
{
throw new Nc_Exception(getError(FUNC_NOTALL_NC_ERROR));
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override void NC_RParam(short Index, ref short Value)
public override CmsError NC_RParam(short Index, ref short Value)
{
throw new Nc_Exception(getError(FUNC_NOTALL_NC_ERROR));
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override void NC_RParam(short Index, ref int Value)
public override CmsError NC_RParam(short Index, ref int Value)
{
throw new Nc_Exception(getError(FUNC_NOTALL_NC_ERROR));
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override void NC_RParam(short Index, ref double Value)
public override CmsError NC_RParam(short Index, ref double Value)
{
throw new Nc_Exception(getError(FUNC_NOTALL_NC_ERROR));
return FUNCTION_NOT_ALLOWED_ERROR;
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region File Management
public override void FILES_RProgramToFile(string partProgramPath, FileStream localFile)
public override CmsError FILES_RProgramToFile(string partProgramPath, FileStream localFile)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
serverService.GetFile(partProgramPath, out string fileContent);
Nc_Utils.WriteLocalFile(fileContent, ref localFile);
}
catch(Exception ex)
{
ThrowNCException(ex);
}
catch (Exception ex)
{
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void FILES_WProgramFromFile(string partProgramPath, FileStream localFile)
public override CmsError FILES_WProgramFromFile(string partProgramPath, FileStream localFile)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -792,14 +913,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void FILES_CopyProgram(string partProgramPath, string newPartProgramPath, bool failIfExist)
public override CmsError FILES_CopyProgram(string partProgramPath, string newPartProgramPath, bool failIfExist)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -813,14 +938,18 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
public override void FILES_DeleteProgram(string partProgramPath, string partProgramName)
public override CmsError FILES_DeleteProgram(string partProgramPath, string partProgramName)
{
// Check if the NC Demo is Connected
CheckConnection();
CmsError cmsError = CheckConnection();
if (cmsError.errorCode != OK)
return cmsError;
try
{
@@ -828,19 +957,23 @@ namespace CMS_CORE.Demo
}
catch (Exception ex)
{
ThrowNCException(ex);
return ThrowNCException(ex);
}
return NO_ERROR;
}
#endregion
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Subordinate Private Functions
//Check if NC is connected
private void CheckConnection()
private CmsError CheckConnection()
{
if (!NC_IsConnected())
throw new Nc_Exception(getError(NOT_CONNECTED_ERROR));
return NOT_CONNECTED_ERROR;
return NO_ERROR;
}
//Manage the Languages
@@ -855,50 +988,37 @@ namespace CMS_CORE.Demo
}
//Manage the Exception Launch
private void ThrowNCException(Exception ex)
private CmsError ThrowNCException(Exception ex)
{
if (!(ex is Nc_Exception))
Connected = false;
//Catch the .Net exceptions
if (ex is EndpointNotFoundException)
throw new Nc_Exception("NC not found: " + ex.Message);
return NOT_CONNECTED_ERROR;
else
throw new Nc_Exception("NC Comunication Error: " + ex.Message);
}
// Convert the internal error in a readable-String error
private String getError(uint CMSError)
{
String ErrororOwner = "";
if (CMSError != 0)
{
ErrororOwner = "CMS-Core-Error: ";
switch (CMSError)
{
case NOT_CONNECTED_ERROR: return ErrororOwner + "Nc not Connected";
case PROC_NOT_FOUND_ERROR: return ErrororOwner + "Process Id not found";
case FUNC_NOTALL_NC_ERROR: return ErrororOwner + "Function not allowed for this type of NC";
case BIT_NOT_IN_RANGE_ERROR: return ErrororOwner + "Bit-number must be between 0 and 7";
case INTERNAL_ERROR: return ErrororOwner + "Internal function error";
case INCORRECT_PARAMETERS_ERROR: return ErrororOwner + "Incorrect Parameters error";
}
}
return ErrororOwner + "Generic Error On Function";
return new CmsError(INTERNAL_ERROR, ex.Message);
}
//Check Bit In Range
private void CheckBitRange(int bitnum)
private CmsError CheckBitRange(int bitnum)
{
if (bitnum < 0 || bitnum > 7)
throw new Nc_Exception(getError(BIT_NOT_IN_RANGE_ERROR));
return BIT_NOT_IN_RANGE_ERROR;
return NO_ERROR;
}
public override void PROC_RPPName(ushort ProcNumber, ref string Name)
public override CmsError PROC_RPPName(ushort ProcNumber, ref string Name)
{
throw new NotImplementedException();
return FUNCTION_NOT_ALLOWED_ERROR;
}
// Create and return CmsError object
private CmsError GetError(uint CMSError, string message)
{
return new CmsError(CMSError, message);
}
#endregion
File diff suppressed because it is too large Load Diff
+91 -63
View File
@@ -171,7 +171,7 @@ namespace CMS_CORE
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* </summary>
* */
public abstract void NC_Connect();
public abstract CmsError NC_Connect();
/**
@@ -183,7 +183,7 @@ namespace CMS_CORE
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* </summary>
* */
public abstract void NC_Disconnect();
public abstract CmsError NC_Disconnect();
/**
@@ -208,7 +208,7 @@ namespace CMS_CORE
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ActualTime">Reference of a DateTime Variable where data will be saved</param>
* */
public abstract void NC_RDateTime(ref DateTime ActualTime);
public abstract CmsError NC_RDateTime(ref DateTime ActualTime);
/**
@@ -221,7 +221,7 @@ namespace CMS_CORE
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="SN">Reference of a String Variable where data will be saved</param>
* */
public abstract void NC_RSerialNumber(ref String SN);
public abstract CmsError NC_RSerialNumber(ref String SN);
/**
* <summary>
@@ -233,7 +233,7 @@ namespace CMS_CORE
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ModelName">Reference of a String Variable where data will be saved</param>
* */
public abstract void NC_RModelName(ref String ModelName);
public abstract CmsError NC_RModelName(ref String ModelName);
/**
* <summary>
@@ -245,7 +245,7 @@ namespace CMS_CORE
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="SWV">Reference of a String Variable where data will be saved</param>
* */
public abstract void NC_RSoftwareVersion(ref String SWV);
public abstract CmsError NC_RSoftwareVersion(ref String SWV);
/**
* <summary>
@@ -257,7 +257,7 @@ namespace CMS_CORE
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="MachNumber">Reference of a String Variable where data will be saved</param>
* */
public abstract void NC_RMachineNumber(ref String MachNumber);
public abstract CmsError NC_RMachineNumber(ref String MachNumber);
/**
* <summary>
@@ -269,7 +269,7 @@ namespace CMS_CORE
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ProcNumber">Reference of a ushort Variable where data will be saved</param>
* */
public abstract void NC_RProcessesNum(ref ushort ProcNumber);
public abstract CmsError NC_RProcessesNum(ref ushort ProcNumber);
/**
* <summary>
@@ -281,7 +281,7 @@ namespace CMS_CORE
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="Language">Reference of a CultureInfo Variable where data will be saved</param>
* */
public abstract void NC_RLanguage(ref CultureInfo Language);
public abstract CmsError NC_RLanguage(ref CultureInfo Language);
/**
@@ -295,7 +295,7 @@ namespace CMS_CORE
* <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 void NC_RActiveAlarms(ref List<String> Alarms);
public abstract CmsError NC_RActiveAlarms(ref List<String> Alarms);
#endregion
@@ -313,7 +313,7 @@ namespace CMS_CORE
* <param name="Bit">Set the Bit to Read. (0..7)</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract void NC_RParam(short Index, short Bit, ref Boolean Value);
public abstract CmsError NC_RParam(short Index, short Bit, ref Boolean Value);
/**
* <summary>Read Byte Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter)
@@ -325,7 +325,7 @@ namespace CMS_CORE
* <param name="Index">Index of the parameter</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract void NC_RParam(short Index, ref byte Value);
public abstract CmsError NC_RParam(short Index, ref byte Value);
/**
* <summary>Read 2 Byte (Short) Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter)
@@ -337,7 +337,7 @@ namespace CMS_CORE
* <param name="Index">Index of the parameter</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract void NC_RParam(short Index, ref short Value);
public abstract CmsError NC_RParam(short Index, ref short Value);
/**
* <summary>Read 4 Byte (Integer) Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter)
@@ -349,7 +349,7 @@ namespace CMS_CORE
* <param name="Index">Index of the parameter</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract void NC_RParam(short Index, ref int Value);
public abstract CmsError NC_RParam(short Index, ref int Value);
/**
* <summary>Read Real Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter)
@@ -361,7 +361,7 @@ namespace CMS_CORE
* <param name="Index">Index of the parameter</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract void NC_RParam(short Index, ref double Value);
public abstract CmsError NC_RParam(short Index, ref double Value);
#endregion
@@ -378,7 +378,7 @@ namespace CMS_CORE
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="Alarms">Reference of a List of String Variables where data will be saved</param>
* */
public abstract void PLC_RActiveMessages(ref List<String> Alarms);
public abstract CmsError PLC_RActiveMessages(ref List<String> Alarms);
#endregion
@@ -397,7 +397,7 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Status">Reference of a PROC_Status Variable where data will be saved</param>
* */
public abstract void PROC_RStatus(ushort ProcNumber, ref PROC_Status Status);
public abstract CmsError PROC_RStatus(ushort ProcNumber, ref PROC_Status Status);
/**
* <summary>
@@ -411,7 +411,7 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Mode">Reference of a PROC_Mode Variable where data will be saved</param>
* */
public abstract void PROC_RMode(ushort ProcNumber, ref PROC_Mode Mode);
public abstract CmsError PROC_RMode(ushort ProcNumber, ref PROC_Mode Mode);
/**
@@ -425,7 +425,7 @@ namespace CMS_CORE
* <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 void PROC_RActiveAlarms(ushort ProcNumber, ref List<String> Alarms);
public abstract CmsError PROC_RActiveAlarms(ushort ProcNumber, ref List<String> Alarms);
/**
@@ -439,7 +439,7 @@ namespace CMS_CORE
* <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>
* */
public abstract void PROC_RPPLines(ushort ProcNumber, ref List<String> Lines);
public abstract CmsError PROC_RPPLines(ushort ProcNumber, ref List<String> Lines);
/**
@@ -453,7 +453,7 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Name">Reference of a String Variables where data will be saved</param>
* */
public abstract void PROC_RPPName(ushort ProcNumber, ref String Name);
public abstract CmsError PROC_RPPName(ushort ProcNumber, ref String Name);
#endregion
@@ -472,7 +472,7 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract void AXES_RInterpPosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
public abstract CmsError AXES_RInterpPosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
/**
* <summary>
@@ -486,7 +486,7 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract void AXES_RProgrPosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
public abstract CmsError AXES_RProgrPosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
/**
* <summary>
@@ -499,7 +499,7 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract void AXES_RMachinePosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
public abstract CmsError AXES_RMachinePosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
/**
* <summary>
@@ -512,7 +512,7 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract void AXES_RFollowingError(ushort ProcNumber, ref Dictionary<String, double> Axes);
public abstract CmsError AXES_RFollowingError(ushort ProcNumber, ref Dictionary<String, double> Axes);
/**
* <summary>
@@ -525,7 +525,7 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract void AXES_RDistanceToGo(ushort ProcNumber, ref Dictionary<String, double> Axes);
public abstract CmsError AXES_RDistanceToGo(ushort ProcNumber, ref Dictionary<String, double> Axes);
#endregion
@@ -547,7 +547,7 @@ namespace CMS_CORE
* <param name="MemBit">Set the Bit to Read-Write. (0..7)</param>
* <param name="Value">Reference to variable to read/Write</param>
* */
public abstract void MEM_RWBoolean(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemBit, ref Boolean Value);
public abstract CmsError MEM_RWBoolean(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemBit, ref Boolean Value);
/**
* <summary>Read/Write Boolean variable from/into NC Memory Area (including Siemens Nc)
@@ -564,7 +564,7 @@ namespace CMS_CORE
* <param name="MemBit">Set the Bit to Read-Write. (0..7)</param>
* <param name="Value">Reference to variable to read/Write</param>
* */
public abstract void MEM_RWBoolean(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemBit, ref Boolean Value);
public abstract CmsError MEM_RWBoolean(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemBit, ref Boolean Value);
@@ -582,7 +582,7 @@ namespace CMS_CORE
* <param name="MemByteStart">Set to 1 if the Byte is the second of a WORD (only for OSAI Nc)</param>
* <param name="Value">Reference to variable to read/Write</param>
* */
public abstract void MEM_RWByte(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByte, ref Byte Value);
public abstract CmsError MEM_RWByte(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByte, ref Byte Value);
/**
* <summary>Read/Write Byte variable from/into NC Memory Area (including Siemens Nc)
@@ -599,7 +599,7 @@ namespace CMS_CORE
* <param name="MemByteStart">Set to 1 if the Byte is the second of a WORD (only for OSAI Nc)</param>
* <param name="Value">Reference to variable to read/Write</param>
* */
public abstract void MEM_RWByte(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByte, ref Byte Value);
public abstract CmsError MEM_RWByte(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByte, ref Byte Value);
@@ -617,7 +617,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref ushort Value);
public abstract CmsError MEM_RWWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref ushort Value);
/**
* <summary>Read/Write unsigned 2 Byte (NC: Word:, .NET: ushort) variable from/into NC Memory Area (including Siemens Nc)
@@ -634,7 +634,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref ushort Value);
public abstract CmsError MEM_RWWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref ushort Value);
@@ -652,7 +652,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWShort(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref short Value);
public abstract CmsError MEM_RWShort(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref short Value);
/**
* <summary>Read/Write signed 2 Byte (NC: Word:, .NET: short) variable from/into NC Memory Area (including Siemens Nc)
@@ -669,7 +669,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWShort(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref short Value);
public abstract CmsError MEM_RWShort(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref short Value);
@@ -687,7 +687,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWDWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref uint Value);
public abstract CmsError MEM_RWDWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref uint Value);
/**
* <summary>Read/Write signed 4 Byte (NC: DWord:, .NET: uint) variable from/into NC Memory Area (including Siemens Nc)
@@ -704,7 +704,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWDWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref uint Value);
public abstract CmsError MEM_RWDWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref uint Value);
@@ -722,7 +722,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWInteger(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref int Value);
public abstract CmsError MEM_RWInteger(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref int Value);
/**
* <summary>Read/Write signed 4 Byte (NC: DWord:, .NET: int) variable from/into NC Memory Area (including Siemens Nc)
@@ -739,7 +739,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWInteger(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref int Value);
public abstract CmsError MEM_RWInteger(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref int Value);
#endregion
@@ -761,7 +761,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWByteList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByteStart, int Number, ref List<Byte> Value);
public abstract CmsError MEM_RWByteList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByteStart, int Number, ref List<Byte> Value);
/**
* <summary>Read/Write List of Byte from/into NC Memory Area (including Siemens Nc)
@@ -779,7 +779,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWByteList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<Byte> Value);
public abstract CmsError MEM_RWByteList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<Byte> Value);
@@ -797,7 +797,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<ushort> Value);
public abstract CmsError MEM_RWWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<ushort> Value);
/**
* <summary>Read/Write List of unsigned 2 Byte (NC: Word:, .NET: ushort) from/into NC Memory Area (including Siemens Nc)
@@ -814,7 +814,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<ushort> Value);
public abstract CmsError MEM_RWWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<ushort> Value);
@@ -833,7 +833,7 @@ namespace CMS_CORE
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWShortList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<short> Value);
public abstract CmsError MEM_RWShortList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<short> Value);
/**
* <summary>Read/Write List of signed 2 Byte (NC: Word:, .NET: short) from/into NC Memory Area (including Siemens Nc)
* <para>
@@ -849,7 +849,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWShortList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<short> Value);
public abstract CmsError MEM_RWShortList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<short> Value);
@@ -867,7 +867,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWDWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<uint> Value);
public abstract CmsError MEM_RWDWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<uint> Value);
/**
* <summary>Read/Write List of unsigned 4 Byte (NC: DWord:, .NET: uint) from/into NC Memory Area (including Siemens Nc)
@@ -884,7 +884,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWDWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<uint> Value);
public abstract CmsError MEM_RWDWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<uint> Value);
@@ -902,7 +902,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWIntegerList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<int> Value);
public abstract CmsError MEM_RWIntegerList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<int> Value);
/**
* <summary>Read/Write List of signed 4 Byte (NC: DWord:, .NET: int) from/into NC Memory Area (including Siemens Nc)
@@ -919,7 +919,7 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract void MEM_RWIntegerList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<int> Value);
public abstract CmsError MEM_RWIntegerList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<int> Value);
#endregion
@@ -937,7 +937,7 @@ namespace CMS_CORE
* <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>
* */
public abstract void FILES_RProgramToFile(string partProgramPath, FileStream localFile);
public abstract CmsError FILES_RProgramToFile(string partProgramPath, FileStream localFile);
/**
* <summary>Write/Overwrite a Part Program by path and name
@@ -949,7 +949,7 @@ namespace CMS_CORE
* <param name="partProgramPath">Path of the Part Program stored in the Nc</param>
* <param name="localFile">Reference to the local Part Program file</param>
* */
public abstract void FILES_WProgramFromFile(string partProgramPath, FileStream localFile);
public abstract CmsError FILES_WProgramFromFile(string partProgramPath, FileStream localFile);
/**
* <summary>Copy a Part Program into another path
@@ -962,7 +962,7 @@ namespace CMS_CORE
* <param name="newPartProgramPath">Path of the copy Part Program destination</param>
* <param name="failIfExist"></param>
* */
public abstract void FILES_CopyProgram(string partProgramPath, string newPartProgramPath, bool failIfExist);
public abstract CmsError FILES_CopyProgram(string partProgramPath, string newPartProgramPath, bool failIfExist);
/**
* <summary>Delete a Nc Part Program
@@ -974,7 +974,7 @@ namespace CMS_CORE
* <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>
* */
public abstract void FILES_DeleteProgram(string partProgramPath, string partProgramName);
public abstract CmsError FILES_DeleteProgram(string partProgramPath, string partProgramName);
#endregion
@@ -1190,18 +1190,46 @@ namespace CMS_CORE
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Error Codes
#region Cms Errors Codes
internal const uint OK = 0;
internal const uint NC_PROD_ERROR = 1;
internal const uint NOT_CONNECTED = 2;
internal const uint PROC_NOT_FOUND = 3;
internal const uint FUNCTION_NOT_ALLOWED = 4;
internal const uint BIT_NOT_IN_RANGE = 5;
internal const uint BYTE_NOT_IN_RANGE = 6;
internal const uint INTERNAL_ERROR = 7;
internal const uint INCORRECT_PARAMETERS = 8;
internal const uint NC_LANGUAGE_ERROR = 9;
internal const uint SIEMENS_ENVIRONMENT_NOT_FOUND = 10;
internal const uint SIEMENS_HMI_NOT_RUNNING = 11;
public class CmsError
{
public uint errorCode;
public string message;
public CmsError(uint errorCode, string message)
{
this.errorCode = errorCode;
this.message = message;
}
}
internal static CmsError NO_ERROR = new CmsError(OK, "");
internal static CmsError NOT_CONNECTED_ERROR = new CmsError(FUNCTION_NOT_ALLOWED, "CMS-Core-Error: Nc not Connected");
internal static CmsError PROC_NOT_FOUND_ERROR = new CmsError(FUNCTION_NOT_ALLOWED, "CMS-Core-Error: Function not allowed for this type of NC");
internal static CmsError FUNCTION_NOT_ALLOWED_ERROR = new CmsError(FUNCTION_NOT_ALLOWED, "CMS-Core-Error: Function not allowed for this type of NC");
internal static CmsError BIT_NOT_IN_RANGE_ERROR = new CmsError(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(BIT_NOT_IN_RANGE, "CMS-Core-Error: Byte - number must be between 0 and 1");
internal static CmsError INCORRECT_PARAMETERS_ERROR = new CmsError(BIT_NOT_IN_RANGE, "CMS-Core-Error: Incorrect Parameters error");
internal static CmsError LANGUAGE_ERROR = new CmsError(BIT_NOT_IN_RANGE, "CMS-Core-Error: Incorrect Language");
internal static CmsError SIEMENS_ENVIRONMENT_NOT_FOUND_ERROR = new CmsError(BIT_NOT_IN_RANGE, "CMS-Core-Error: Siemens Environment not found");
internal static CmsError SIEMENS_HMI_NOT_RUNNING_ERROR = new CmsError(BIT_NOT_IN_RANGE, "CMS-Core-Error: Siemens HMI is not Running / Ready");
internal const uint NC_PROD_ERROR = 0;
internal const uint NOT_CONNECTED_ERROR = 1;
internal const uint PROC_NOT_FOUND_ERROR = 2;
internal const uint FUNC_NOTALL_NC_ERROR = 3;
internal const uint BIT_NOT_IN_RANGE_ERROR = 4;
internal const uint BYTE_NOT_IN_RANGE_ERROR = 5;
internal const uint INTERNAL_ERROR = 6;
internal const uint INCORRECT_PARAMETERS_ERROR = 7;
internal const uint SIEMENS_ENVIRONMENT_NOT_FOUND = 8;
internal const uint SIEMENS_HMI_NOT_RUNNING = 9;
#endregion
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff