QtPokit
Native Qt library for Pokit devices
abstractpokitservice.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 AbstractPokitService class.
7 */
8
9#ifndef QTPOKIT_ABSTRACTPOKITSERVICE_H
10#define QTPOKIT_ABSTRACTPOKITSERVICE_H
11
12#include "qtpokit_global.h"
13
14#include <QLowEnergyService>
15#include <QObject>
16
18
19QTPOKIT_BEGIN_NAMESPACE
20
21class AbstractPokitServicePrivate;
22
23class QTPOKIT_EXPORT AbstractPokitService : public QObject
24{
25 Q_OBJECT
26
27public:
28 AbstractPokitService() = delete;
29 virtual ~AbstractPokitService();
30
31 virtual bool readCharacteristics() = 0;
32
33 bool autoDiscover() const;
34 void setAutoDiscover(const bool discover = true);
35
36 QLowEnergyService * service();
37 const QLowEnergyService * service() const;
38
39signals:
41 void serviceErrorOccurred(QLowEnergyService::ServiceError newError);
42
43protected:
44 /// \cond internal
45 AbstractPokitServicePrivate * d_ptr; ///< Internal d-pointer.
46 AbstractPokitService(AbstractPokitServicePrivate * const d, QObject * const parent);
47 /// \endcond
48
49private:
50 Q_DECLARE_PRIVATE(AbstractPokitService)
51 Q_DISABLE_COPY(AbstractPokitService)
52 friend class TestAbstractPokitService;
53};
54
55QTPOKIT_END_NAMESPACE
56
57#endif // QTPOKIT_ABSTRACTPOKITSERVICE_H
The AbstractPokitService class provides a common base for Pokit services classes.
Definition: abstractpokitservice.h:24
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.
Global QtPokit library macros.