Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QTelephonyService Class Reference
[QtTelephonyModule]

The QTelephonyService class provides a convenient wrapper to create telephony services and the interfaces that they support. More...

    #include <QTelephonyService>

Inherits QAbstractIpcInterfaceGroup.

Inherited by QModemService.

Public Functions

Additional Inherited Members


Detailed Description

The QTelephonyService class provides a convenient wrapper to create telephony services and the interfaces that they support.

This class extends QAbstractIpcInterfaceGroup to add service(), callProvider(), and setCallProvider().

Telephony services group together a number of related telephony interfaces, to make it more convenient to create them at service start up and to allow the interfaces to find each other easily for passing requests from one interface to another.

As an example, a VoIP telephony service will typically have at least three telephony interfaces, for network registration, presence, and phone call management. The QTelephonyService object would be declared as follows:

    class VoIPService : public QTelephonyService
    {
        Q_OBJECT
    public:
        VoIPService( QObject *parent = 0 )
            : QTelephonyService( "voip", parent ) {}
        ~VoIPService() {}

        void initialize();
    };

    void VoIPService::initialize()
    {
        if ( !supports<QNetworkRegistration>() )
            addInterface( new VoIPNetworkRegistration( this ) );

        if ( !supports<QCollectivePresence>() )
            addInterface( new VoIPPresenceProvider( this ) );

        if ( !callProvider() )
            setCallProvider( new VoIPCallProvider( this ) );

        QTelephonyService::initialize();
    }

The VoIP telephony service creates an instance of VoIPService, and then calls the initialize() method to complete the initialization process:

    VoIPService *service = new VoIPService();
    service->initialize();

During initialize(), the three telephony interfaces corresponding to QNetworkRegistration, QCollectivePresence, and QPhoneCallProvider, are created. We first check to see if there is an existing implementation using supports() or callProvider(), which allows the VoIP telephony service to be inherited by another VoIP service that provides greater functionality than the basic VoIP service.

At the end of the function, the base QTelephonyService::initialize() method is called, which completes the initialization process and advertises the telephony service and all of its interfaces to the system. QCommServiceManager can be used by client applications to receive notification of when telephony services enter and leave the system.

See also QAbstractIpcInterfaceGroup, QCommServiceManager, QCommInterface, QNetworkRegistration, QCollectivePresence, and QPhoneCallProvider.


Member Function Documentation

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

Create a new telephony service called service and attach it to parent.

A call to the constructor should be followed by a call to initialize() to complete the initialization process.

See also initialize().

QTelephonyService::~QTelephonyService ()

Destroy this telephony service.

QPhoneCallProvider * QTelephonyService::callProvider () const

Returns the phone call provider associated with this service. Returns null if the provider has not yet been set.

See also setCallProvider().

bool QTelephonyService::dispatchDatagram ( const QSMSMessage & msg )

Dispatch the SMS datagram msg according to its SMS port number or WAP Push MIME type. This is used by telephony services that accept incoming SMS messages to dispatch them according to the installed services. Returns true if the message was dispatched, or false if no service exists that can handle the message.

See the documentation for QSMSMessage::destinationPort() for more information on how WAP push messages and SMS datagrams are dispatched.

See also QSMSMessage::destinationPort().

QString QTelephonyService::service () const

Returns the name of this telephony service, which is the same as its group name.

void QTelephonyService::setCallProvider ( QPhoneCallProvider * provider )

Sets the phone call provider for this service to provider. If the service already has a provider, it will be deleted. Ownership of provider will pass to this object, so that it will be automatically deleted when the modem service is deleted.

The usual way to use this method is from within an override of initialize():

    void MyService::initialize()
    {
        if ( !callProvider() )
            setCallProvider( new MyCallProvider( this ) );
        QTelephonyService::initialize();
    }

See also callProvider().


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3