1 /* This file is part of the KDE project
2 Copyright (C) 2007 Will Stephenson <wstephenson@kde.org>
3 Copyright (C) 2007 Daniel Gollub <dgollub@suse.de>
4 Copyright (C) 2008 Tom Patzig <tpatzig@suse.de>
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License version 2 as published by the Free Software Foundation.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
23 #ifndef SOLID_CONTROL_BLUETOOTHREMOTEDEVICE_H
24 #define SOLID_CONTROL_BLUETOOTHREMOTEDEVICE_H
26 #include <QtCore/QObject>
27 #include <QtCore/QStringList>
28 #include <QtCore/QMap>
29 #include <QtCore/QVariant>
31 #include "bluetoothmanager.h"
32 #include "bluetoothinterface.h"
40 class BluetoothRemoteDevicePrivate
;
42 * Represents a bluetooth remote device as seen by the bluetoothing subsystem.
44 class SOLIDCONTROL_EXPORT BluetoothRemoteDevice
: public QObject
47 Q_DECLARE_PRIVATE(BluetoothRemoteDevice
)
51 * Creates a new BluetoothRemoteDevice object.
53 * @param backendObject the bluetooth remote device object provided by the backend
55 BluetoothRemoteDevice(QObject
*backendObject
= 0);
58 * Constructs a copy of a bluetooth remote device.
60 * @param device the bluetooth remote device to copy
62 BluetoothRemoteDevice(const BluetoothRemoteDevice
&device
);
65 * Destroys the device.
67 ~BluetoothRemoteDevice();
70 * Assigns a bluetooth remote device to this bluetooth remote device and returns a reference to it.
72 * @param device the bluetooth remote device to assign
73 * @return a reference to the bluetooth remote device
75 BluetoothRemoteDevice
&operator=(const BluetoothRemoteDevice
&device
);
78 * Checks for equality.
79 * @param other the bluetooth remote device to compare with this
80 * @return true if this->ubi() equals other.ubi(), false otherwise
82 bool operator==(const BluetoothRemoteDevice
& other
) const;
85 * The UBI of the remote device.
90 * The address of the remote device.
95 * The name of the remote device.
100 * The icon of the remote device.
105 * The Trust state of the remote device.
110 * Set the Trust state of the remote device.
112 void setTrusted(bool);
115 * Returns the service uuids of the remote device.
120 * The Connection state of the remote device.
125 * Retrieve all properties from the remote device.
127 * @returns a hash of named properties
129 QMap
<QString
,QVariant
> getProperties();
132 * Discover all available Services from the remote Device.
133 * When the call is finished serviceDiscoverAvailable is thrown.
135 * @param pattern a service handle pattern to search for
137 void discoverServices(const QString
&pattern
);
140 * List all defined Nodes.
142 * @returns a List of ObjectPaths from all defined Nodes
144 QStringList
listNodes();
149 * Set a new Value for a named property.
151 * @param name the name of the property
152 * @param value the new value to be set
154 void setProperty(const QString
&name
, const QVariant
&value
);
157 * Cancel a started service Discovery.
159 void cancelDiscovery();
162 * Request a disconnect from the remote device.
169 * Search for services is done.
171 * @param status the result of the discovering.
172 * @param services the discovered Services.
174 void serviceDiscoverAvailable(const QString
&status
, const QMap
<uint
,QString
> &services
);
177 * A Property for the remote device has changed.
179 * @param name the name of the changed property
180 * @param value the new value
182 void propertyChanged(const QString
&name
, const QVariant
&value
);
185 * Disconnect to the remote device requested.
187 void disconnectRequested();
191 BluetoothRemoteDevicePrivate
*d_ptr
;
194 Q_PRIVATE_SLOT(d_func(), void _k_destroyed(QObject
*))
197 QVariant
getProperty(const QString
&key
);