Detailed Description
The QtopiaServiceRequest class allows applications to request services from other applications.
A QtopiaServiceRequest encapsulates a Qt Extended service name and the message to be sent to that service. It is similar to QtopiaIpcEnvelope, but uses service names rather than direct channel names. The following example sends the editTime() request to the Time service:
QtopiaServiceRequest req("Time", "editTime()");
req.send();
Parameter data may be written to the request prior to sending it with send(). The following example requests that the WebAccess service open a specific URL:
QtopiaServiceRequest req("WebAccess", "openURL(QString)");
req << "http:
req.send();
Applications that implement services can use QtopiaAbstractService to process incoming service messages. See also {Services} for more information on implementing and configuring services.
See also Services, QtopiaService, and QtopiaAbstractService.
Member Function Documentation
QtopiaServiceRequest::QtopiaServiceRequest ()
Construct a null service request. setService() and setMessage() must be called before send(), but the service may be written prior to the calls.
QtopiaServiceRequest::QtopiaServiceRequest ( const QString & service, const QString & message )
Construct a service request that will send message to a service when send() is called. The service may be written prior to the calls.
QtopiaServiceRequest::QtopiaServiceRequest ( const QtopiaServiceRequest & orig )
Copy constructor. Any data previously written to the orig service will be in the copy.
QtopiaServiceRequest::~QtopiaServiceRequest ()
Destructs the service request. Unlike QtopiaIpcEnvelope, the request is not automatically sent.
void QtopiaServiceRequest::addVariantArg ( const QVariant & var )
Adds the variant var to the list of arguments, so that the variant's value is serialized in send() rather than the variant itself.
const QList<QVariant> & QtopiaServiceRequest::arguments () const
Returns the complete list of arguments for this service request.
See also setArguments().
bool QtopiaServiceRequest::isNull () const
Returns true if either the service() or message() is not set.
See also service() and message().
QString QtopiaServiceRequest::message () const
Returns the message of the request.
See also setMessage().
bool QtopiaServiceRequest::send () const
Sends the request. Returns false if there was no application that could service the request.
QString QtopiaServiceRequest::service () const
Returns the service to which this request will be sent.
See also setService().
void QtopiaServiceRequest::setArguments ( const QList<QVariant> & arguments )
Sets the complete list of arguments for this service request.
See also arguments().
void QtopiaServiceRequest::setMessage ( const QString & message )
Sets the message to be sent to the service.
See also message().
void QtopiaServiceRequest::setService ( const QString & service )
Sets the service to which the request will be sent.
See also service().
QtopiaServiceRequest & QtopiaServiceRequest::operator<< ( const T & var )
Adds var to the list of arguments for this service request.
QtopiaServiceRequest & QtopiaServiceRequest::operator<< ( const char * var )
This is an overloaded member function, provided for convenience.
Adds var to the list of arguments for this service request.
QtopiaServiceRequest & QtopiaServiceRequest::operator= ( const QtopiaServiceRequest & orig )
Assignment operator. Any data previously written to the orig service will be in the copy.