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

QBluetoothPasskeyAgent Class Reference
[QtBluetoothModule]

The QBluetoothPasskeyAgent class represents a passkey entry proxy. More...

    #include <QBluetoothPasskeyAgent>

Inherits QObject.

Public Types

Public Functions

Protected Functions

Additional Inherited Members


Detailed Description

The QBluetoothPasskeyAgent class represents a passkey entry proxy.

The QBluetoothPasskeyAgent class provides an abstract interface for requesting and providing passkeys to the bluetooth system whenever a new pairing procedure is initiated. It is up to the clients to actually establish how the passkey is obtained. For instance, the client could ask the user, or read passkeys from a file, or by presenting the user with a dialog box, or in some other fashion.

The passkey agent can be registered as a global default, a default for a particular local bluetooth adapter, or just for a specific remote device.

See also QBluetoothAddress, QBluetoothLocalDevice, and QBluetoothPasskeyRequest.


Member Type Documentation

enum QBluetoothPasskeyAgent::Error

Possible errors that might occur.

ConstantValueDescription
QBluetoothPasskeyAgent::NoError0No error.
QBluetoothPasskeyAgent::AlreadyExists1Another passkey agent has already been registered.
QBluetoothPasskeyAgent::DoesNotExist2The passkey agent has not been registered.
QBluetoothPasskeyAgent::UnknownAddress3The address of the remote device is unknown.
QBluetoothPasskeyAgent::UnknownError4An unknown error has occurred.


Member Function Documentation

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

Constructs a passkey agent. The name parameter specifies a unique name of the passkey agent. The name should be a valid identifier name, e.g. it cannot contain special characters or start with a number. For instance: DefaultPasskeyAgent.

The parent parameter holds the QObject parent.

QBluetoothPasskeyAgent::~QBluetoothPasskeyAgent ()   [virtual]

Destroys the passkey agent.

void QBluetoothPasskeyAgent::cancelRequest ( const QString & localDevice, const QBluetoothAddress & remoteAddr )   [virtual protected]

This function will be called whenever a passkey authentication request has failed.

The request being cancelled is on localDevice and the address of the paired device is remoteAddr. The localDevice is of the form hciX, and can be used to construct a QBluetoothLocalDevice object.

See also confirmPasskey() and requestPasskey().

bool QBluetoothPasskeyAgent::confirmPasskey ( const QString & localDevice, const QBluetoothAddress & remoteAddr, const QString & passkey )   [virtual protected]

This function will be called whenever a passkey needs to be confirmed by the user. The request came in on localDevice and the address of the paired device is remoteAddr. The localDevice is of the form hciX, and can be used to construct a QBluetoothLocalDevice object. The passkey contains the passkey that should be confirmed.

The method should return true if the passkeys match, and false otherwise.

See also requestPasskey() and cancelRequest().

QBluetoothPasskeyAgent::Error QBluetoothPasskeyAgent::error () const

Returns the last error that has occurred.

QString QBluetoothPasskeyAgent::name () const

Returns the name of the passkey agent as a string.

bool QBluetoothPasskeyAgent::registerDefault ()

Register the passkey agent as the default agent for all local devices.

Returns true if the agent could be registered successfully, and false otherwise. If the call fails, the error can be obtained by calling error().

See also unregisterDefault() and error().

bool QBluetoothPasskeyAgent::registerDefault ( const QString & localDevice )

This is an overloaded member function, provided for convenience.

Register the passkey agent as the default agent for device given by localDevice. The localDevice is of the form hciX, and can be used to construct a QBluetoothLocalDevice object.

Returns true if the agent could be registered successfully, and false otherwise. If the call fails, the error can be obtained by calling error().

See also unregisterDefault() and error().

bool QBluetoothPasskeyAgent::registerForAddress ( QBluetoothAddress & addr )

Register the passkey agent for all local devices. It will only handle pairing requests associated with remote device which is given in addr.

Note that once pairing is complete, or a timeout has been hit, the agent will be automatically unregistered. The release() method will be called. It is up to the application to register the agent again.

Returns true if the agent could be registered successfully, and false otherwise. If the call fails, the error can be obtained by calling error().

See also unregisterForAddress() and error().

bool QBluetoothPasskeyAgent::registerForAddress ( const QString & localDevice, QBluetoothAddress & addr )

This is an overloaded member function, provided for convenience.

Register the passkey agent for local device represented by localDevice. The localDevice is of the form hciX, and can be used to construct a QBluetoothLocalDevice object. It will only handle pairing requests associated with remote device which is given in addr.

Note that once pairing is complete, or a timeout has been hit, the agent will be automatically unregistered. The release() method will be called. It is up to the application to register the agent again.

Returns true if the agent could be registered successfully, and false otherwise. If the call fails, the error can be obtained by calling error().

See also unregisterForAddress() and error().

void QBluetoothPasskeyAgent::release ()   [virtual protected]

This function will be called whenever a passkey agent has been unregistered.

See also unregisterDefault() and unregisterForAddress().

void QBluetoothPasskeyAgent::requestPasskey ( QBluetoothPasskeyRequest & request )   [pure virtual protected]

This virtual function will be called whenever the bluetooth system has received a request for a passkey, and the agent is registered to handle the particular request.

The request parameter contains the passkey request. Please see the QBluetoothPasskeyRequest documentation for more details on how to handle the request.

See also confirmPasskey() and cancelRequest().

bool QBluetoothPasskeyAgent::unregisterDefault ()

Unregister the passkey agent as the default agent for all local devices.

Returns true if the agent could be unregistered successfully, and false otherwise. If the call fails, the error can be obtained by calling error().

See also registerDefault() and error().

bool QBluetoothPasskeyAgent::unregisterDefault ( const QString & localDevice )

This is an overloaded member function, provided for convenience.

Unregister the passkey agent as the default agent for device given by localDevice. The localDevice is of the form hciX, and can be used to construct a QBluetoothLocalDevice object.

Returns true if the agent could be unregistered successfully, and false otherwise. If the call fails, the error can be obtained by calling error().

See also registerDefault() and error().

bool QBluetoothPasskeyAgent::unregisterForAddress ( QBluetoothAddress & addr )

Unregister the passkey agent for all local devices. This method attempts to unregister an agent that would have only handled pairing requests associated with remote device at address addr.

Returns true if the agent could be unregistered successfully, and false otherwise. If the call fails, the error can be obtained by calling error().

See also registerForAddress() and error().

bool QBluetoothPasskeyAgent::unregisterForAddress ( const QString & localDevice, QBluetoothAddress & addr )

This is an overloaded member function, provided for convenience.

Unregister the passkey agent for local device localDevice. The localDevice is of the form hciX, and can be used to construct a QBluetoothLocalDevice object. This method attempts to unregister an agent that would have only handled pairing requests associated with remote device at address addr.

Returns true if the agent could be unregistered successfully, and false otherwise. If the call fails, the error can be obtained by calling error().

See also registerForAddress() and error().


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3