我有一個類型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,您必須將您自己的處理程序接收數據並相應地做出決定。 –