Sie sind auf Seite 1von 7

3/6/2015 ReceivingSMSmessagesusingATcommands

SMSsolutions.net
ShortcutMenu

Contact
Sponsor
Submitsoftware

Skip

MainNavigation

Home
Freeware
Submit

Contactus
Sitemap

Search

FreewareTools

SmppSimulator
SendSms
VMwareMonitor
XenServerMonitor
Downloadmoretools

http://www.smssolutions.net/tutorials/gsm/receivesmsat/ 1/7
3/6/2015 ReceivingSMSmessagesusingATcommands

Categories

Hardware
Software
SMSServiceCenters
MMSProviders
Tutorials

GSMModems
SMPPProtocol
SmartMessaging
WAP
MMS
Miscellaneous

Books
PressReleases
Links

BulkSMSGateway

SMSGatewayUK

FeaturedProduct

ActiveXperts
SMSMessagingServer

Submissions

SubmitSoftware
SubmitHardware

http://www.smssolutions.net/tutorials/gsm/receivesmsat/ 2/7
3/6/2015 ReceivingSMSmessagesusingATcommands

SubmitBooks
SubmitTutorial
SubmitPressRelease

General
Sponsoracategory
Contact

RelatedSites

AdminFavorites.com
MonitorTools.com
GSMfavorites.com
WindowsDevelopment.com
WindowsManagement.com
WindowsShareware.com

Youarehere:

SMSSolutions.net>Tutorials>GSMModemTutorials>ReceiveSMSmessagesusingATcommands

VisitActiveXpertsSMSMessagingServerWebSite
DownloadActiveXpertsSMSMessagingServer

ReceivingSMSmessagesusingATcommands
Introduction
http://www.smssolutions.net/tutorials/gsm/receivesmsat/ 3/7
3/6/2015 ReceivingSMSmessagesusingATcommands

SomeadvancedGSMmodemslikeWaveComandMultitech,supporttheSMStextmode.ThismodeallowsyoutosendandreceiveSMSmessages
usingATcommands,withouttheneedtodecodethebinairyPDUfieldoftheSMSfirst.ThisisdonebytheGSMmodem.

Tosendthecommandsdiscussedinthistutorial,youcanuseaterminalprogram,forinstanceHyperterminal.

Tocheckifyourmodemsupportsthistextmode,youcantrythefollowingcommand:

AT+CMGF=1<ENTER>

Ifthemodemrepondswith"OK"thismodeissupported.Pleasenotethatusingthismodeitisonluypossibletosendsimpletextmessages.Itisnot
possibletosendmultipart,Unicode,dataandothertypesofmessages.

Settingupthemodem
IfthemodemcontainsaSIMcardwithissecuredwithaPINcode,wehavetoenterthispincodefirst:

AT+CPIN="0000"<ENTER>(replace0000withyourPINcode).

Pleasenotthatinmostcasesyouhaveonly3attempstosetthecorrectPINcode.AftersettingthePINcode,waitsomesecondsbeforeissueingthe
nextcommandtogivethemodemsometimetoregisterwiththeGSMnetwork.

InordertosendaSMS,themodemhastobeputinSMStextmodefirstusingthefollowingcommand:

AT+CMGF=1<ENTER>

Ifthemodemrespondswitherror,eitherthemodemdoesnotsupportSMStextmode,ortheSIMcardisnotready.Inthiscasepleasecheckthatthe
SIMcardisinsertedandthepincodeisentered.Youcanalsoturnonextendederrorreportsbyusingthefollowingcommand:

AT+CMEE=1<ENTER>

Insteadofjustan"ERROR"themodemwillnowrespondwith"+CMSERROR:xxx"or"+CMEERROR:xxx".Foralistofpossibleerrorcodes
pleasecheckthislist.

Selectingthepreferredmessagestorage
AGSMphoneormodemreceivesmessagesautomatically.BasicallyyouarejustretrievingthemessagesfromthememoryofthedeviceorSIMcard.
Toselectthemessagestorageusedtoreadthemessagesfrom,youhavetousethe"AT+CPMS"command.Youcanselectoneofthefollowing
http://www.smssolutions.net/tutorials/gsm/receivesmsat/ 4/7
3/6/2015 ReceivingSMSmessagesusingATcommands

messagestorages,notallstoragesaresupportedoneverydevice.

