1/*
2 * BluezQt - Asynchronous Bluez wrapper library
3 *
4 * SPDX-FileCopyrightText: 2019 Manuel Weichselbaumer <mincequi@web.de>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#include "gattcharacteristic_p.h"
10#include "gattservice.h"
11#include "utils.h"
12
13namespace BluezQt
14{
15GattCharacterisiticPrivate::GattCharacterisiticPrivate(const QString &uuid, const QStringList &flags, const GattService *service)
16 : m_uuid(uuid)
17 , m_service(service)
18 , m_notifying(false)
19 , m_flags(flags)
20{
21 static uint8_t charcNumber = 0;
22 m_objectPath.setPath(m_service->objectPath().path() + QStringLiteral("/char") + QString::number(charcNumber++));
23 m_dbusProperties = std::make_unique<DBusProperties>(args: Strings::orgBluez(), args: m_objectPath.path(), args: DBusConnection::orgBluez());
24
25 m_canNotify = flags.contains(str: QLatin1String("notify")) || flags.contains(str: QLatin1String("encrypt-notify"))
26 || flags.contains(str: QLatin1String("encrypt-authenticated-notify")) || flags.contains(str: QLatin1String("secure-notify"));
27}
28
29void GattCharacterisiticPrivate::emitPropertyChanged(QVariantMap updatedProperties)
30{
31 QDBusMessage signal = QDBusMessage::createSignal(path: m_objectPath.path(), interface: Strings::orgFreedesktopDBusProperties(), QStringLiteral("PropertiesChanged"));
32 signal << Strings::orgBluezGattCharacteristic1();
33 signal << updatedProperties;
34 signal << QStringList();
35 DBusConnection::orgBluez().send(message: signal);
36}
37
38} // namespace BluezQt
39

source code of bluez-qt/src/gattcharacteristic_p.cpp