QtPokit
Native Qt library for Pokit devices
Loading...
Searching...
No Matches
deviceinfoservice.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2022 Paul Colby <git@colby.id.au>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4/*!
5 * \file
6 * Declares the DeviceInfoService class.
7 */
8
9#ifndef QTPOKIT_INFOSERVICE_H
10#define QTPOKIT_INFOSERVICE_H
11
13
14#include <QBluetoothAddress>
15#include <QBluetoothUuid>
16#include <QVersionNumber>
17
18QTPOKIT_BEGIN_NAMESPACE
19
20class DeviceInfoServicePrivate;
21
22class QTPOKIT_EXPORT DeviceInfoService : public AbstractPokitService
23{
24 Q_OBJECT
25
26public:
28
29 struct QTPOKIT_EXPORT CharacteristicUuids {
35 };
36
37 DeviceInfoService(QLowEnergyController * const pokitDevice, QObject * parent = nullptr);
38 ~DeviceInfoService() override;
39
40 bool readCharacteristics() override;
41 bool readFirmwareRevisionCharacteristic();
42 bool readHardwareRevisionCharacteristic();
43 bool readManufacturerCharacteristics();
44 bool readModelNumberCharacteristic();
45 bool readSoftwareRevisionCharacteristic();
46
47 // All Device Info characteristics are read-only, single values.
48 QString manufacturer() const;
49 QString modelNumber() const;
50 QString hardwareRevision() const;
51 QString firmwareRevision() const;
52 QString softwareRevision() const;
53
54signals:
55 void manufacturerRead(const QString &name);
56 void modelNumberRead(const QString &model);
57 void hardwareRevisionRead(const QString &revision);
58 void firmwareRevisionRead(const QString &revision);
59 void softwareRevisionRead(const QString &revision);
60
61protected:
62 /// \cond internal
63 DeviceInfoService(DeviceInfoServicePrivate * const d, QObject * const parent);
64 /// \endcond
65
66private:
67 Q_DECLARE_PRIVATE(DeviceInfoService)
68 Q_DISABLE_COPY(DeviceInfoService)
69 friend class TestDeviceInfoService;
70};
71
72QTPOKIT_END_NAMESPACE
73
74#endif // QTPOKIT_INFOSERVICE_H
Declares the AbstractPokitService class.
The AbstractPokitService class provides a common base for Pokit services classes.
Definition: abstractpokitservice.h:24
virtual bool readCharacteristics()=0
Read all characteristics.
The DeviceInfoService class accesses the Device Info service of Pokit devices.
Definition: deviceinfoservice.h:23
void hardwareRevisionRead(const QString &revision)
This signal is emitted when the Hardware Revision characteristic has been read successfully.
static const QBluetoothUuid serviceUuid
UUID of the "Device Info" service.
Definition: deviceinfoservice.h:27
void firmwareRevisionRead(const QString &revision)
This signal is emitted when the Firmware Revision characteristic has been read successfully.
void softwareRevisionRead(const QString &revision)
This signal is emitted when the Software Revision characteristic has been read successfully.
void modelNumberRead(const QString &model)
This signal is emitted when the Model Number characteristic has been read successfully.
void manufacturerRead(const QString &name)
This signal is emitted when the Manufacturer Name characteristic has been read successfully.
Characteristics available via the Device Info service.
Definition: deviceinfoservice.h:29
static const QBluetoothUuid manufacturerName
UUID of the Device Info service's xxx characterstic.
Definition: deviceinfoservice.h:30
static const QBluetoothUuid hardwareRevision
UUID of the Device Info service's xxx characterstic.
Definition: deviceinfoservice.h:32
static const QBluetoothUuid softwareRevision
UUID of the Device Info service's xxx characterstic.
Definition: deviceinfoservice.h:34
static const QBluetoothUuid firmwareRevision
UUID of the Device Info service's xxx characterstic.
Definition: deviceinfoservice.h:33
static const QBluetoothUuid modelNumber
UUID of the Device Info service's xxx characterstic.
Definition: deviceinfoservice.h:31