Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QBluetoothAbstractService Class Reference
[QtBluetoothModule]

The QBluetoothAbstractService class provides a base interface class for Bluetooth services within Qtopia. More...

    #include <QBluetoothAbstractService>

Inherits QObject.

Inherited by QBluetoothHandsfreeService, QBluetoothHeadsetService, and QBluetoothSerialPortService.

Public Types

  • enum Error { NoError, InvalidArguments, NotConnected, NotAuthorized, ..., UnknownError }

Public Functions

  • 29 public functions inherited from QObject

Signals

Protected Functions

  • 7 protected functions inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 public type inherited from QObject
  • 4 static public members inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QBluetoothAbstractService class provides a base interface class for Bluetooth services within Qtopia.

To create a Qt Extended Bluetooth service, subclass QBluetoothAbstractService and implement the start(), stop() and setSecurityOptions() methods. Your service will automatically be registered and accessible as a Bluetooth service within Qtopia. This means the service will be accessible to external parties through QBluetoothServiceController. It will also be shown in the list of local services in the Bluetooth settings application, allowing end users to modify the service's settings.

Naturally, it is possible to implement Bluetooth services outside of Qt Extended by using the BlueZ libraries and standard Linux tools. However, such services will not be accessible through Qtopia.

See also Tutorial: Creating a Bluetooth service.


Member Type Documentation

enum QBluetoothAbstractService::Error

Possible errors that might occur.

ConstantValueDescription
QBluetoothAbstractService::NoError0No error.
QBluetoothAbstractService::InvalidArguments1Invalid arguments were passed.
QBluetoothAbstractService::NotConnected2The remote device is not connected.
QBluetoothAbstractService::NotAuthorized3The service trying to perform the action does not have permission to manipulate the resource.
QBluetoothAbstractService::NotAvailable4The resource is not available.
QBluetoothAbstractService::DoesNotExist5The requested resource does not exist.
QBluetoothAbstractService::Failed6Operation failed.
QBluetoothAbstractService::Rejected7Authorization request was rejected by the user or it was not accepted in due time.
QBluetoothAbstractService::Canceled8Authorization request was canceled.
QBluetoothAbstractService::UnknownError9Unknown error.


Member Function Documentation

QBluetoothAbstractService::QBluetoothAbstractService ( const QString & name, const QString & displayName, QObject * parent = 0 )

Constructs a Bluetooth service. The name is a unique name that identifies the service, and displayName is a user-friendly, internationalized name for this service that can be displayed to the end user. The parent is the QObject parent for this service.

QBluetoothAbstractService::QBluetoothAbstractService ( const QString & name, const QString & displayName, const QString & description, QObject * parent = 0 )

Constructs a Bluetooth service. The name is a unique name that identifies the service. The displayName is a user-friendly, internationalized name for this service that can be displayed to the end user. The description is a translated description that might be displayed to the user. The parent is the QObject parent of this object.

QBluetoothAbstractService::~QBluetoothAbstractService ()   [virtual]

Destroys a Bluetooth service.

void QBluetoothAbstractService::authorizationFailed ()   [signal]

This signal will be emitted when the authorization request has denied.

See also authorizationSucceeded(), error(), and errorString().

void QBluetoothAbstractService::authorizationSucceeded ()   [signal]

This signal will be emitted when the authorization request has been granted.

See also authorizationFailed().

bool QBluetoothAbstractService::cancelAuthorization ( const QBluetoothAddress & remote, const QString & uuid = QString() )   [protected]

Cancel the previous authorization request. The remote and uuid parameters must match the parameters sent with the authorization request.

Returns true if the request could be canceled.

See also requestAuthorization() and authorizationFailed().

QString QBluetoothAbstractService::description () const

Returns the description for this service.

See also name() and displayName().

QString QBluetoothAbstractService::displayName () const

Returns the user-friendly, internationalized name for this service that can be displayed to the end user.

See also name() and description().

QBluetoothAbstractService::Error QBluetoothAbstractService::error () const   [protected]

Returns the last error that has occurred.

