1 /* This file is part of the KDE project
2 Copyright (C) 2006 Will Stephenson <wstephenson@kde.org>
3 Copyright (C) 2007 Daniel Gollub <dgollub@suse.de>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
23 #include <QStringList>
25 #include <solid/control/ifaces/bluetoothremotedevice.h>
27 #include "frontendobject_p.h"
29 #include "soliddefs_p.h"
30 #include "bluetoothmanager.h"
31 #include "bluetoothinterface.h"
37 class BluetoothRemoteDevicePrivate
: public FrontendObjectPrivate
40 BluetoothRemoteDevicePrivate(QObject
*parent
)
41 : FrontendObjectPrivate(parent
) { }
43 void setBackendObject(QObject
*object
);
48 Solid::Control::BluetoothRemoteDevice::BluetoothRemoteDevice(QObject
*backendObject
)
49 : QObject(), d_ptr(new BluetoothRemoteDevicePrivate(this))
51 Q_D(BluetoothRemoteDevice
);
52 d
->setBackendObject(backendObject
);
55 Solid::Control::BluetoothRemoteDevice::BluetoothRemoteDevice(const BluetoothRemoteDevice
&device
)
56 : QObject(), d_ptr(new BluetoothRemoteDevicePrivate(this))
58 Q_D(BluetoothRemoteDevice
);
59 d
->setBackendObject(device
.d_ptr
->backendObject());
62 Solid::Control::BluetoothRemoteDevice::~BluetoothRemoteDevice()
65 Solid::Control::BluetoothRemoteDevice
&Solid::Control::BluetoothRemoteDevice::operator=(const Solid::Control::BluetoothRemoteDevice
& dev
)
67 Q_D(BluetoothRemoteDevice
);
68 d
->setBackendObject(dev
.d_ptr
->backendObject());
73 bool Solid::Control::BluetoothRemoteDevice::operator==(const BluetoothRemoteDevice
& other
) const
75 return ubi() == other
.ubi();
78 QString
Solid::Control::BluetoothRemoteDevice::ubi() const
80 Q_D(const BluetoothRemoteDevice
);
81 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), QString(), ubi());
84 QString
Solid::Control::BluetoothRemoteDevice::address() const
86 Q_D(const BluetoothRemoteDevice
);
87 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), QString(), address());
90 bool Solid::Control::BluetoothRemoteDevice::isConnected() const
92 Q_D(const BluetoothRemoteDevice
);
93 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), false, isConnected());
96 QString
Solid::Control::BluetoothRemoteDevice::version() const
98 Q_D(const BluetoothRemoteDevice
);
99 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), QString(), version());
102 QString
Solid::Control::BluetoothRemoteDevice::revision() const
104 Q_D(const BluetoothRemoteDevice
);
105 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), QString(), revision());
108 QString
Solid::Control::BluetoothRemoteDevice::manufacturer() const
110 Q_D(const BluetoothRemoteDevice
);
111 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), QString(), manufacturer());
114 QString
Solid::Control::BluetoothRemoteDevice::company() const
116 Q_D(const BluetoothRemoteDevice
);
117 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), QString(), company());
120 QString
Solid::Control::BluetoothRemoteDevice::majorClass() const
122 Q_D(const BluetoothRemoteDevice
);
123 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), QString(), majorClass());
126 QString
Solid::Control::BluetoothRemoteDevice::minorClass() const
128 Q_D(const BluetoothRemoteDevice
);
129 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), QString(), minorClass());
132 QStringList
Solid::Control::BluetoothRemoteDevice::serviceClasses() const
134 Q_D(const BluetoothRemoteDevice
);
135 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), QStringList(), serviceClasses());
137 QString
Solid::Control::BluetoothRemoteDevice::name() const
139 Q_D(const BluetoothRemoteDevice
);
140 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), QString(), name());
143 QString
Solid::Control::BluetoothRemoteDevice::alias() const
145 Q_D(const BluetoothRemoteDevice
);
146 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), QString(), alias());
149 QString
Solid::Control::BluetoothRemoteDevice::lastSeen() const
151 Q_D(const BluetoothRemoteDevice
);
152 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), QString(), lastSeen());
155 QString
Solid::Control::BluetoothRemoteDevice::lastUsed() const
157 Q_D(const BluetoothRemoteDevice
);
158 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), QString(), lastUsed());
161 bool Solid::Control::BluetoothRemoteDevice::hasBonding() const
163 Q_D(const BluetoothRemoteDevice
);
164 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), false, hasBonding());
167 int Solid::Control::BluetoothRemoteDevice::pinCodeLength() const
169 Q_D(const BluetoothRemoteDevice
);
170 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), 0, pinCodeLength());
173 int Solid::Control::BluetoothRemoteDevice::encryptionKeySize() const
175 Q_D(const BluetoothRemoteDevice
);
176 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), 0, encryptionKeySize());
179 KJob
*Solid::Control::BluetoothRemoteDevice::createBonding()
181 Q_D(BluetoothRemoteDevice
);
182 return_SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), 0, createBonding());
185 void Solid::Control::BluetoothRemoteDevice::setAlias(const QString
&alias
)
187 Q_D(BluetoothRemoteDevice
);
188 SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), setAlias(alias
));
191 void Solid::Control::BluetoothRemoteDevice::clearAlias()
193 Q_D(BluetoothRemoteDevice
);
194 SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), clearAlias());
197 void Solid::Control::BluetoothRemoteDevice::disconnect()
199 Q_D(BluetoothRemoteDevice
);
200 SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), disconnect());
203 void Solid::Control::BluetoothRemoteDevice::cancelBondingProcess()
205 Q_D(BluetoothRemoteDevice
);
206 SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), cancelBondingProcess());
209 void Solid::Control::BluetoothRemoteDevice::removeBonding()
211 Q_D(const BluetoothRemoteDevice
);
212 SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), removeBonding());
214 void Solid::Control::BluetoothRemoteDevice::serviceHandles(const QString
&filter
) const
216 Q_D(const BluetoothRemoteDevice
);
217 SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), serviceHandles(filter
));
220 void Solid::Control::BluetoothRemoteDevice::serviceRecordAsXml(uint handle
) const
222 Q_D(const BluetoothRemoteDevice
);
223 SOLID_CALL(Ifaces::BluetoothRemoteDevice
*, d
->backendObject(), serviceRecordAsXml(handle
));
226 void Solid::Control::BluetoothRemoteDevicePrivate::setBackendObject(QObject
*object
)
228 FrontendObjectPrivate::setBackendObject(object
);
231 QObject::connect(object
, SIGNAL(classChanged(uint
)),
232 parent(), SIGNAL(classChanged(uint
)));
233 QObject::connect(object
, SIGNAL(nameChanged(const QString
&)),
234 parent(), SIGNAL(nameChanged(const QString
&)));
235 QObject::connect(object
, SIGNAL(nameResolvingFailed()),
236 parent(), SIGNAL(nameResolvingFailed()));
237 QObject::connect(object
, SIGNAL(aliasChanged(const QString
&)),
238 parent(), SIGNAL(aliasChanged(const QString
&)));
239 QObject::connect(object
, SIGNAL(aliasCleared()),
240 parent(), SIGNAL(aliasCleared()));
241 QObject::connect(object
, SIGNAL(connected()),
242 parent(), SIGNAL(connected()));
243 QObject::connect(object
, SIGNAL(requestDisconnection()),
244 parent(), SIGNAL(requestDisconnection()));
245 QObject::connect(object
, SIGNAL(disconnected()),
246 parent(), SIGNAL(disconnected()));
247 QObject::connect(object
, SIGNAL(bondingCreated()),
248 parent(), SIGNAL(bondingCreated()));
249 QObject::connect(object
, SIGNAL(bondingRemoved()),
250 parent(), SIGNAL(bondingRemoved()));
251 QObject::connect(object
, SIGNAL(serviceHandlesAvailable(const QString
&, const QList
<uint
> &)),
252 parent(), SIGNAL(serviceHandlesAvailable(const QString
&, const QList
<uint
> &)));
253 QObject::connect(object
, SIGNAL(serviceRecordXmlAvailable(const QString
&, const QString
&)),
254 parent(), SIGNAL(serviceRecordXmlAvailable(const QString
&, const QString
&)));
259 #include "bluetoothremotedevice.moc"