Abir BY
Abir BY

Reputation: 63

How to access GSM modem ports via C++ program

I want to develop an application where I have to interact with a GSM Modem and require to write AT Commands on the modem via the com port (USB) from a C++ program.

How can I access ports?

Upvotes: 0

Views: 3271

Answers (3)

Elvis Dukaj
Elvis Dukaj

Reputation: 7378

So you have to study serial port communication first. not GSM communication...

I've arleady built a c++ serial port class. I'll release the source code on bitbucket soon, or you can download some serial port library such

boost::asio (cross-platoform)
QSerialPort (cross-platoform) it'll be part of QT 5.1.
CSerialPort (window only)

boost::asio is for asyncronous communication, it implements tcp/ip, udp/ip, serialport ecc... Bur require good knowledge of C++ programming.

I suggest you to learn better how serial port communication work. Look at wikipedia

Upvotes: 2

MSalters
MSalters

Reputation: 180303

You're looking for CreateFile, which despite its name will also open COM ports. Just pass the COM port name instead of a filename.

Upvotes: 0

Thanushan
Thanushan

Reputation: 532

If you have the correct driver for your USB device, Windows will show your device as COM port (e.g COM3). You can access the COM port from your code, and manipulate the settings. Your question seems very generic about serial port, so I couldn't be specific. However, here is some help

http://msdn.microsoft.com/en-us/library/ff802693.aspx ,

http://www.codeguru.com/cpp/i-n/network/serialcommunications/article.php/c5425/Serial-Communication-in-Windows.htm

Upvotes: 2

Related Questions