private void SendCompleteRecipe(byte tubeIndex, byte stepIndex, OnDownloadRecipeComplete rCallback, OnDownloadStepComplete sCallback) { mSocketObj.socket = SocketClient.Instance.GetTcpSocket2(tubeIndex); mSocketObj.dldStepCallback = sCallback; mSocketObj.dldRecipeCallback = rCallback; mSocketObj.tubeIndex = tubeIndex; if (stepIndex == 0) { mSocketObj.sendRecipe = true; mSocketObj.stepIndex = (byte)1; } else if (stepIndex > 0 && stepIndex < 65) { mSocketObj.sendRecipe = false; mSocketObj.stepIndex = stepIndex; } if (!mSocketObj.socket.Connected) { mSocketObj.connectCallback = new OnConnectComplete(SendCompleteRecipeAferConnect); mSocketObj.tubeIndex = tubeIndex; if (tubeIndex < 4) { connect(1); } else if (tubeIndex > 3) { connect(2); } } else { SendRecipeStep(); } }
public bool CommitStep(byte tubeIndex, int stepIndex, OnDownloadRecipeComplete rCallback, OnDownloadStepComplete sCallback) { mTubeIndex = tubeIndex; if (!ComNodeService.Instance.IsConnected()) { return(false); } SendRecipeData(tubeIndex, (byte)stepIndex, rCallback, sCallback); return(true); }
private void SendRecipeData(byte tubeIndex, byte stepIndex, OnDownloadRecipeComplete rCallback, OnDownloadStepComplete sCallback) { Thread processRunThread = new Thread(() => { //lock (mLock) { mRecipeTmpStore = new Demo.utilities.Properties(string.Format("recipe_tmp{0}.data", mTubeIndex)); SendCompleteRecipe(tubeIndex, stepIndex, rCallback, sCallback); } }); processRunThread.IsBackground = true; processRunThread.Start(); }
public bool DownloadRecipe(string fileName, byte tubeIndex, OnDownloadRecipeComplete rCallback, OnDownloadStepComplete sCallback) { //write recipe to device mTubeIndex = tubeIndex; if (!ComNodeService.Instance.IsConnected()) { return(false); } mRecipeBak = new Demo.utilities.Properties(fileName); SendRecipeData(tubeIndex, 0, rCallback, sCallback); return(true); }