Dokit
Internal development documentation
Loading...
Searching...
No Matches
statusservice_p.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2022-2025 Paul Colby <git@colby.id.au>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4/*!
5 * \file
6 * Declares the StatusServicePrivate class.
7 */
8
9#ifndef QTPOKIT_STATUSSERVICE_P_H
10#define QTPOKIT_STATUSSERVICE_P_H
11
13
15
17
19{
21
22public:
24
26 static StatusService::Status parseStatus(const QByteArray &value);
27 static std::optional<StatusService::TorchStatus> parseTorchStatus(const QByteArray &value);
28 static std::optional<StatusService::ButtonStatus> parseButtonPress(const QByteArray &value);
29
30protected:
31 void serviceDiscovered(const QBluetoothUuid &newService) override;
32
33 void characteristicRead(const QLowEnergyCharacteristic &characteristic,
34 const QByteArray &value) override;
35 void characteristicWritten(const QLowEnergyCharacteristic &characteristic,
36 const QByteArray &newValue) override;
37
38private:
39 Q_DECLARE_PUBLIC(StatusService)
42};
43
45
46#endif // QTPOKIT_STATUSSERVICE_P_H
Declares the AbstractPokitServicePrivate class.
virtual void serviceDiscovered(const QBluetoothUuid &newService)
Handles QLowEnergyController::serviceDiscovered events.
AbstractPokitServicePrivate(const QBluetoothUuid &serviceUuid, QLowEnergyController *controller, AbstractPokitService *const q)
virtual void characteristicRead(const QLowEnergyCharacteristic &characteristic, const QByteArray &value)
Handles QLowEnergyService::characteristicRead events.
virtual void characteristicWritten(const QLowEnergyCharacteristic &characteristic, const QByteArray &newValue)
Handles QLowEnergyService::characteristicWritten events.
QLowEnergyController * controller
BLE controller to fetch the service from.
StatusServicePrivate(QLowEnergyController *controller, StatusService *const q)
static StatusService::Status parseStatus(const QByteArray &value)
Parses the Status value into a Status struct.
static StatusService::DeviceCharacteristics parseDeviceCharacteristics(const QByteArray &value)
Parses the Device Characteristics value into a DeviceCharacteristics struct.
static std::optional< StatusService::ButtonStatus > parseButtonPress(const QByteArray &value)
Parses the button press value, and returns the corresponding ButtonStatus.
static std::optional< StatusService::TorchStatus > parseTorchStatus(const QByteArray &value)
Parses the torch status value, and returns the corresponding TorchStatus.
The StatusService class accesses the Pokit Status service of Pokit devices.
Q_DISABLE_COPY(Class)
Q_OBJECTQ_OBJECT
#define QTPOKIT_BEFRIEND_TEST(Class)
Macro for befriending a related unit test class, but only when QT_TESTLIB_LIB is defined.
#define QTPOKIT_BEGIN_NAMESPACE
Macro for starting the QtPokit library's top-most namespace (if one is defined).
#define QTPOKIT_EXPORT
QtPokit library export/import macro.
#define QTPOKIT_END_NAMESPACE
Macro for ending the QtPokit library's top-most namespace (if one is defined).
Declares the StatusService class.
Attributes included in the Device Characteristics characterstic.
Attributes included in the Status characterstic.