See also errorString().

QString QBluetoothAbstractService::errorString () const   [protected]

Returns an error message for the last error that has occurred.

See also error().

QString QBluetoothAbstractService::name () const

Returns the unique name that identifies this service.

See also displayName() and description().

quint32 QBluetoothAbstractService::registerRecord ( const QBluetoothSdpRecord & record )   [protected]

Registers the SDP service record record for this Bluetooth service and returns the service record handle of the newly registered service. Returns zero if the registration failed.

See also unregisterRecord() and updateRecord().

quint32 QBluetoothAbstractService::registerRecord ( const QString & filename )   [protected]

This is an overloaded member function, provided for convenience.

Uses the XML data from the file filename to register the SDP service record for this Bluetooth service and returns the service record handle of the newly registered service. Returns zero if the registration failed.

See Using a XML-formatted SDP record for details on how to generate a XML-formatted SDP reord.

Warning: The given file must be UTF-8 encoded to be parsed correctly.

See also unregisterRecord() and updateRecord().

bool QBluetoothAbstractService::requestAuthorization ( const QBluetoothAddress & remote, const QString & uuid = QString() )   [protected]

Request authorization for the use of this service by Bluetooth device with remote address. The uuid parameter can be used to identify the service (e.g. can be the UUID of the service as used in the SDP service record).

Returns true if the request could be started, and false otherwise.

See also authorizationSucceeded(), cancelAuthorization(), and authorizationFailed().

void QBluetoothAbstractService::setSecurityOptions ( QBluetooth::SecurityOptions options )   [pure virtual]

Sets the security options for this service to the given options.

This method will be called by Qt Extended when the security options should be changed.

Subclasses must override this to set the security options for this service.

void QBluetoothAbstractService::start ()   [pure virtual]

Starts this service.

This method will be called by Qt Extended when the service should be started. This may be because an external party has required that the service be started (for example, through QBluetoothServiceController, or through the Bluetooth Settings application) or because Qt Extended has been configured to start the service automatically.

Subclasses must override this to start the service appropriately. The subclass must emit started() when the service has started, or failed while trying to start, to announce the result of the start() invocation.

Warning: This function must be implementated in such a way that any intermediate objects (which have been created up to the point where the error occurred) are cleaned up before the error signal is emitted.

See also started() and stop().

void QBluetoothAbstractService::started ( bool error, const QString & description )   [signal]

When implementing the start() function, this signal must be emitted by the subclass when the service has started or failed while attempting to start, to announce the result of the start() invocation.

If the service failed to start, error should be true and description should be a human-readable description of the error. Otherwise, error should be false and description should be a null QString.

See also start() and stopped().

void QBluetoothAbstractService::stop ()   [pure virtual]

Stops this service.

This method will be called by Qt Extended when the service should be stopped.

Subclasses must override this to stop the service appropriately. The subclass must emit stopped() to announce that the service has stopped.

See also stopped() and start().

void QBluetoothAbstractService::stopped ()   [signal]

This signal must be emitted by the subclass inside the implementation of the stop() function, to announce that the service has stopped.

See also started() and stop().

bool QBluetoothAbstractService::unregisterRecord ( quint32 handle )   [protected]

Unregisters the SDP service record with the service record handle handle.

Returns whether the record was successfully unregistered.

See also registerRecord() and updateRecord().

bool QBluetoothAbstractService::updateRecord ( quint32 handle, const QBluetoothSdpRecord & record )   [protected]

Updates the already registered SDP service record with handle to the contents of the new record.

Returns true if the update succeeded, and false otherwise.

See also unregisterRecord() and registerRecord().

bool QBluetoothAbstractService::updateRecord ( quint32 handle, const QString & filename )   [protected]

This is an overloaded member function, provided for convenience.

Uses the XML data from the file filename to update the already registered SDP record with handle. Returns true if the update succeeded and false otherwise.

Warning: The given file must be UTF-8 encoded to be parsed correctly.

See also unregisterRecord() and registerRecord().

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtextended4.4
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web