using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using NAudio.Wave; using System.IO.Ports; using System.Threading; namespace mearge { public partial class Form3 : Form { public Form3() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { System.IO.Ports.SerialPort comPort; comPort = new System.IO.Ports.SerialPort("Com1",9600, System.IO.Ports.Parity.None, 8, StopBits.One); comPort.DtrEnable = true; //Switch to Voice Mode comPort.Write("AT+FCLASS=8" + System.Convert.ToChar(13).ToString()); //Call Number comPort.Write("ATDT997448***" + System.Convert.ToChar(13).ToString()); //Enter Voice-Transmission Mode comPort.Write("AT+VTX" + System.Convert.ToChar(13).ToString()); bool MSwitch = false; byte[] buffer = new byte[20000]; FileStream strm = new FileStream(@"D:\943461101.wav", System.IO.FileMode.Open); MemoryStream ms = new MemoryStream(); int count = ms.Read(buffer, 44, buffer.Length - 44); BinaryReader rdr = new BinaryReader(strm); while (!MSwitch) { byte[] bt = new byte[1024]; bt = rdr.ReadBytes(1024); if (bt.Length == 0) { MSwitch = true; break; } comPort.Write(bt, 0, bt.Length); } strm.Close(); strm.Dispose(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)