Home · All Classes · Grouped Classes · Annotated · Functions

QModemService Class Reference

The QModemService class implements telephony functionality for AT-based modems. More...

    #include <QModemService>

Inherits QTelephonyService.

Public Functions

Signals

Static Public Members

Protected Slots

Additional Inherited Members


Detailed Description

The QModemService class implements telephony functionality for AT-based modems.

The default implementation uses AT commands from the GSM standards 3GPP TS 07.07, 3GPP TS 07.05, 3GPP TS 27.007, and 3GPP TS 27.005.

The implementation can be customized for proprietary modem command sets by inheriting QModemService and overriding QModemService::initialize(), which should create new interfaces to replace the default implementations.

For example, consider a modem that uses different commands for network registration than the GSM standard specifies. The modem integrator would create a new modem service class that overrides the default implementation of network registration:

    class MyModemService : public QModemService
    {
        ...
        void initialize();
        ...
    };

    void MyModemService::initialize()
    {
        if ( !supports<QNetworkRegistration>() )
            addInterface( new MyNetworkRegistration(this) );
        QModemService::initialize();
    }

The new functionality can then be implemented in the MyNetworkRegistration class, which will inherit from QNetworkRegistrationServer. The MyModemService::initialize() method first calls supports() to check if an instance of QNetworkRegistration has already been added.

This modem service handles the following posted events, via QModemService::post():

See also QTelephonyService.


Member Function Documentation

QModemService::QModemService ( const QString & service, const QString & device = QString(), QObject * parent = 0 )

Creates a new modem service handler called service and attaches it to parent.

The device parameter specifies the serial device and baud rate to use to communicate with the modem (for example, /dev/ttyS0:115200).

If device is empty, the default serial device specified by the QTOPIA_PHONE_DEVICE environment variable is used.

QModemService::QModemService ( const QString & service, QSerialIODeviceMultiplexer * mux, QObject * parent = 0 )

Creates a new modem service handler called service and attaches it to parent. The mux parameter specifies the serial device multiplexer to use for accessing the modem.

This version of the constructor may be needed if the modem is accessed via some mechanism other than kernel-level serial devices. The caller would construct an appropriate multiplexer wrapper around the new mechanism before calling this constructor.

QModemService::~QModemService ()

Destroys this modem service and all of its interfaces.

void QModemService::chat ( const QString & command )

Sends command to the modem on the primary AT chat channel. If the command fails, the caller will not be notified.

See also primaryAtChat() and retryChat().

void QModemService::chat ( const QString & command, QObject * target, const char * slot, QAtResult::UserData * data = 0 )

This is an overloaded member function, provided for convenience.

Sends command to the modem on the primary AT chat channel. When the command finishes, notify slot on target. The slot has the signature done(bool,QAtResult&). The boolean parameter indicates if the command succeeded or not, and the QAtResult parameter contains the full result data.

The optional data parameter can be used to pass extra user data that will be made available to the target slot in the QAtResult::userData() field.

See also primaryAtChat() and retryChat().

void QModemService::connectToPost ( const QString & item, QObject * target, const char * slot )

Connects slot on target to receive posted item values. This can be used as an alternative to the posted() signal. Only those posted items that equal item will be delivered to the slot.

See also post() and posted().

QModemService * QModemService::createVendorSpecific ( const QString & service = "modem", const QString & device = QString(), QObject * parent = 0 )   [static]

Creates and returns a vendor-specific modem service handler called service (the default is modem) and attaches it to parent.

The device parameter specifies the serial device and baud rate to use to communicate with the modem (for example, /dev/ttyS0:115200).

If device is empty, the default serial device specified by the QTOPIA_PHONE_DEVICE environment variable is used.

This function will load vendor-specific plug-ins to handle extended modem functionality as required. If the QTOPIA_PHONE_VENDOR environment variable is set, then that vendor plug-in will be loaded. Otherwise this function will issue the AT+CGMI command and ask each vendor plug-in if it supports the returned manufacturer value.

