/// <summary> /// Checks if a response for a given command is already received /// </summary> /// <param name="waitedCommandResponse">CommandType whose response is expected</param> /// <returns></returns> public bool IsResponseReceived(JustinaCommands expectedCmdResp) { if (this.justinaCmdAndResp[(int)expectedCmdResp].IsResponseReceived) { return(true); } else { return(false); } }
public bool IsResponseReceived(JustinaCommands expectedCmdResp, out Response receivedResp) { receivedResp = null; if (this.IsResponseReceived(expectedCmdResp)) { receivedResp = this.justinaCmdAndResp[(int)expectedCmdResp].Response; return(true); } else { return(false); } }
private void SetupAndSendCommand(JustinaCommands justinaCmd, string parameters) { this.justinaCmdAndResp[(int)justinaCmd].IsResponseReceived = false; this.justinaCmdAndResp[(int)justinaCmd].Command.Parameters = parameters; if (!this.SendCommand(this.justinaCmdAndResp[(int)justinaCmd].Command)) { TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000cmdman: Can't send command"); } else { TextBoxStreamWriter.DefaultLog.WriteLine(2, "HAL9000CmdMan: Send command: " + this.justinaCmdAndResp[(int)justinaCmd].Command.StringToSend); } }
public bool WaitForResponse(JustinaCommands expectedCmdResp, int timeOut_ms) { int sleepsNumber = (int)(((double)timeOut_ms) / ((double)this.status.BrainWaveType)); while (!this.IsResponseReceived(expectedCmdResp) && this.status.IsRunning && this.status.IsExecutingPredefinedTask && sleepsNumber-- > 0) { Thread.Sleep((int)this.status.BrainWaveType); } if (sleepsNumber == 0) { TextBoxStreamWriter.DefaultLog.WriteLine(2, "HAL9000CmdMan: " + expectedCmdResp.ToString() + ": Time out"); } if (this.IsResponseReceived(expectedCmdResp)) { return(this.justinaCmdAndResp[(int)expectedCmdResp].Response.Success); } else { return(false); } }
private void SetupAndSendCommand(JustinaCommands justinaCmd, string parameters) { this.justinaCmdAndResp[(int)justinaCmd].IsResponseReceived = false; this.justinaCmdAndResp[(int)justinaCmd].Command.Parameters = parameters; if (!this.SendCommand(this.justinaCmdAndResp[(int)justinaCmd].Command)) TextBoxStreamWriter.DefaultLog.WriteLine("HAL9000cmdman: Can't send command"); else TextBoxStreamWriter.DefaultLog.WriteLine(2, "HAL9000CmdMan: Send command: " + this.justinaCmdAndResp[(int)justinaCmd].Command.StringToSend); }
public bool WaitForResponse(JustinaCommands expectedCmdResp, int timeOut_ms) { int sleepsNumber = (int)(((double)timeOut_ms) / ((double)this.status.BrainWaveType)); while (!this.IsResponseReceived(expectedCmdResp) && this.status.IsRunning && this.status.IsExecutingPredefinedTask && sleepsNumber-- > 0) Thread.Sleep((int)this.status.BrainWaveType); if (sleepsNumber == 0) TextBoxStreamWriter.DefaultLog.WriteLine(2, "HAL9000CmdMan: " + expectedCmdResp.ToString() + ": Time out"); if (this.IsResponseReceived(expectedCmdResp)) return this.justinaCmdAndResp[(int)expectedCmdResp].Response.Success; else return false; }
public bool IsResponseSuccesfully(JustinaCommands cmdToCheck) { return this.justinaCmdAndResp[(int)cmdToCheck].Response.Success; }
public bool IsResponseReceived(JustinaCommands expectedCmdResp, out Response receivedResp) { receivedResp = null; if (this.IsResponseReceived(expectedCmdResp)) { receivedResp = this.justinaCmdAndResp[(int)expectedCmdResp].Response; return true; } else return false; }
/// <summary> /// Checks if a response for a given command is already received /// </summary> /// <param name="waitedCommandResponse">CommandType whose response is expected</param> /// <returns></returns> public bool IsResponseReceived(JustinaCommands expectedCmdResp) { if (this.justinaCmdAndResp[(int)expectedCmdResp].IsResponseReceived) return true; else return false; }
public bool IsResponseSuccesfully(JustinaCommands cmdToCheck) { return(this.justinaCmdAndResp[(int)cmdToCheck].Response.Success); }
public bool WaitForResponse(JustinaCommands expectedCmdResp, int timeOut_ms) { int sleepsNumber = (int)(((double)timeOut_ms) / ((double)this.status.BrainWaveType)); while (!this.IsResponseReceived(expectedCmdResp) && this.status.IsRunning && this.status.IsExecutingPredefinedTask && sleepsNumber-- > 0) Thread.Sleep((int)this.status.BrainWaveType); if (this.IsResponseReceived(expectedCmdResp)) return this.justinaCmdAndResp[(int)expectedCmdResp].Response.Success; else return false; }