Solved

Serial Com

Posted on 2006-10-26
3
942 Views
Last Modified: 2012-08-13
Hi
I'm trying to establish GPRS connection in winxp via my phone used as modem on COM3.
I have used CreateFile, ReadFile, WriteFile for sending and receiving AT-commands and it seems to work as expected. However part of the response i get after sending a command is not returned before i send the next command.

Example:
Send1: ATZ\r
Receive1: ATZ\r
Send2: AT+CGATT=1\r
Receive2: \r\nOK\r\nAT+CGATT=1\r

The \r\nOK\r\n part i would like to be returned at the end of first reception, but not sure how to do this. I sniffed winxp dialup to see how it is done and it seems to use IOCTL_SERIAL_GET_COMMSTATUS: Retrieve COM status, in order to get last bytes. However I'm not sure how to do this in my program

Thanks in advance
0
Comment
Question by:connerdk
3 Comments
 
LVL 16

Accepted Solution

by:
PaulCaswell earned 250 total points
ID: 17821737
Hi connerdk,

You need to give time for the OK to come through after Receive1:ATZ\r.

The ATZ is a command to the modem. The modem will echo every character you type/send. When it receives the \r it begins to execute the command. When you read what is in the comms buffer after you send the \r you are reading the characters it has already echoed. If you wait, perhaps up to about one second, checking for the 'OK' to come back it should arrive. You should do this for all commands you send.

Paul
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

758 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

21 Experts available now in Live!

Get 1:1 Help Now