나는 lightwave 형식의 usb gsm 모뎀을 가지고 있습니다. 이 코드는 C#에서 수신, 보내기, 삭제 및이 모뎀에서 SMS 메시지를 읽을 수 있지만 새 메시지가 모뎀에 도착하면 새 메시지를받을 때 발생해야하는 이벤트가 발생하지 않습니다. 나는 그 문제가 무엇인지 모른다. 그러나, 나는 시뮬레이션 후받은에서이 메시지를 읽을 수 있지만 메시지는 코드의이 부분에 도착했을 때 나는 제기받은 메시지의 이벤트를 원하는 :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);
codeproject.com에 설립 된이 코드는 C#에서 찾을 수 있습니다.
당신은 설정하지 않은 경우 Handshake 속성을 사용하면 하드웨어 핸드 셰이크 신호를 직접 설정해야합니다. RtsEnable 및 DtrEnable 속성을 true로 설정하십시오. –
GSMcomm을 사용하는 대신 데이터를 수신하고 그에 따라 의사 결정을 내리기 위해 자체 처리기를 사용해야합니다. –