• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

SolidModules

bluez-bluetoothinputdevice.cpp

Go to the documentation of this file.
00001 /*  This file is part of the KDE project
00002     Copyright (C) 2007 Will Stephenson <wstephenson@kde.org>
00003     Copyright (C) 2007 Daniel Gollub <dgollub@suse.de>
00004     Copyright (C) 2008 Tom Patzig <tpatzig@suse.de>
00005 
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License version 2 as published by the Free Software Foundation.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 
00021 */
00022 
00023 #include "bluez-bluetoothinputdevice.h"
00024 
00025 #include <QtDBus>
00026 
00027 #include <kdebug.h>
00028 
00029 BluezBluetoothInputDevice::BluezBluetoothInputDevice(const QString &objectPath) : BluetoothInputDevice(0), m_objectPath(objectPath)
00030 {
00031     device = new QDBusInterface("org.bluez", m_objectPath,
00032                                 "org.bluez.Input", QDBusConnection::systemBus());
00033     #define connectInputDeviceToThis(signal, slot) \
00034         device->connection().connect("org.bluez", \
00035             objectPath, \
00036             "org.bluez.Input", \
00037             signal, this, SLOT(slot))
00038     connectInputDeviceToThis("PropertyChanged",slotPropertyChanged(const QString &,const QDBusVariant &));
00039 
00040 }
00041 
00042 BluezBluetoothInputDevice::~BluezBluetoothInputDevice()
00043 {
00044     delete device;
00045 }
00046 
00047 QString BluezBluetoothInputDevice::ubi() const
00048 {
00049     return m_objectPath;
00050 }
00051 
00052 QMap<QString,QVariant> BluezBluetoothInputDevice::getProperties() const
00053 {
00054     QDBusReply< QMap<QString,QVariant> > path = device->call("GetProperties");
00055         if (!path.isValid())
00056         return QMap<QString,QVariant>();
00057 
00058     return path.value();
00059 }
00060 
00061 void BluezBluetoothInputDevice::disconnect()
00062 {
00063     device->call("Disconnect");
00064 }
00065 
00066 void BluezBluetoothInputDevice::connect()
00067 {
00068     device->call("Connect");
00069 }
00070 
00071 
00072 /******************************/
00073 
00074 QString BluezBluetoothInputDevice::stringReply(const QString &method) const
00075 {
00076     QDBusReply< QString > reply = device->call(method);
00077     if (!reply.isValid())
00078         return QString();
00079 
00080     return reply.value();
00081 }
00082 
00083 bool BluezBluetoothInputDevice::boolReply(const QString &method) const
00084 {
00085     QDBusReply< bool > reply = device->call(method);
00086     if (!reply.isValid())
00087         return false;
00088 
00089     return reply.value();
00090 }
00091 
00092 /******************************/
00093 
00094 void BluezBluetoothInputDevice::slotPropertyChanged(const QString & name, const QDBusVariant& value)
00095 {
00096     emit propertyChanged(name,value.variant());
00097 }
00098 
00099 #include "bluez-bluetoothinputdevice.moc"

SolidModules

Skip menu "SolidModules"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal