Line data Source code
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 PokitDevicePrivate class.
7 : */
8 :
9 : #ifndef QTPOKIT_POKITDEVICE_P_H
10 : #define QTPOKIT_POKITDEVICE_P_H
11 :
12 : #include <qtpokit/qtpokit_global.h>
13 :
14 : #include <QLoggingCategory>
15 : #include <QLowEnergyController>
16 : #include <QLowEnergyConnectionParameters>
17 : #include <QMutex>
18 : #include <QObject>
19 :
20 : QTPOKIT_BEGIN_NAMESPACE
21 :
22 : class CalibrationService;
23 : class DataLoggerService;
24 : class DeviceInfoService;
25 : class DsoService;
26 : class MultimeterService;
27 : class StatusService;
28 :
29 : class PokitDevice;
30 :
31 : class QTPOKIT_EXPORT PokitDevicePrivate : public QObject
32 : {
33 240 : Q_OBJECT
34 0 :
35 0 : public:
36 8656 : static Q_LOGGING_CATEGORY(lc, "pokit.ble.controller", QtInfoMsg); ///< Logging category.
37 0 :
38 0 : QLowEnergyController * controller { nullptr }; ///< BLE controller for accessing the Pokit device.
39 0 :
40 0 : CalibrationService * calibration { nullptr }; ///< Calibration service for this Pokit device.
41 0 : DataLoggerService * dataLogger { nullptr }; ///< Data Logger service for this Pokit device.
42 0 : DeviceInfoService * deviceInfo { nullptr }; ///< Device Info service for this Pokit device.
43 0 : DsoService * dso { nullptr }; ///< DSO service for this Pokit device.
44 0 : MultimeterService * multimeter { nullptr }; ///< Multimeter service for this Pokit device.
45 0 : StatusService * status { nullptr }; ///< Status service for this Pokit device.
46 0 :
47 0 : QMutex calibrationMutex; ///< Mutex for protecting access to #calibration.
48 0 : QMutex dataLoggerMutex; ///< Mutex for protecting access to #dataLogger.
49 0 : QMutex deviceInfoMutex; ///< Mutex for protecting access to #deviceInfo.
50 0 : QMutex dsoMutex; ///< Mutex for protecting access to #dso.
51 0 : QMutex multimeterMutex; ///< Mutex for protecting access to #multimeter.
52 0 : QMutex statusMutex; ///< Mutex for protecting access to #status.
53 0 :
54 0 : explicit PokitDevicePrivate(PokitDevice * const q);
55 0 :
56 0 : void setController(QLowEnergyController * newController);
57 0 :
58 0 : public Q_SLOTS:
59 0 : void connected() const;
60 0 : void connectionUpdated(const QLowEnergyConnectionParameters &newParameters) const;
61 0 : void disconnected() const;
62 0 : void discoveryFinished() const;
63 0 : void errorOccurred(QLowEnergyController::Error newError) const;
64 0 : void serviceDiscovered(const QBluetoothUuid &newService) const;
65 0 : void stateChanged(QLowEnergyController::ControllerState state) const;
66 0 :
67 0 : protected:
68 0 : PokitDevice * q_ptr; ///< Internal q-pointer.
69 0 :
70 0 : private:
71 : Q_DECLARE_PUBLIC(PokitDevice)
72 : Q_DISABLE_COPY(PokitDevicePrivate)
73 : QTPOKIT_BEFRIEND_TEST(PokitDevice)
74 : };
75 :
76 : QTPOKIT_END_NAMESPACE
77 :
78 : #endif // QTPOKIT_POKITDEVICE_P_H
|