Home · All Classes · Annotated · Functions

QAtResultParser Class Reference

The QAtResultParser class provides support for parsing the response to AT modem commands More...

#include <QAtResultParser>

Public Types

Public Functions


Detailed Description

The QAtResultParser class provides support for parsing the response to AT modem commands

The QAtResultParser provides functions that support parsing the response from AT modem commands and unsolicited notifications.

The following example demonstrates how to parse the response to a AT+CPOL (preferred operator list) query:

    QAtResultParser parser( result );
    while ( parser.next( "+CPOL:" ) ) {
        uint index = parser.readNumeric();
        uint format = parser.readNumeric();
        QString name;
        if ( format == 2 )  // Numeric format.
            name = QString::number( parser.readNumeric() );
        else                // String format.
            name = parser.readString();
    }

See also QAtResult.


Member Function Documentation

QAtResultParser::QAtResultParser ( const QAtResult & result )

Construct an AT modem result parser to parse the content of result. The caller will typically follow this with a call to next() to position the parser on the first line of relevant result data.

QAtResultParser::QAtResultParser ( const QString & notification )

Construct an AT modem result parser and initialize it to parse the specified unsolicited notification. Notifications are expected to have the format NAME: VALUE. The next() function will be called internally to position the parser at VALUE.

QAtResultParser::~QAtResultParser ()

Destruct this AT modem result parser.

QString QAtResultParser::line ()

Get the full content of the line that next() positioned us on. The line's prefix is not included in the return value.

QStringList QAtResultParser::lines ( const QString & prefix )

Get the content of all lines that begin with prefix starting at the current position.

bool QAtResultParser::next ( const QString & prefix )

Position this AT modem result parser on the next line that begins with prefix.

QList<QAtResultParser::Node> QAtResultParser::readList ()

Read a list of values surrounded by parentheses. This is for complex command results that cannot be parsed with readNumeric() and readString().

QString QAtResultParser::readNextLine ()

Read the next line of input as literal text, without looking for a prefix. This is for results from commands such as AT+CMGL which place the PDU on a line of its own.

uint QAtResultParser::readNumeric ()

Read a numeric value from the current line.

QString QAtResultParser::readString ()

Read a string from the current line.

void QAtResultParser::reset ()

Reset this AT modem result parser to the beginning of the content.

void QAtResultParser::skip ()

Skip the contents of a comma-separated field in the current line.


Copyright © 2006 Trolltech Trademarks
Qtopia 4.1.7