Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QModemService Class Reference
[QtCellModule]

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

    #include <QModemService>

Inherits QTelephonyService.

Public Functions

  • QModemService ( const QString & service, const QString & device = QString(), QObject * parent = 0 )
  • QModemService ( const QString & service, QSerialIODeviceMultiplexer * mux, QObject * parent = 0 )
  • void chat ( const QString & command )
  • void chat ( const QString & command, QObject * target, const char * slot, QAtResult::UserData * data = 0 )
  • void connectToPost ( const QString & item, QObject * target, const char * slot )
  • QModemIndicators * indicators () const
  • QSerialIODeviceMultiplexer * multiplexer () const
  • void post ( const QString & item )
  • QAtChat * primaryAtChat () const
  • void retryChat ( const QString & command )
  • QAtChat * secondaryAtChat () const

Signals

Static Public Members

  • QModemService * createVendorSpecific ( const QString & service = "modem", const QString & device = QString(), QObject * parent = 0 )
  • 4 static public members inherited from QObject

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():

  • needsms - ask that the SMS system be initialized and made ready for use. QModemService responds by posting smsready when SMS becomes available. Modem vendor plug-ins can override the needSms() method to provide an alternative implementation.
  • smsready - the SMS system is initialized and ready for use.

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().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 42
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 8
Page suivante

Le Qt Labs au hasard

Logo

Utiliser OpenCL avec Qt

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtextended4.4
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web