Search code examples
c++qtmodemgprsqtserialport

Qt : send AT command to GPRS modem


I have an Arduino board with a GPRS shield. I'm able to send and receive SMS's with Arduino's IDE, but I'm about to use a Wavecom GPRS modem now.

I can connect and send strings from Qt to Arduino board so that when Arduino receives a special string from Qt, it sends an SMS. See code below.

But now, I'm stuck... don't know how to send AT commands directly from Qt and not just sending a string that Arduino's waiting for to send an SMS...

Does someone now if it's possible to send AT commands from Qt to a GPRS modem?

Arduino code:

void  loop()
{
    //Check if available
    if (Serial.available())
    {
        // read the incoming byte:
        incomingByte = Serial.read();

       //Just to show how it works
       if(incomingByte == 'X')
       {
        AT commands to send an sms
        }    
   }
    else
        delay(5); // there is nothing to read, so wait a few msec's
}

Solution

  • AT commands are usually sent via serial port that will be processed by the controller software on the GPRS modem. Therefore, you only need to take care of the sending side in your Qt application.

    Thereby, you would just use the QIODevice::write() interface through the QtSerialPort module:

    mySerialPort->write("My AT command");