我有一个类型lightWave的USB调制解调器。我在c#中发现了这个代码,它可以接收,发送,删除和读取来自此调制解调器的短消息,但是当新消息到达调制解调器时,收到新消息时应该引发的事件不会引发。我不知道问题是什么;不过,我可以读取SIM卡收到后,此消息,但我想提出接收消息的事件,当信息到达这部分代码:C语言编程GSM调制解调器#
private void Form1_Load(object sender, EventArgs e)
{
int port = GsmCommMain.DefaultPortNumber;
int baudRate = 9600; // We Set 9600 as our Default Baud Rate
int timeout = GsmCommMain.DefaultTimeout;
dlg = new frmConnection();
dlg.StartPosition = FormStartPosition.CenterScreen;
dlg.SetData(port, baudRate, timeout);
if (dlg.ShowDialog(this) == DialogResult.OK)
{
dlg.GetData(out port, out baudRate, out timeout);
CommSetting.Comm_Port = port;
CommSetting.Comm_BaudRate = baudRate;
CommSetting.Comm_TimeOut = timeout;
}
else
{
Close();
return;
}
Cursor.Current = Cursors.WaitCursor;
CommSetting.comm = new GsmCommMain(port, baudRate, timeout);
Cursor.Current = Cursors.Default;
CommSetting.comm.PhoneConnected += new EventHandler(comm_PhoneConnected);
CommSetting.comm.MessageReceived += new MessageReceivedEventHandler(comm_MessageReceived);
//....
}
此事件不会引起人们的关注,当消息
CommSetting.comm.MessageReceived += new MessageReceivedEventHandler(comm_MessageReceived);
C#中的这段代码我创建于codeproject.com可以帮助我吗?
如果不设置Handshake属性,那么你必须自己设置硬件握手信号。将RtsEnable和DtrEnable属性设置为true。 –
而不是使用GSMcomm,您必须将您自己的处理程序接收数据并相应地做出决定。 –