ButeoSynchronizationFramework
BtHelper.h
1 /*
2  * This file is part of buteo-syncfw package
3  *
4  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5  *
6  * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * version 2.1 as published by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  *
22  */
23 
24 #ifndef BTHELPER_H
25 #define BTHELPER_H
26 
27 #include <QObject>
28 #include <QtDBus>
29 #include <QMap>
30 
33 struct BT
34 {
36  static const QString BLUEZ_DEST;
38  static const QString BLUEZ_MANAGER_INTERFACE;
40  static const QString BLUEZ_ADAPTER_INTERFACE;
42  static const QString BLUEZ_DEVICE_INTERFACE;
44  static const QString GET_DEFAULT_ADAPTER;
46  static const QString FIND_DEVICE;
48  static const QString DISCOVERSERVICES;
50  static const QString GETPROPERTIES;
51 };
52 
55 class BtHelper : public QObject
56 {
57  Q_OBJECT
58 
59 private:
60  QString m_deviceAddress;
61 
62 // Private methods
63 
66  QString getDefaultAdapterPath();
67 
71  QString getDevicePath(QString& defaultAdapterPath);
72  /* \brief Open the serial port and get file descriptor for the port.
73  * \return File descriptor if opening port was success, otherwise -1
74  */
75 public:
80  BtHelper(const QString& deviceAddess, QObject* parent = 0);
81 
84  ~BtHelper();
85 
89  bool getServiceRecords(QList<QString>& servicesList);
94  bool isServiceSupported (const QList<QString>& servicesList, const QString& serviceUUID);
95 
99 };
100 
101 #endif // BTHELPER_H
static const QString BLUEZ_MANAGER_INTERFACE
Bluez manager interface name.
Definition: BtHelper.h:38
static const QString GET_DEFAULT_ADAPTER
Method name for retrieving default adapter.
Definition: BtHelper.h:44
static const QString DISCOVERSERVICES
Method name for discovering services.
Definition: BtHelper.h:48
static const QString BLUEZ_DEVICE_INTERFACE
Bluez Device interface name.
Definition: BtHelper.h:42
static const QString GETPROPERTIES
Method name for discovering services.
Definition: BtHelper.h:50
QMap< QString, QVariant > getDeviceProperties()
To find remote device BT properties.
Definition: BtHelper.cpp:140
static const QString FIND_DEVICE
Method name for finding the device.
Definition: BtHelper.h:46
static const QString BLUEZ_ADAPTER_INTERFACE
Bluez adapter interface name.
Definition: BtHelper.h:40
static const QString BLUEZ_DEST
Destination for Dbus command to bluez.
Definition: BtHelper.h:36
Strings used for DBus communication with bluetooth daemon are grouped using this structure.
Definition: BtHelper.h:33
BtHelper(const QString &deviceAddess, QObject *parent=0)
Constructor.
Definition: BtHelper.cpp:39
bool isServiceSupported(const QList< QString > &servicesList, const QString &serviceUUID)
To find if a specific service is supported by remote device.
Definition: BtHelper.cpp:52
Implementation for bluetooth helper utils.
Definition: BtHelper.h:55
bool getServiceRecords(QList< QString > &servicesList)
Fetch the bluetooth services supported by remote device.
Definition: BtHelper.cpp:110
Definition: SyncBackupAdaptor.h:41
~BtHelper()
Destructor.
Definition: BtHelper.cpp:45