1

I'm developing a winform program in which I need to send and receive SMS messages.

I have no problem sending SMS, but I don't know how to inform when a new message has been received via a GSM modem. I want to have an acknowledgement like an interrupt or event, when a new message has been received.

As far as I know I should work to at+CNMI or at+CNMA, but unfortunately I can't find an example or suitable reference for those. Furthermore, I need to know how to get delivery message or how to handle that?

4

2 回答 2

4

AT+CNMI 和 AT+CNMA 是规范 3GPP TS 27.005 中定义的标准 AT 命令,可在此处获得。

关于发送成功的确认,请参见本文档第 3.5.1 节“发送消息,+CMGS”的描述。

于 2013-05-28T08:25:10.263 回答
2

当您在连接中定义新端口以进行连接时,您应该获得一个数据接收触发器。

SerialPort port = new SerialPort();
//...
port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);

在那个触发器中:

private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
     SerialPort sp = (SerialPort)sender;
     MessageBox.Show(sp.ReadExisting()); //Data received
}
于 2013-06-19T10:19:28.173 回答