接收短信收件箱数据 [英] Receive SMS inbox data
问题描述
大家好,
我目前正在尝试使用C#访问GSM调制解调器的SMS收件箱.我已经成功发送了短信,并且能够在超级终端中使用AT COMMANDS检索SMS数据,但是我无法使超级终端中显示的数据能够在C#应用程序中显示.
我已经设置了一个数据接收事件处理程序,该事件处理程序在响应AT命令并以对命令的响应方式(例如OK,ERROR,RING)从设备获取数据时似乎正在工作,但是我无法获取从gsm调制解调器检索SMS消息的命令返回的数据.
这是可在超级终端中使用的代码
//AT + CMGL =""REC UNREAD""
//+ CMGL:304,"REC UNREAD","+ 61403075676"
//TEST 7
//确定
//AT + CMGR = 304
//+ CMGR:"REC READ","+ 61403075676","2006/1/17,11:56:38";
//TEST 7
//确定
在C#应用中,以下代码无错误执行
port.WriteLine(
" AT + CMGF = 1 \ r" );port.WriteLine(
" AT + CMGL = \" REC UNREAD \" ) ;但是GSM调制解调器没有响应,我如何才能在C#应用程序中获得超级终端中回复的行.
非常感谢您的帮助
杆
解决方案
抽奖太快了,我一发布便发现了自己的错误.
需要返回卡拉奇:port.WriteLine("AT + CMGL = \" REC UNREAD \" );
愚弄我.
Hi all,
Im currently trying to access the SMS inbox of a GSM modem in C#. I have successfully sent sms messages and have been able to use the AT COMMANDS in hyperterminal to retreive SMS data, but I have not been able to get the data shown in hyperterminal to be shown in C# app.
I have set up a datareceived event handler which appears to be working as I get my AT commands echoed by it and I get data from the device in the way of responses to my command such as OK, ERROR, RING, but I am not able to get the data returned form the command to retrieve SMS messages from the gsm modem.
This is the code that works in Hyperterminal
//AT+CMGL="REC UNREAD"//+CMGL: 304, "REC UNREAD", "+61403075676"
//TEST 7 //OK //AT+CMGR=304 //+CMGR: "REC READ", "+61403075676", "2006/1/17,11:56:38" //TEST 7 //OKIn C# app the following code executes without error
port.WriteLine(
"AT+CMGF=1\r");port.WriteLine(
"AT+CMGL=\"REC UNREAD\"");But there is no response form the GSM Modem, how do I get the lines that where replied in hyperterminal to be abtainable in C# app.
Many thanks for your assistance
Rod
Too quick of the draw, I found my error as soon as I posted.
Carraige return is required: port.WriteLine("AT+CMGL=\"REC UNREAD\"\r");
Foolish me.
这篇关于接收短信收件箱数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!