예제 #1
0
 public string ExecuteCommands(string ATcommand, int timeout, string Error = "")
 {
     receiveNow.Reset();
     try
     {
         string result = "";
         SpGSM_Modem.Write(ATcommand + "\r");
         do
         {
             if (receiveNow.WaitOne(timeout, false))
             {
                 string t = SpGSM_Modem.ReadExisting();
                 result += t;
             }
             else
             {
                 string t = SpGSM_Modem.ReadExisting();
                 result += t;
                 return(result);
             }
         }while (!result.EndsWith("\r\nOK\r\n") && !result.EndsWith("\r\n> ") && !result.EndsWith("\r\nERROR\r\n"));
         return(result);
     }
     catch (Exception ex)
     {
         LoggingData.WriteLog(ex);
         return(ex.Message);
     }
 }
예제 #2
0
 void waveSource_DataAvailable(object sender, WaveInEventArgs e)
 {
     if (SpGSM_Modem_Speech.IsOpen)
     {
         SpGSM_Modem_Speech.Write(e.Buffer, 0, e.BytesRecorded);
     }
 }