libbluedevil v1.8
Public Slots | Signals | Public Member Functions | Properties | Friends

BlueDevil::Device Class Reference

#include <bluedevil/bluedevildevice.h>

Inheritance diagram for BlueDevil::Device:
QObject

List of all members.

Public Slots

bool registerDevice ()
void registerDeviceAsync ()
void setTrusted (bool trusted)
void setBlocked (bool blocked)
void setAlias (const QString &alias)
QUInt32StringMap discoverServices (const QString &pattern=QString())
void cancelDiscovery ()
void disconnect ()

Signals

void pairedChanged (bool paired)
void connectedChanged (bool connected)
void trustedChanged (bool trusted)
void blockedChanged (bool blocked)
void aliasChanged (const QString &alias)
void nameChanged (const QString &name)
void UUIDsChanged (const QStringList &UUIDs)
void propertyChanged (const QString &property, const QVariant &value)
void disconnectRequested ()
void registerDeviceResult (Device *device, bool deviceRegistered)
void UUIDsResult (Device *device, const QStringList &UUIDs)
void UBIResult (Device *device, const QString &UBI)
void isConnectedResult (Device *device, bool connected)
void isTrustedResult (Device *device, bool trusted)
void isBlockedResult (Device *device, bool blocked)
void discoverServicesResult (Device *device, const QUInt32StringMap &services)
void registered (Device *device)

Public Member Functions

virtual ~Device ()
void pair (const QString &agentPath, Adapter::RegisterCapability capability) const
Adapteradapter () const
QString address () const
QString name () const
QString friendlyName () const
QString icon () const
quint32 deviceClass () const
bool isPaired () const
bool isRegistered () const
QString alias () const
bool hasLegacyPairing () const
QStringList UUIDs ()
QString UBI ()
bool isConnected ()
bool isTrusted ()
bool isBlocked ()

Properties

Adapter adapter
QString address
QString name
QString friendlyName
QString icon
quint32 deviceClass
bool isPaired
bool isRegistered
QString alias
bool hasLegacyPairing
QStringList UUIDs
QString UBI
bool isConnected
bool trusted
bool blocked

Friends

class Adapter

Detailed Description

This class represents a remote device, discovered by an Adapter.

This device has some information for free (this meaning there is no need to register the device on the bus). This properties that do not need connection are explicitly marked on their respective documentation.

Since this values are cached, you will not get updates on their state until you make a call that forces the device to be registered on the bus (and thus, created, in D-Bus terminology), or you explicitly call to registerDevice.

After the Device has been registered, it will automatically update its properties internally, and additionally signals like pairedChanged will be emitted when this properties are updated.

Please note that since some functions here are blocking, there exists a way to asynchronous perform certain operations that are known to be expensive. This way your GUI will not block itself when waiting for a response from the remote device.

Author:
Rafael Fernández López <ereslibre@kde.org>

Constructor & Destructor Documentation

BlueDevil::Device::~Device ( ) [virtual]

Member Function Documentation

Adapter* BlueDevil::Device::adapter ( ) const
Returns:
The adapter that discovered this remote device.
QString BlueDevil::Device::address ( ) const
Returns:
The physical address of the remote device.
Note:
This request will not trigger a connection to the device.
QString BlueDevil::Device::alias ( ) const
Returns:
The alias of the remote device.
Note:
This request will not trigger a connection to the device.
void BlueDevil::Device::aliasChanged ( const QString alias) [signal]
void BlueDevil::Device::blockedChanged ( bool  blocked) [signal]
void BlueDevil::Device::cancelDiscovery ( ) [slot]

Cancels service discovery.

Note:
Allows being called with the asynchronous API through asyncCall.
void BlueDevil::Device::connectedChanged ( bool  connected) [signal]
quint32 BlueDevil::Device::deviceClass ( ) const
Returns:
The class of the remote device.
Note:
This request will not trigger a connection to the device.
void BlueDevil::Device::disconnect ( ) [slot]

Disconnect from this remote device.

