Fix Fanuc Serial number Read
This commit is contained in:
@@ -1717,9 +1717,10 @@ namespace CMS_CORE.Fanuc
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
short nReturn;
|
||||
short nReturn1, nReturn2;
|
||||
Focas1.ODBSYS node = new Focas1.ODBSYS();
|
||||
Focas1.ODBSYSEX nodeex = new Focas1.ODBSYSEX();
|
||||
ulong SerialNumber;
|
||||
|
||||
//Read oly one time every 10 seconds
|
||||
if (DateTime.Now - Last_Static_Read > new TimeSpan(NC_MIN_SEC_READ_STATIC_DATA * TimeSpan.TicksPerSecond))
|
||||
@@ -1731,14 +1732,14 @@ namespace CMS_CORE.Fanuc
|
||||
return cmsError;
|
||||
|
||||
//Execute the method
|
||||
nReturn = Focas1.cnc_sysinfo(nLibHandle[0], node);
|
||||
|
||||
|
||||
nReturn = Focas1.cnc_sysinfo_ex(nLibHandle[0], nodeex);
|
||||
nReturn1 = Focas1.cnc_sysinfo(nLibHandle[0], node);
|
||||
nReturn2 = Focas1.cnc_rdcncid(nLibHandle[0], out SerialNumber);
|
||||
|
||||
//Throw Exception if there's an error
|
||||
if (nReturn != 0)
|
||||
return GetNcError(nReturn);
|
||||
if (nReturn1 != 0)
|
||||
return GetNcError(nReturn1);
|
||||
else if(nReturn2 != 0)
|
||||
return GetNcError(nReturn2);
|
||||
else
|
||||
{
|
||||
//Setup the name
|
||||
@@ -1748,7 +1749,7 @@ namespace CMS_CORE.Fanuc
|
||||
Cnc_SftVersion = new string(node.version);
|
||||
|
||||
//Setup the Number Series
|
||||
Cnc_SeriesNum = new string(node.series);
|
||||
Cnc_SeriesNum = SerialNumber.ToString();
|
||||
|
||||
Last_Static_Read = DateTime.Now;
|
||||
}
|
||||
|
||||
@@ -9625,8 +9625,12 @@ public class Focas1
|
||||
/*-------------*/
|
||||
/* CNC: Others */
|
||||
/*-------------*/
|
||||
|
||||
|
||||
/* read CNC system information */
|
||||
[DllImport(FOCAS_LIB_NAME, EntryPoint = "cnc_rdcncid")]
|
||||
public static extern short cnc_rdcncid(ushort FlibHndl, out ulong a);
|
||||
|
||||
/* read CNC system information */
|
||||
[DllImport(FOCAS_LIB_NAME, EntryPoint = "cnc_sysinfo")]
|
||||
public static extern short cnc_sysinfo(ushort FlibHndl, [Out, MarshalAs(UnmanagedType.LPStruct)] ODBSYS a);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user