See also QModemServicePlugin.

QModemIndicators * QModemService::indicators () const

Returns the modem indicator object for this modem service.

See also QModemIndicators.

QSerialIODeviceMultiplexer * QModemService::multiplexer () const

Returns the serial device multiplexer that is being used to communicate with the modem.

void QModemService::needSms ()   [virtual protected slot]

Requests the SMS service from the modem and places it into PDU mode. The "smsready" item will be posted when it is ready. If the SMS service is already known to be ready and in PDU mode, then the "smsready" item will be posted upon the next entry to the event loop. The object requesting SMS service should use connectToPost() to monitor for when "smsready" is posted.

This implementation repeatedly sends AT+CMGF=0 every second for fifteen seconds until the command succeeds or the retry count expires. Higher levels that call this function should timeout their requests after fifteen seconds if "smsready" has not been received in the meantime.

See also post() and connectToPost().

void QModemService::post ( const QString & item )

Posts item to functionality providers that have expressed an interest via connectToPost() or posted(). The posted item will be delivered upon the next entry to the event loop.

Posted events are used as a simple communication mechanism between functionality providers. Providers that post items are completely decoupled from providers that consume items.

For example, posting the item sms:needed will ask the SMS functionality provider to initialize the SMS subsystem. Once SMS has been initialized, it will post the sms:available item. Other providers that depend upon SMS initialization can then proceed with using the SMS functionality.

See also connectToPost() and posted().

void QModemService::posted ( const QString & item )   [signal]

Signal that is emitted whenever an item is posted using post(). Slots that are connected to this signal should filter on item to determine if the posted item is relevant to them. Alternatively, they can use connectToPost() to only receive notification of specific posted items.

See also post() and connectToPost().

QAtChat * QModemService::primaryAtChat () const

Returns the AT chat handler for the primary modem control channel.

See also secondaryAtChat().

void QModemService::resetModem ()   [signal]

Signal that is emitted when the modem has reset, either during start up or just after a AT+CFUN command. Slots that connect to this signal should issue AT commands to put the modem into a known state and to enable unsolicited notifications of interest to the connected object.

void QModemService::retryChat ( const QString & command )

Retry command up to 15 times, once per second, until it succeeds. This is typically used to send initialization commands that may need several tries before the modem will accept them during start up.

See also primaryAtChat() and chat().

QAtChat * QModemService::secondaryAtChat () const

Returns the AT chat handler for the secondary modem control channel. This will return the same as primaryAtChat() if the modem does not have a secondary modem control channel.

See also primaryAtChat().

void QModemService::suspend ()   [virtual protected slot]

Processes a request to suspend modem operations and to put the modem into a low-power state. The modem vendor plug-in must call suspendDone() once the operation completes. The default implementation calls suspendDone().

This is intended for modems that need a special AT command or device ioctl operation to suspend the modem. If the modem does not need any special help, this function can be ignored.

This function is called in response to a suspend() command on the QCop channel QPE/ModemSuspend.

See also wake() and suspendDone().

void QModemService::suspendDone ()   [protected slot]

Notifies the system that a suspend() operation has completed. The suspendDone() message is sent on the QCop channel QPE/ModemSuspend.

See also suspend() and wake().

void QModemService::wake ()   [virtual protected slot]

Processes a request to wake up the modem from a suspend() state. The modem vendor plug-in must call wakeDone() once the operation completes. The default implementation calls wakeDone().

This function is called in response to a wake() command on the QCop channel QPE/ModemSuspend.

See also wakeDone() and suspend().

void QModemService::wakeDone ()   [protected slot]

Notifies the system that a wake() operation has completed. The wakeDone() message is sent on the QCop channel QPE/ModemSuspend.

See also wake() and suspend().


Copyright © 2008 Nokia Trademarks
Qtopia 4.3.3