Dokit
Internal development documentation
Loading...
Searching...
No Matches
abstractpokitservice.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2022-2024 Paul Colby <git@colby.id.au>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4/*!
5 * \file
6 * Declares the AbstractPokitService class.
7 */
8
9#ifndef QTPOKIT_ABSTRACTPOKITSERVICE_H
10#define QTPOKIT_ABSTRACTPOKITSERVICE_H
11
12#include "qtpokit_global.h"
13#include "pokitproducts.h"
14
15#include <QLowEnergyService>
16#include <QObject>
17
18#include <optional>
19
21
23
25
27{
28 Q_OBJECT
29
30public:
31 AbstractPokitService() = delete;
32 virtual ~AbstractPokitService();
33
34 virtual bool readCharacteristics() = 0;
35
36 bool autoDiscover() const;
37 void setAutoDiscover(const bool discover = true);
38
39 std::optional<PokitProduct> pokitProduct() const;
40 void setPokitProduct(const PokitProduct product);
41
42 QLowEnergyService * service();
43 const QLowEnergyService * service() const;
44
48
49protected:
50 /// \cond internal
51 AbstractPokitServicePrivate * d_ptr; ///< Internal d-pointer.
53 /// \endcond
54
55private:
56 Q_DECLARE_PRIVATE(AbstractPokitService)
58 friend class TestAbstractPokitService;
59};
60
62
63#endif // QTPOKIT_ABSTRACTPOKITSERVICE_H
The AbstractPokitServicePrivate class provides private implementation for AbstractPokitService.
The AbstractPokitService class provides a common base for Pokit services classes.
void serviceErrorOccurred(QLowEnergyService::ServiceError newError)
This signal is emitted whenever an error occurs on the underlying QLowEnergyService.
virtual bool readCharacteristics()=0
Read all characteristics.
AbstractPokitServicePrivate * d_ptr
Internal d-pointer.
void serviceDetailsDiscovered()
This signal is emitted when the Pokit service details have been discovered.
Declares the PokitProduct enumeration, and related helper functions.
QTPOKIT_EXPORT PokitProduct pokitProduct(const QBluetoothDeviceInfo &info)
Returns the PokitProduct corresponding the Bluetotoh device info.
PokitProduct
Pokit products known to, and supported by, the QtPokit library.
Q_DISABLE_COPY(Class)
Q_SIGNALSQ_SIGNALS
Global QtPokit library macros.
#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).