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

SessionedObexClient Class Reference
[QtBluetoothModule, QtInfraredModule]

The SessionedObexClient class provides a base implementation for performing an OBEX Put request inside of a device session for a particular hardware device. More...

    #include <SessionedObexClient>

Inherits QObject.

Public Functions


Protected Functions

Additional Inherited Members

Detailed Description

The SessionedObexClient class provides a base implementation for performing an OBEX Put request inside of a device session for a particular hardware device.

A SessionedObexClient will open a device session for the relevant hardware device before sending the specified OBEX request. Once the request is completed, the device session will be closed.

The use of device sessions ensures the Qt Extended device manager is aware that a hardware device is currently in use, so that the device manager will try to keep the device open while the OBEX request is in progress.

If you want to send OBEX requests without using device sessions, just use QObexClientSession.

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.

Subclassing SessionedObexClient

SessionedObexClient needs to be subclassed to provide the transport socket for the OBEX client request. When start() is called, the client will attempt to open a device session. When the session is opened (or fails to open), openedDeviceSession() is called. Subclasses should override this openedDeviceSession() to create an appropriate transport socket and then call sendRequest() with the socket object in order to begin the OBEX request.

The subclass can call abort() if the session should be ended prematurely.

See also QCommDeviceSession and QAbstractCommDeviceManager.

Member Function Documentation

SessionedObexClient::SessionedObexClient ( const QByteArray & deviceId, QObject * parent = 0 )

Creates a client that will operate on a device session for the hardware device with the given deviceId.

The parent is the QObject parent object for the client.

void SessionedObexClient::abort ()   [virtual]

Aborts the OBEX request and closes the device session.

If the OBEX request has been sent (i.e. begin() and sendRequest() have been called) and the request has not yet finished, the client will attempt to abort the transfer to the server. If this is successful, requestFinished() is emitted with aborted set to true. Then, the device session is closed, closedDeviceSession() is called and done() is emitted.

Otherwise, this will just close the device session, call closedDeviceSession() and emit done().

void SessionedObexClient::begin ( const QObexHeader & header, QIODevice * dataToSend )   [virtual]

Starts the client. Once the client is ready, it will send an OBEX Put request with header and the contents of dataToSend.

void SessionedObexClient::closedDeviceSession ()   [virtual protected]

Called when the device session for this client has been closed.

The device session could be closed because abort() has been called, or an external party has closed the session (e.g. by bringing down the associated hardware device).

void SessionedObexClient::dataSendProgress ( qint64 done, qint64 total )   [signal]

This signal is emitted after the request has started to indicate the progress of the data transfer. The done value is the number of bytes that have been sent or received so far, and total is the total number of bytes to be sent or received. If the total amount cannot be determined, total is set to 0.

void SessionedObexClient::done ()   [signal]

This signal is emitted once the device session has closed and closedDeviceSession() has been called.

void SessionedObexClient::forceAbort ()   [pure virtual protected]

Called when abort() has been called but the OBEX server has not responded to the Abort request. In this case, the subclass should try to force the cancelation of the request - for example, by disconnecting the transport connection.

void SessionedObexClient::openedDeviceSession ( bool error )   [pure virtual protected]

When begin() is called, the client will open the device session. Once the device session is opened (or has failed to open), this method will be called. error is true if the session failed to open.

Subclasses should override this to call sendRequest() with an appropriate socket object if the session was opened successfully.

void SessionedObexClient::requestFinished ( bool error, bool aborted )   [signal]

This signal is emitted when the OBEX request has finished. error is set to true if an error occurred during the request, and aborted is set to true if the request was aborted by a call to abort().

void SessionedObexClient::requestStarted ()   [signal]

This signal is emitted when the OBEX request has started. The request will not start until sendRequest() has been called by the subclass.

void SessionedObexClient::sendRequest ( QIODevice * socket )   [protected]

Sends the OBEX Put request specified in begin() over the given socket.

Copyright © 2009 Nokia Trademarks
Qt Extended 4.4.3