I need to create a windows application that read incoming phone call number from COMX and the following is the code I have:
public partial class frmMain : Form
{
public frmMain ()
{
InitializeComponent();
if (!serialPort1.IsOpen)
{
try
{
serialPort1.Open();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
delegate void OutputUpdateDelegate(string data);
private void OutputUpdateCallback(string data)
{
txtReceive.Text += data;
}
private void DataRec(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
try
{
string data = serialPort1.ReadExisting();
txtReceive.Invoke(new OutputUpdateDelegate(OutputUpdateCallback),data);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
Since I don't have a modem to test, I need to know how to create a fake call for test and how to read only the Phone number instead of reading the whole string coming from "ReadExisting()" method, is there a way other than splitting the string? if no what does the incoming string look like?
Please Advise.