开发者

receiving SMS using AT COMMANDS

this website gives a great example of how to get all the data stored on your phone:

http://www.developershome.com/sms/howToReceiveSMSUsingPC.asp

AT
OK
AT+CMGF=1
OK
AT+CMGL="ALL"
+CMGL: 1,"REC READ","+85291234567",,"06/11/11,00:30:29+32"
Hello, welcome to our SMS tutorial.
+CMGL: 2,"REC READ","+85291234567",,"06/11/11,00:32:20+32"
A simple demo of SMS text messaging.

i can already send sms using my phone with at commands using C#, but i am having some difficulties receiving messages. i know that the way to do this is as shown above, but i do not know how to get the messages that the phone sends back to my app开发者_如何学编程.

how do i program a "listener" to the phone to get the messages?


I was going to be nice and give you some code snippets, but typing on the iPad isn't great. So this website here probably explains is better anyway

http://blogs.msmvps.com/coad/2005/03/23/serialport-rs-232-serial-com-port-in-c-net/

There is a section there that shows setting up the DataReceived event to get triggered when you get data, rather than you having to poll the Read commands.

I might also point out that while this will work for your phone, it may not work for others. Not all manufactures implemented their SMS AT commands the same... Which is frustrating. New phones don't even bother with it at all :-(


I'm not 100% sure what you're asking. If you can "send" a SMS then you're most of the way there! When you send the

AT+CMGL="ALL" 

command the modem should respond with

CMGL: 1,"REC READ","+85291234567",,"06/11/11,00:30:29+32" 
Hello, welcome to our SMS tutorial. 
+CMGL: 2,"REC READ","+85291234567",,"06/11/11,00:32:20+32" 
A simple demo of SMS text messaging. 

Are you talking with the modem via a serial port? If so, you'll need to use one of the Read... methods or hook up to the DataReceived() event. The MSDN docs are here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