Dokit
Native Qt library for Pokit devices
Loading...
Searching...
No Matches
abstractpokitservice.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2022-2023 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
19
20QTPOKIT_BEGIN_NAMESPACE
21
22class AbstractPokitServicePrivate;
23
24class QTPOKIT_EXPORT AbstractPokitService : public QObject
25{
26 Q_OBJECT
27
28public:
29 AbstractPokitService() = delete;
30 virtual ~AbstractPokitService();
31
32 virtual bool readCharacteristics() = 0;
33
34 bool autoDiscover() const;
35 void setAutoDiscover(const bool discover = true);
36
38 void setPokitProduct(const PokitProduct product);
39
40 QLowEnergyService * service();
41 const QLowEnergyService * service() const;
42
43signals:
46
47protected:
48 /// \cond internal
49 AbstractPokitServicePrivate * d_ptr; ///< Internal d-pointer.
50 AbstractPokitService(AbstractPokitServicePrivate * const d, QObject * const parent);
51 /// \endcond
52
53private:
54 Q_DECLARE_PRIVATE(AbstractPokitService)
56 friend class TestAbstractPokitService;
57};
58
59QTPOKIT_END_NAMESPACE
60
61#endif // QTPOKIT_ABSTRACTPOKITSERVICE_H
The AbstractPokitService class provides a common base for Pokit services classes.
Definition abstractpokitservice.h:25
virtual bool readCharacteristics()=0
Read all characteristics.
void serviceErrorOccurred(QLowEnergyService::ServiceError newError)
This signal is emitted whenever an error occurs on the underlying QLowEnergyService.
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.
Definition pokitproducts.cpp:55
PokitProduct
Pokit products known to, and supported by, the QtPokit library.
Definition pokitproducts.h:21
Q_DISABLE_COPY(Class)
Global QtPokit library macros.