Detailed Description
The ObexPushRequestSender class provides convenience methods for sending a variety of OBEX Push requests and also provides updates regarding the progress of each request.
ObexPushRequestSender sends files that are commonly transferred using the OBEX Object Push Profile, including business cards (vCards), calendars and ordinary files.
A unique ID is generated for each request and is used to provide request updates through the requestStarted(), requestProgress() and requestFinished() signals. Requests can be canceled using abortRequest().
This class uses SessionedObexClient to send each OBEX request inside of a device session for a particular hardware device. This ensures the Qt Extended device manager will try to keep the device open while a request is in progress.
This class enables the BluetoothFileSendService and the IrFileSendService.
This class is part of the Qt Extended server and cannot be used by other Qt Extended applications.
Member Function Documentation
ObexPushRequestSender::ObexPushRequestSender ( QObject * parent = 0 )
Constructs a sender with parent object parent.
bool ObexPushRequestSender::abortRequest ( int id )
Aborts the request identified by id.
If the request is successfully aborted, requestFinished() is emitted with aborted set to true. Due to timing issues, it is possible that the request has already finished. In this case, the request is not aborted, and requestFinished() will be emitted as normal.
Returns true if id references a request that is in progress; that is, requestFinished() has not yet been emitted for the request. Otherwise, this method does nothing, and returns false.
QIODevice * ObexPushRequestSender::createDevice ( const QContentId & contentId ) const [virtual protected]
Returns an opened QIODevice that can read from the contents of the resource identified by contentId. Returns 0 if there was an error.
The default implementation displays an error message if the resource is not accessible for reading.
This sender takes ownership of the returned device and deletes it when the request is finshed.
QIODevice * ObexPushRequestSender::createDevice ( const QContact & contact ) const [virtual protected]
This is an overloaded member function, provided for convenience.
Returns an opened QIODevice that can read the raw vCard data for the business card specified by contact. Returns 0 if there was an error.
The default implementation displays an error message if the contact data cannot be processed.
This sender takes ownership of the returned device and deletes it when the request is finshed.
QFile * ObexPushRequestSender::createFile ( const QString & filePath ) const [virtual protected]
Returns an opened file that can read from the contents of the file at filePath. Returns 0 if there was an error.
The default implementation displays an error message if the file does not exist or cannot be opened.
This sender takes ownership of the returned file and deletes it when the request is finshed.
QContact ObexPushRequestSender::ownerBusinessCard ( bool * hasBusinessCard ) const [protected]
Returns a QContact object that contains the details of the owner's business card. hasBusinessCard is set to true if the owner's business card is available, otherwise it is set to false.
The default implementation returns the result of QContactModel::personalDetails(). The owner's business card is determined to be available if QContactModel::hasPersonalDetails() returns true.
QContentId ObexPushRequestSender::requestContentId ( int id ) const
Returns the QContent ID for the request identified by id if the request was started by a call to sendContent(). Otherwise, returns QContent::InvalidId.
void ObexPushRequestSender::requestFinished ( int id, bool error, bool aborted ) [signal]
This signal is emitted when the request identified by id is finished. error is true if the request has failed, and aborted is true if the request was aborted following a call to abortRequest().
void ObexPushRequestSender::requestProgress ( int id, qint64 done, qint64 total ) [signal]
This signal is emitted to indicate the progress of the request identified by id. done is the amount of data that has already been sent, and total is the total amount of data to be sent. If the total amount cannot be determined, total is set to 0.
void ObexPushRequestSender::requestStarted ( int id, const QString & name, const QString & mimeType, const QString & description ) [signal]
This signal is emitted when an OBEX request begins. The id uniquely identifies the request for this sender. The name, mimeType and description are respectively set to the Name, Type and Description metadata values that will be sent in the request.
void ObexPushRequestSender::sendBusinessCard ( SessionedObexClient * client, int id, const QContact & contact )
Sends the business card represented by contact using client.
The specified id will be used to emit the requestStarted(), requestProgress() and requestFinished() signals for this request.
This sender takes ownership of client and deletes it when the request is finished.
See also sendPersonalBusinessCard().
void ObexPushRequestSender::sendBusinessCard ( SessionedObexClient * client, int id, const QDSActionRequest & actionRequest )
This is an overloaded member function, provided for convenience.
Sends the business card represented by actionRequest using client. The request object should contain raw serialized QContact data.
The specified id will be used to emit the requestStarted(), requestProgress() and requestFinished() signals for this request.
This sender takes ownership of client and deletes it when the request is finished.
See also sendPersonalBusinessCard().
void ObexPushRequestSender::sendCalendar ( SessionedObexClient * client, int id, const QDSActionRequest & actionRequest )
Sends the vCalendar object represented by actionRequest using client. The request object should contain raw serialized QTask or QAppointment data.
The specified id will be used to emit the requestStarted(), requestProgress() and requestFinished() signals for this request.
This sender takes ownership of client and deletes it when the request is finished.
void ObexPushRequestSender::sendContent ( SessionedObexClient * client, int id, const QContentId & contentId )
Sends the document identified by contentId using client.
The specified id will be used to emit the requestStarted(), requestProgress() and requestFinished() signals for this request.
This sender takes ownership of client and deletes it when the request is finished.
See also createDevice().
void ObexPushRequestSender::sendFile ( SessionedObexClient * client, int id, const QString & filePath, const QString & mimeType, const QString & description, bool autoDeleteFile )
Sends the file stored at filePath using client. The specified mimeType and description (both optional) will be sent in the request to provide additional metadata for the file. Set autoDeleteFile to true if the file stores at filePath should be deleted after it has been sent.
The specified id will be used to emit the requestStarted(), requestProgress() and requestFinished() signals for this request.
This sender takes ownership of client and deletes it when the request is finished.
See also createFile().
void ObexPushRequestSender::sendPersonalBusinessCard ( SessionedObexClient * client, int id )
Sends the user's personal business card using client. If the user has not set a personal business card, the user will be notified appropriately.
The specified id will be used to emit the requestStarted(), requestProgress() and requestFinished() signals for this request.
This sender takes ownership of client and deletes it when the request is finished.
See also sendBusinessCard() and ownerBusinessCard().