Solved

Using AT commands with C

Posted on 2007-12-04
21
5,034 Views
Last Modified: 2013-12-14
there is a AT commands here
http://www.developershome.com/sms/readSmsByAtCommands.asp


suppose i want to work with C visual or ++, how can i use this AT commands in a what that it will be sent to the mobile phone that will be connected to the computer
?

for example this is the at command to read unread sms
AT+CMGL="REC UNREAD"
how i can write it inside the c code, in a way that it will send this command to the mobile phone?
0
Comment
Question by:sasha85
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 5
  • 4
  • +1
21 Comments
 

Author Comment

by:sasha85
ID: 20401632
how to open socket or port?
how to send the at commends to this port?
0
 
LVL 19

Accepted Solution

by:
alb66 earned 250 total points
ID: 20402335
You can use a COM port.
A good article on windows serial communication:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp
0
 

Author Comment

by:sasha85
ID: 20405236
i tried every part of the code in the link but it somehow not work...when i look inside the settings 'phone and modems' i see the nokia and the motorola that i tried to connect on com 4
i set it on com 4 inside the string but i realy got no idea in what order this code need to be...msdn give only part and not the all code example:(
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:sasha85
ID: 20405241
i want to do this in C#
0
 
LVL 19

Assisted Solution

by:alb66
alb66 earned 250 total points
ID: 20409570
0
 

Author Comment

by:sasha85
ID: 20409619
what is the diffrences in coding  between serial rs232 cable and USB cable?
0
 
LVL 19

Assisted Solution

by:alb66
alb66 earned 250 total points
ID: 20409628
There is no difference. Applications manage a modem as a serial device using a COM port; the phisical layer differences are managed at driver level.
0
 

Author Comment

by:sasha85
ID: 20409676
there is no even speed deiffrences??
0
 
LVL 19

Assisted Solution

by:alb66
alb66 earned 250 total points
ID: 20409789
I don't know... i think performance may be different
0
 

Author Comment

by:sasha85
ID: 20409864
and how i transfer the at commands to the phone?
0
 
LVL 19

Assisted Solution

by:alb66
alb66 earned 250 total points
ID: 20410025
System.IO.Ports.SerialPort port = new System.IO.Ports.SerialPort( "COM4", 115200, Parity.None, 8, StopBits.One);
port.ReadTimeout = 500;
try
{
  port.Open();
  port.WriteLine("AT");
  string str = port.ReadLine();
}
catch...
0
 
LVL 8

Assisted Solution

by:unmeshdave
unmeshdave earned 200 total points
ID: 20412164
offcourse there is a speed difference between COM port and USB communication. anyhow, you can use the createfile to open comport and write function to send output. you can get the code of win32 example in this link(download link is there).

http://msdn2.microsoft.com/en-us/library/ms810467.aspx
0
 

Author Comment

by:sasha85
ID: 20414635
for example i got 10,000 sms at a time...my income limit is 200 sms
the program will need to read each sms than to procces it and delete it and read the new one...

speed is highly important...may be i will need a special GSM modem and not a regular mobile phone?
0
 
LVL 8

Assisted Solution

by:unmeshdave
unmeshdave earned 200 total points
ID: 20416685
10,000 SMS happens frequently then its a design flaw, why GSM modem is choosen instead of going for GPRS/data connection?
0
 

Author Comment

by:sasha85
ID: 20421818
i ment to write 1000 sms and not 10000...
i manage to get
Sierra Wireless AirCard 875U USB

i got it here it looking at me and i don't know how to communicate with this...cause i don't know what at command i have to use...i am sure it want to say something to me:)

*for gsm/data connection, as i understand i need to pay the service provider company...because it for study project and my budget limitted i cannot do this...
0
 
LVL 8

Assisted Solution

by:unmeshdave
unmeshdave earned 200 total points
ID: 20478784
u can use the 3G AT commands as your card is 3G card.
u can check both of the following link.

http://the.taoofmac.com/space/AT%20Commands
ftp://ftp.biometrics.co.za/Miscellaneous/3G_AT_Commands.zip
0
 

Author Comment

by:sasha85
ID: 20492508
i realy tried to understand what i am reading on this link but i realy do not understand how 3G and my
Sierra Wireless AirCard 875U USB  connected?
0
 

Author Comment

by:sasha85
ID: 20492521
its gsm card...
0
 
LVL 8

Assisted Solution

by:unmeshdave
unmeshdave earned 200 total points
ID: 20492581
did u try to use the commands listed in the link? it will serve your purpose..
0
 
LVL 49

Assisted Solution

by:DanRollins
DanRollins earned 50 total points
ID: 20510496
I suggest first trying to establish comminications manually.  Use the Windows program named "Hyperterminal"  to see if the device accepts simple AT commands.  Start > All Programs > Accessories > Communications

Once you know that you can "converse" with the device manually, you've taken the first "baby step"  towards writing code to do the same thing programamtically.
0
 

Author Comment

by:sasha85
ID: 20553010
ok...i just lost 2 weeks:(
this system have to run on linux...that means that c# or visual not good for this...

i will have to start all over again with c++
someone can please help me only with the part of communicating with the phone modem?
i mean opening the port and talking to the device...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question