summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycharacteristic.h
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-06-19 17:43:31 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-06-20 16:55:25 +0200
commit171468d407137ff48dcff19eafeb632635882495 (patch)
tree144ffcc7c8243160fba1057426cc05efc3f8f45c /src/bluetooth/qlowenergycharacteristic.h
parent9b20cee51a6dd3f51383f40f1c0c3d81616f098d (diff)
First pass on an updated QLowEnergyCharacteristic class
This patch creates QLECharacteristic based on the old QLECharacteristicInfo class. Some details have been removed since they no longer apply and the class has been integrated into QLEService QLEControllerNew and its data store. This is still work in progress and the unit tests must still be modified but it's already functional. Change-Id: Id80c4f01fffd77cd225b49753c74c3336f8e127e Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Diffstat (limited to 'src/bluetooth/qlowenergycharacteristic.h')
-rw-r--r--src/bluetooth/qlowenergycharacteristic.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergycharacteristic.h b/src/bluetooth/qlowenergycharacteristic.h
new file mode 100644
index 00000000..7dc91f43
--- /dev/null
+++ b/src/bluetooth/qlowenergycharacteristic.h
@@ -0,0 +1,104 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 BlackBerry Limited all rights reserved
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QLOWENERGYCHARACTERISTIC_H
+#define QLOWENERGYCHARACTERISTIC_H
+#include <QtCore/QSharedPointer>
+#include <QtCore/QObject>
+#include <QtBluetooth/qbluetooth.h>
+#include <QtBluetooth/QBluetoothUuid>
+#include <QtBluetooth/QLowEnergyDescriptorInfo>
+
+QT_BEGIN_NAMESPACE
+
+class QBluetoothUuid;
+class QLowEnergyServicePrivate;
+struct QLowEnergyCharacteristicPrivate;
+class Q_BLUETOOTH_EXPORT QLowEnergyCharacteristic
+{
+public:
+
+ enum PropertyType {
+ Unknown = 0x00,
+ Broadcasting = 0x01,
+ Read = 0x02,
+ WriteNoResponse = 0x04,
+ Write = 0x08,
+ Notify = 0x10,
+ Indicate = 0x20,
+ WriteSigned = 0x40,
+ ExtendedProperty = 0x80
+ };
+ Q_DECLARE_FLAGS(PropertyTypes, PropertyType)
+
+ QLowEnergyCharacteristic();
+ QLowEnergyCharacteristic(const QLowEnergyCharacteristic &other);
+ ~QLowEnergyCharacteristic();
+
+ QLowEnergyCharacteristic &operator=(const QLowEnergyCharacteristic &other);
+
+ QString name() const;
+
+ QBluetoothUuid uuid() const;
+
+ void setValue(const QByteArray &value); //TODO shift to QLowEnergyControllerNew
+ QByteArray value() const;
+
+ QLowEnergyCharacteristic::PropertyTypes properties() const;
+ QLowEnergyHandle handle() const;
+
+ QList<QLowEnergyDescriptorInfo> descriptors() const;
+
+ bool isValid() const;
+
+protected:
+ QSharedPointer<QLowEnergyServicePrivate> d_ptr;
+ QLowEnergyCharacteristicPrivate *data;
+ QLowEnergyCharacteristic(QSharedPointer<QLowEnergyServicePrivate> p,
+ QLowEnergyHandle handle);
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QLowEnergyCharacteristic::PropertyTypes)
+
+QT_END_NAMESPACE
+
+#endif // QLOWENERGYCHARACTERISTIC_H