Dears,
i was looking for a way to sommunicate with GSM modem through AT-Commands.
am able to do that through HyberTerminal, but am stucked in converting that to C++,
any clue..

PS: i can only use standard Libraries..

Recommended Answers

All 5 Replies

I think first you must open a COM port to communicate with modem.

Best you show how you do that first and you will get better help.

Can you also tell why "only use standard Libraries"?

You will be very stuck if you can only use standard libraries because communication with a COM port is not part of the standard library and you normally have to use some 3rd party platform library.

When sending AT commands you need to be very careful with you line endings because they have relevence to the AT command command set. End commands with a carridge return, don't use new lines at all. Get to the point where you can send an "AT" and get the "OK" echo'd back to you before you get into more complex commands. be aware that the "+++" command to bring you from on-line mode to off-line mode should not have anything following it (i.e. no carridge return or line feed). Anything following a "+++" cancels it. You must send the "+++" and wait for the modem to get back to you with an OK which may be several seconds.

Remember that modems have a number of things you can set that effect what they send back to you, echo, results mode (numerical or status or extended). The first command you should send should be to configure the modem to send results in the manor you are expecting and to switch off the echo.

Banfa , You Sound Guru :)
ok i give up, would you name any free libarary i can refer to..

Standard libraries are stuff that all C compilers have to support in order to considered "standards compliant". The functions you need are things like FILE* fopen("COM:", "rw"); (for Windows), or FILE* fopen("/dev/tty", "rw"); (for Linux/Unix), and this function is declared in the header file stdio.h.

That will open the device for communication. Then you would use other functions to write/read the device. FWIW, these are C functions, not C++, there are similar means that are C++ specific, and are declared in the iostream header file. If your class requires that you use the C++ versions of the device open/write/read functions, then look at iostream.

can anyone bring a sample code plz

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.