StorageID Description
ReadSMSmessagesfromtheSIMcard.ThisstorageissupportedoneveryGSMphone,becauseaSIMcard
SM
shouldalwaysbepresent.UsuallyaSIMcardcanstoreupto15messages.
ReadSMSmessagesfromthemodemormobilephonememory.Thenumberofmessagesthatcanbestored
ME
heredependsonthesizeofthephonesmemory.
ReadSMSmessagesfromallstoragesonthemobilephone.Forinstancewhenthephonesupports"ME"and
MT
"SM",the"MT"memorycombinesthe"ME"and"SM"memoriesasifitwasasinglestorage.
Thisstorageisonlyusedtoreadstoredincomingcellbroadcastmessages.Itisnormallynotusedtostore
BM
SMSmessages.
WhenyouenablestatusreportswhensendingSMSmessages,thestatusreportsthatarereceivedarestored
SR
inthismemory.ThesereportscanreadthesamewayasSMSmessages.

Tofindoutwhichstoragesaresupportedbyyourmobilephone,usethecommandlinebelow:

AT+CPMS=?

Themodemwillrespondwithalistofsupportedstorages,forinstance:

+CPMS:(("SM","BM","SR"),("SM"))

Thestoragecanbeselectedusingthefollowingcommand:

AT+CPMS=<read>[,<send>,<receive>]<ENTER>

Thefirstparametersetsthestoragetoreadfromthesecondoptionalspecifiesthestoragetosendmessagesfromandthelastoptionalparametertells
thedevicewheretostorenewlyreceivedmessages.

Forexample,toreadmessagesfromtheSIMcarduse:

AT+CPMS="SM"<ENTER>

Themodemshouldrespondwiththefollowingstring:

+CPMS:<used_space>,<max_space><ENTER>

http://www.smssolutions.net/tutorials/gsm/receivesmsat/ 5/7
3/6/2015 ReceivingSMSmessagesusingATcommands

Theused_spaceindicatesthenumberofmessagescurrentlyinthismemory,themax_spacethenumberofmessagesthatcanbestored.

Listingthemessages
Onceyouhavesuccessfullysetthemessagesstorage,youcanlistthemessagesavailableusingthelistcommand:

AT+CMGL="ALL"<ENTER>

Pleasenotthat"ALL"hastobesendinuppercaseonsomemodems.ThemodemwillrespondwithalistofdecodedSMSmessages:

+CMGL:1,"RECUNREAD","+31625012354",,"07/07/05,09:55:16+08"
Testmessage1
+CMGL:2,"RECUNREAD","+31625012354",,"07/07/05,09:56:03+08"
Testmessage2

OK

Theresponsemessagesareformattedlikethis:

+CMGL:<index>,<status>,<from_address>,<mr>,<scts><CRLF><data>
index Thememoryindexnumber,usethisindextoreadordeletethismessage.
Thestatusofthismessage.Forreceivedmessagesthiscanbe"RECREAD"or"RECUNREAD"
status
dependingonwhetherthemessageshasbeenreadorlistedbefore.
from_address Thesubscribernumberofthepersonwhosentthemessage.
mr Thereferencenumberofthismessage.Mostmodemskeepthisfieldempty.
scts Thetimethemessagewasforwardedtothisphoneormodem.
data Theactualmessagedatainplaintext

Readingamessage
Tolistasinglemessage,youhavetousethereadcommand.Youmustusethelistcommandfirst,soyouknowtheindexesofthemessagesinthe
storage.Forinstance,toreadthemessageonmemorylocation'2'use:

AT+CMGR=2<ENTER>

Themodemwilllistthesinglemessage:
http://www.smssolutions.net/tutorials/gsm/receivesmsat/ 6/7
3/6/2015 ReceivingSMSmessagesusingATcommands

+CMGR:"RECREAD","+31625012254",,"07/07/05,09:56:03+08"
Testmessage2

OK

Pleasenotethatthestatusofthemessageisnow"REC_READ"insteadof"REC_UNREAD"becausewereadthemessage.

Deletingamessage
Onceyouhavereadamessage,youcanfreethememorybydeletingthemessagefromthestorage.Forinstance,todeletethemessageonmemory
location'2'use:

AT+CMGD=2<ENTER>

Themodemwilldeletethesinglemessage.

FooterNavigation

SMSSolutions.net2015Allrightsreserved.
Contact
TermsofUse
PrivacyPolicy

http://www.smssolutions.net/tutorials/gsm/receivesmsat/ 7/7

Das könnte Ihnen auch gefallen