public void OpenLaserJob(string laserJobPath) { try { if (!File.Exists(laserJobPath)) { throw new FileNotFoundException(String.Format("Not found laser job file {0}", laserJobPath)); } } catch (Exception ex) { throw new MCoreExceptionPopup("SL Laser Desk [{0}] return from open job command {1}", this.Nickname, ex.ToString()); } int commandNumber = 7; CurrentJobPath = laserJobPath; List <Byte> param = SLTcp.CovertStringParamToByteList(CurrentJobPath); //Overwrite File Int Param ( 0 = no over write) param.Add(0x00); param.Add(0x00); param.Add(0x00); param.Add(0x00); List <Byte> returnQuery = (List <Byte>)QueryCommand(commandNumber, param); List <Byte> returnParams = GetParamsFromReturnQuery(commandNumber, returnQuery); Int32 paramsInt = BitConverter.ToInt32(returnParams.ToArray(), 0); if (paramsInt == 0) { throw new MCoreExceptionPopup(string.Format("SL Laser Desk [{0}] cannot open laser job [{1}]", this.Nickname, CurrentJobPath)); } }
public void Login() { int commandNumber = 1; List <Byte> param = SLTcp.CovertStringParamToByteList("1990"); List <Byte> returnQuery = (List <Byte>)QueryCommand(commandNumber, param); List <Byte> returnParams = GetParamsFromReturnQuery(commandNumber, returnQuery); Int32 paramsInt = BitConverter.ToInt32(returnParams.ToArray(), 0); if (paramsInt == 0) { //throw new MCoreExceptionPopup(string.Format("SL Laser Desk [{0}] login failed", this.Nickname)); } }
public void SelectUID(string UID) { int commandNumber = 11; List <Byte> param = new List <byte>(); //Param1 = 3 is Select by UID param.Add(0x03); param.Add(0x00); param.Add(0x00); param.Add(0x00); if (UID != null && UID != "") { param.AddRange(SLTcp.CovertStringParamToByteList(UID)); } else { throw new MCoreExceptionPopup(string.Format("SL Laser Desk [{0}] no select UID specify on laser job [{1}]", this.Nickname, CurrentJobPath)); } int retry = 3; Int32 paramsInt = 0; do { List <Byte> returnQuery = (List <Byte>)QueryCommand(commandNumber, param); List <Byte> returnParams = GetParamsFromReturnQuery(commandNumber, returnQuery); paramsInt = BitConverter.ToInt32(returnParams.ToArray(), 0); if (paramsInt == 0) { //Throw Exception when max retry if (retry <= 0) { throw new MCoreExceptionPopup(string.Format("SL Laser Desk [{0}] cannot select UID [{1}] on laser job [{2}]", this.Nickname, UID, CurrentJobPath)); } System.Threading.Thread.Sleep(100); } } while (paramsInt == 0 && retry > 0); }