Note:
Allows being called with the asynchronous API through asyncCall.
void BlueDevil::Device::disconnectRequested ( ) [signal]
QUInt32StringMap BlueDevil::Device::discoverServices ( const QString pattern = QString()) [slot]
Returns:
A map with all supported services by this device.
Note:
This request will trigger a connection to the device with the consequent registration on the bus.
Allows being called with the asynchronous API through asyncCall. discoverServicesResult signal will be emitted with the result.
void BlueDevil::Device::discoverServicesResult ( Device device,
const QUInt32StringMap services 
) [signal]
QString BlueDevil::Device::friendlyName ( ) const
Returns:
If there is any alias set, it returns the alias for this device along with its name in the form of "Alias (Name)". If no alias for this device was set, the name is directly returned.
Note:
If the name and the alias are the same, "Name" is returned instead of "Name (Name)".
This request will not trigger a connection to the device, unless the name couldn't yet be retrieved (is empty).
bool BlueDevil::Device::hasLegacyPairing ( ) const
Returns:
Whether this remote device supports legacy pairing or not.
Note:
This request will not trigger a connection to the device.
QString BlueDevil::Device::icon ( ) const
Returns:
The suggested icon for the remote device.
Note:
This request will not trigger a connection to the device.
bool BlueDevil::Device::isBlocked ( )
Returns:
Whether this remote device is blocked or not.
Note:
This request will trigger a connection to the device with the consequent registration on the bus.
Allows being called with the asynchronous API through asyncCall. isBlockedResult signal will be emitted with the result.
void BlueDevil::Device::isBlockedResult ( Device device,
bool  blocked 
) [signal]
bool BlueDevil::Device::isConnected ( )
Returns:
Whether this remote device is connected or not.
Note:
This request will trigger a connection to the device with the consequent registration on the bus.
Allows being called with the asynchronous API through asyncCall. isConnectedResult signal will be emitted with the result.
void BlueDevil::Device::isConnectedResult ( Device device,
bool  connected 
) [signal]
bool BlueDevil::Device::isPaired ( ) const
Returns:
Whether this remote device is paired or not.
Note:
This request will not trigger a connection to the device.
bool BlueDevil::Device::isRegistered ( ) const
Returns:
Whether the device is registered or not,
See also:
registerDevice
Note:
This request will not trigger a connection to the device
bool BlueDevil::Device::isTrusted ( )
Returns:
Whether this remote device is trusted or not.
Note:
This request will trigger a connection to the device with the consequent registration on the bus.
Allows being called with the asynchronous API through asyncCall. isTrustedResult signal will be emitted with the result.
void BlueDevil::Device::isTrustedResult ( Device device,
bool  trusted 
) [signal]
QString BlueDevil::Device::name ( ) const
Returns:
The name of the remote device.
Note:
This request will not trigger a connection to the device, unless the name couldn't yet be retrieved (is empty).
void BlueDevil::Device::nameChanged ( const QString name) [signal]
void BlueDevil::Device::pair ( const QString agentPath,
Adapter::RegisterCapability  capability 
) const

Starts the pairing process, the pairedChanged signal will be emitted if succeeded.

Parameters:
agentPathThe path where the agent has been registered.
capabilityThe same capability attribute set when registering the agent with registerAgent.
Note:
If the device is registered moments before this function is called, then it might do not work in some devices.
void BlueDevil::Device::pairedChanged ( bool  paired) [signal]
void BlueDevil::Device::propertyChanged ( const QString property,
const QVariant value 
) [signal]
bool BlueDevil::Device::registerDevice ( ) [slot]

It is not mandatory to call to this method. If you are just retrieving some information that will not trigger a connection to the device, and you do not need to check if some properties were updated, please do not call to this method, since it is expensive (it will force a registration of the device on the bus).

On the other hand, if what you want is to receive signals of properties being updated and you have not called a method that triggers a connection to the device, you should explicitly call to this method, so the device is registered.

Returns:
Whether it was possible to correctly register this remote device on the bus.
Note:
Allows being called with the asynchronous API through asyncCall. registerDeviceResult signal will be emitted with the result.
void BlueDevil::Device::registerDeviceAsync ( ) [slot]

This is like registerDevice method but instead of returning bool to indicate wether the registration has succeed or not, this method will emit a registered signal.

See also:
registerDevice
void BlueDevil::Device::registerDeviceResult ( Device device,
bool  deviceRegistered 
) [signal]
void BlueDevil::Device::registered ( Device device) [signal]
void BlueDevil::Device::setAlias ( const QString alias) [slot]

Sets the alias of the remote device.

Note:
This request will trigger a connection to the device with the consequent registration on the bus.
Allows being called with the asynchronous API through asyncCall.
void BlueDevil::Device::setBlocked ( bool  blocked) [slot]

Sets whether this remote device is blocked or not.

Note:
This request will trigger a connection to the device with the consequent registration on the bus.
Allows being called with the asynchronous API through asyncCall.
void BlueDevil::Device::setTrusted ( bool  trusted) [slot]

Sets whether this remote device is trusted or not.

Note:
This request will trigger a connection to the device with the consequent registration on the bus.
Allows being called with the asynchronous API through asyncCall.
void BlueDevil::Device::trustedChanged ( bool  trusted) [signal]
QString BlueDevil::Device::UBI ( )
Returns:
UBI for this device. In case that the connection with the device fails, an empty string will be returned.
Note:
This request will trigger a connection to the device with the consequent registration on the bus.
Allows being called with the asynchronous API through asyncCall. UBIResult signal will be emitted with the result.
void BlueDevil::Device::UBIResult ( Device device,
const QString UBI 
) [signal]
QStringList BlueDevil::Device::UUIDs ( )
Returns:
The list of supported services by the remote device always in uppercase.
Note:
This request will trigger a connection to the device with the consequent registration on the bus.
Allows being called with the asynchronous API through asyncCall. UUIDsResult signal will be emitted with the result.
void BlueDevil::Device::UUIDsChanged ( const QStringList UUIDs) [signal]
void BlueDevil::Device::UUIDsResult ( Device device,
const QStringList UUIDs 
) [signal]

Friends And Related Function Documentation

friend class Adapter [friend]

Property Documentation

Adapter * BlueDevil::Device::adapter [read]
QString BlueDevil::Device::address [read]
QString BlueDevil::Device::alias [read, write]
bool BlueDevil::Device::blocked [read, write]
quint32 BlueDevil::Device::deviceClass [read]
QString BlueDevil::Device::friendlyName [read]
bool BlueDevil::Device::hasLegacyPairing [read]
QString BlueDevil::Device::icon [read]
bool BlueDevil::Device::isConnected [read]
bool BlueDevil::Device::isPaired [read]
bool BlueDevil::Device::isRegistered [read]
QString BlueDevil::Device::name [read]
bool BlueDevil::Device::trusted [read, write]
QString BlueDevil::Device::UBI [read]
QStringList BlueDevil::Device::UUIDs [read]
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Friends