Solved

Using AT commands with C

Posted on 2007-12-04
21
4,745 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
  • 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
 

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now