Detailed Description
The QPhoneCallProvider class implements a mechanism for phone call providers to hook into the telephony system.
Phone call providers (e.g. GSM and VoIP) inherit from the QPhoneCallProvider class and override the create() method. They also separately inherit their own call implementation class from QPhoneCallImpl.
Subclasses should call setCallTypes() within their constructor to indicate the call types that they can handle.
The QPhoneCallProvider class provides the infrastructure to receive requests from client applications and dispatch them to the appropriate methods on QPhoneCallImpl. As the calls change state, the state information is sent back to the client applications.
Client applications should use QPhoneCallManager and QPhoneCall to manage phone calls. Only the server-side providers need to use QPhoneCallProvider and QPhoneCallImpl.
For AT-based modems, phone call providers should consider using QModemCallProvider instead of QPhoneCallProvider.
See also QPhoneCallImpl, QPhoneCallManager, QPhoneCall, and QModemCallProvider.
Member Function Documentation
QPhoneCallProvider::QPhoneCallProvider ( const QString & service, QObject * parent )
Constructs a new phone call provider for service and attaches it to parent.
In a subclass, the constructor will typically contain a call to setCallTypes() to advertise the list of call types that the provider supports. The list is advertised in the Qt Extended value space and can be queried by client applications using QPhoneCallManager::callTypes().
The following example demonstrates the recommended contents for the constructor in a subclass of QPhoneCallProvider():
VoIPCallProvider::VoIPCallProvider( QTelephonyService *service )
: QPhoneCallProvider( service->service(), service )
{
setCallTypes( QStringList( "VoIP" ) );
}
See also setCallTypes().
QPhoneCallProvider::~QPhoneCallProvider ()
Destroys this phone call provider and all calls associated with it.
void QPhoneCallProvider::beginStateTransaction ()
Begins a state change transaction. Calls to QPhoneCallImpl::setState() will be queued. The notification of the state change will not be sent to client applications until endStateTransaction() is called. This is typically used to update several calls at once; for example when swapping active and held calls.
If beginStateTransaction() is called multiple times before endStateTransaction(), then the notifications will be sent once the same number of endStateTransaction() calls have been made.
See also endStateTransaction() and QPhoneCallImpl::setState().
void QPhoneCallProvider::callStatesChanged () [signal]
Signal that is emitted when one or more calls within this provider have changed state.
See also QPhoneCallImpl::stateChanged().
QList<QPhoneCallImpl *> QPhoneCallProvider::calls () const
Returns the list of all phone calls associated with this provider.
See also create() and findCall().
QPhoneCallImpl * QPhoneCallProvider::create ( const QString & identifier, const QString & callType ) [pure virtual protected]
Creates a new phone call implementation object for a call of type callType, and assigns it the specified identifier. The object constructed will be of a subtype of QPhoneCallImpl. The typical implementation in the subclass is as follows:
return new QMyPhoneCallImpl( this, identifier, callType );
This function is called when a dial request is received from a client application. It will be followed by a call to QPhoneCallImpl::dial().
For incoming calls, the provider implementation should construct a QPhoneCallImpl object directly, with an empty identifier as the argument.
Providers should not delete call implementation objects themselves. The objects will be automatically deleted when the call transitions into an end state (HangupLocal, HangupRemote, Missed, etc).
void QPhoneCallProvider::deregisterCall ( QPhoneCallImpl * call ) [virtual protected]
Called when call is deregistered from this provider. This function is called automatically by the destructor for QPhoneCallImpl.
See also registerCall().
void QPhoneCallProvider::endStateTransaction ()
Ends a state change transaction and transmits any queued notifications.
See also beginStateTransaction() and QPhoneCallImpl::setState().
QPhoneCallImpl * QPhoneCallProvider::findCall ( const QString & identifier ) const
Returns a call with a specific identifier. Returns null if there is no such call.
See also calls().
void QPhoneCallProvider::registerCall ( QPhoneCallImpl * call ) [virtual protected]
Called when call is first registered with this provider. This function is called automatically by the constructor for QPhoneCallImpl.
See also deregisterCall().
QString QPhoneCallProvider::service () const
Returns the name of the service that this provider is associated with.
void QPhoneCallProvider::setCallTypes ( const QStringList & types ) [protected]
Sets the list of supported call types for this provider. The list is advertised in the Qt Extended value space, and can be queried by client applications using QPhoneCallManager::callTypes().