Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 5th, 2009, 07:17 AM
Authorized User
 
Join Date: May 2004
Posts: 73
Thanks: 0
Thanked 1 Time in 1 Post
Default How to get messages from phone or SIM's storage?

Hi guys,

I am working on a project where i have to send and receive sms messages using a GSM modem. Currently i am using my Samsung SGH-E250 phone as a GSM modem. I can successfully send messages and receives new messages. The problem is when i give the AT commands to get messages from phone or SIM's storage it gives weird output which i can not guess what it is. Below is the piece of code which is used to get messages:

string Resp = "";

MessagePort.WriteLine("AT+CMGF=1" + "\r"); /* message format = Text */
Resp = ReadPortEx();

MessagePort.WriteLine("AT+CMEE=1" + "\r"); /* set extended error reports. */
Resp = ReadPortEx();

MessagePort.WriteLine("AT+CPMS=?" + "\r"); /* Give preferred message storage. */
Resp = ReadPortEx();

MessagePort.WriteLine("AT+CPMS=\"ME\"" + "\r"); /* Read messages from phone/modem's storage. */
Resp = ReadPortEx();

//MessagePort.WriteLine("AT+CPMS=\"SM\"" + "\r"); /* Read messages from SIM's storage. */
//Resp = ReadPortEx();

//MessagePort.WriteLine("AT+CMGL=\"ALL\"" + "\r"); /* Get list of all messages. */

MessagePort.WriteLine("AT+CMGL=\"REC UNREAD\"" + "\r"); /* Get list of unread messages. */
Resp = ReadPortEx();

and the output it gives is a very large stream of characters like this:


"\r\n+CMGL: 0,\"REC READ\",\" eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\" eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\"

eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\" eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\"

eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\" eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\"

eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\" eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\"

eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\" eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\"

eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\" eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\"

eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\" eL\",\"|\",\"\",80,0\r\n,0\r\n\r\n+CMGL: 0,\"REC READ\",\"

Please tell me what is wrong with the AT commands or i am giving some wrong parameters or missing something . Please help.
__________________
BaburMan





Similar Threads
Thread Thread Starter Forum Replies Last Post
data storage and import stealthdevil Visual Basic 2005 Basics 4 September 19th, 2007 11:12 AM
Storage Engine ashuphp Beginning PHP 1 April 19th, 2007 12:13 AM
intermediate storage sarah lee ASP.NET 1.0 and 1.1 Basics 3 September 11th, 2006 01:31 PM
date storage simplyAns Oracle 4 October 20th, 2004 03:59 AM
Document Storage hugh@kmcnetwork.com SQL Server 2000 1 December 23rd, 2003 10:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.