private void CheckConnection2() { try { _serialport.DiscardInBuffer(); _serialport.DiscardOutBuffer(); receiveNow.Reset(); _serialport.Write(ATCommands.CHECK_CONNECTION); string response = ReadResponse(1000); if (response.EndsWith(ATFinalResultCode.ERROR) || response.Length == 0) { ResultRetievedEventArgs ev = new ResultRetievedEventArgs(false, response); OnResultRetieved(ev); ShowMessageInStatusbarEventArgs ev2 = new ShowMessageInStatusbarEventArgs("AT Commands test:Failed", 5 * 1000); OnShowMessageInStatusbar(ev2); } else if (response.EndsWith(ATFinalResultCode.OK)) { ResultRetievedEventArgs ev = new ResultRetievedEventArgs(true, response); OnResultRetieved(ev); ShowMessageInStatusbarEventArgs ev2 = new ShowMessageInStatusbarEventArgs("AT Commands test:Successful", 5 * 1000); OnShowMessageInStatusbar(ev2); } } catch (Exception ex) { ShowMessageInStatusbarEventArgs ev = new ShowMessageInStatusbarEventArgs(ex.Message, 5 * 1000); OnShowMessageInStatusbar(ev); } }
protected virtual void OnTerminalResponseRetrieved(ResultRetievedEventArgs e) { if (TerminalResponseRetrieved != null) { TerminalResponseRetrieved(this, e); } }
protected virtual void OnTestCompleted(ResultRetievedEventArgs e) { if (TestCompleted != null) { TestCompleted(this, e); } }
/// <summary> /// Raises the <see cref="E:ResultRetieved"/> event. /// </summary> /// <param name="e">The <see cref="LogicLayer.ResultRetievedEventArgs"/> instance containing the event data.</param> protected virtual void OnResultRetieved(ResultRetievedEventArgs e) { if (ResultRetieved != null) { ResultRetieved(this, e); } }
protected virtual void OnSignalQualityRetrieved(ResultRetievedEventArgs e) { if (SignalQualityRetrieved != null) { SignalQualityRetrieved(this, e); } }
/// <summary> /// Raises the <see cref="E:ManufacturerRetieved"/> event. /// </summary> /// <param name="e">The <see cref="LogicLayer.ResultRetievedEventArgs"/> instance containing the event data.</param> protected virtual void OnManufacturerRetieved(ResultRetievedEventArgs e) { if (ManufacturerRetieved != null) { ManufacturerRetieved(this, e); } }
protected virtual void OnModelRetrieved(ResultRetievedEventArgs e) { if (ModelRetrieved != null) { ModelRetrieved(this, e); } }
protected virtual void OnFirmwareRetrieved(ResultRetievedEventArgs e) { if (FirmwareRetrieved != null) { FirmwareRetrieved(this, e); } }
protected virtual void OnIMEIRetrieved(ResultRetievedEventArgs e) { if (IMEIRetrieved != null) { IMEIRetrieved(this, e); } }
protected virtual void OnBatteryChargeRetrieved(ResultRetievedEventArgs e) { if (BatteryChargeRetrieved != null) { BatteryChargeRetrieved(this, e); } }
public void SendToTerminal2(object state) { try { string command = (string)state; _serialport.DiscardInBuffer(); _serialport.DiscardOutBuffer(); receiveNow.Reset(); _serialport.Write(command + "\r\n"); string response = ReadResponse(1000); ResultRetievedEventArgs ev = new ResultRetievedEventArgs(true, response); OnTerminalResponseRetrieved(ev); } catch (Exception ex) { ShowMessageInStatusbarEventArgs ev = new ShowMessageInStatusbarEventArgs(ex.Message, 5 * 1000); OnShowMessageInStatusbar(ev); } }
private void TestDevice2() { try { Test_AT_Commands atCommands = new Test_AT_Commands(); Test_Commands[] commands = atCommands.GetAllCommands(); foreach (Test_Commands command in commands) { _serialport.DiscardInBuffer(); _serialport.DiscardOutBuffer(); receiveNow.Reset(); _serialport.Write(command.Command); string response = ReadResponse(1000); if (response.EndsWith(ATFinalResultCode.OK)) { ResultRetievedEventArgs ev = new ResultRetievedEventArgs(true, command.Description); OnTestCompleted(ev); } else { ResultRetievedEventArgs ev = new ResultRetievedEventArgs(false, command.Description); OnTestCompleted(ev); } // Release Memory atCommands = null; // } } catch (Exception ex) { ShowMessageInStatusbarEventArgs ev = new ShowMessageInStatusbarEventArgs(ex.Message, 5 * 1000); OnShowMessageInStatusbar(ev); } }
private void Request_Signal_Quality2() { try { _serialport.DiscardOutBuffer(); _serialport.DiscardInBuffer(); receiveNow.Reset(); _serialport.Write(ATCommands.SIGNAL_QUALITY); string response = ReadResponse(1000); string result; if (response.EndsWith(ATFinalResultCode.OK)) { result = ReadResult(response, ATCommands.SIGNAL_QUALITY, ATFinalResultCode.OK); ResultRetievedEventArgs ev = new ResultRetievedEventArgs(true, result); OnSignalQualityRetrieved(ev); } else if (response.EndsWith(ATFinalResultCode.ERROR)) { result = ReadResult(response, ATCommands.SIGNAL_QUALITY, ATFinalResultCode.ERROR); ResultRetievedEventArgs ev = new ResultRetievedEventArgs(false, result); OnSignalQualityRetrieved(ev); } else if (response.Length == 0) { result = ""; ResultRetievedEventArgs ev = new ResultRetievedEventArgs(false, result); OnSignalQualityRetrieved(ev); } } catch (System.Exception ex) { ShowMessageInStatusbarEventArgs ev = new ShowMessageInStatusbarEventArgs(ex.Message, 5 * 1000); OnShowMessageInStatusbar(ev); } }
private void Request_Model_Identification2() { try { _serialport.DiscardOutBuffer(); _serialport.DiscardInBuffer(); receiveNow.Reset(); _serialport.Write(ATCommands.MODEL_IDENTIFICATION); string response = ReadResponse(1000); string result; if (response.EndsWith(ATFinalResultCode.OK)) { result = ReadResult(response, ATCommands.MODEL_IDENTIFICATION, ATFinalResultCode.OK); ResultRetievedEventArgs ev = new ResultRetievedEventArgs(true, result); OnModelRetrieved(ev); } else if (response.EndsWith(ATFinalResultCode.ERROR)) { result = ReadResult(response, ATCommands.MODEL_IDENTIFICATION, ATFinalResultCode.ERROR); ResultRetievedEventArgs ev = new ResultRetievedEventArgs(false, result); OnModelRetrieved(ev); } else if (response.Length == 0) { result = ""; ResultRetievedEventArgs ev = new ResultRetievedEventArgs(false, result); OnModelRetrieved(ev); } } catch (System.Exception ex) { ShowMessageInStatusbarEventArgs ev = new ShowMessageInStatusbarEventArgs(ex.Message, 5 * 1000); OnShowMessageInStatusbar(ev); } }