Line data Source code
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 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 60 : Q_OBJECT 34 : 35 : public: 36 1932 : static Q_LOGGING_CATEGORY(lc, "pokit.ble.controller", QtInfoMsg); ///< Logging category. 37 : 38 : QLowEnergyController * controller { nullptr }; ///< BLE controller for accessing the Pokit device. 39 : 40 : CalibrationService * calibration { nullptr }; ///< Calibration service for this Pokit device. 41 : DataLoggerService * dataLogger { nullptr }; ///< Data Logger service for this Pokit device. 42 : DeviceInfoService * deviceInfo { nullptr }; ///< Device Info service for this Pokit device. 43 : DsoService * dso { nullptr }; ///< DSO service for this Pokit device. 44 : MultimeterService * multimeter { nullptr }; ///< Multimeter service for this Pokit device. 45 : StatusService * status { nullptr }; ///< Status service for this Pokit device. 46 : 47 : QMutex calibrationMutex; ///< Mutex for protecting access to #calibration. 48 : QMutex dataLoggerMutex; ///< Mutex for protecting access to #dataLogger. 49 : QMutex deviceInfoMutex; ///< Mutex for protecting access to #deviceInfo. 50 : QMutex dsoMutex; ///< Mutex for protecting access to #dso. 51 : QMutex multimeterMutex; ///< Mutex for protecting access to #multimeter. 52 : QMutex statusMutex; ///< Mutex for protecting access to #status. 53 : 54 : explicit PokitDevicePrivate(PokitDevice * const q); 55 : 56 : void setController(QLowEnergyController * newController); 57 : 58 : public Q_SLOTS: 59 : void connected() const; 60 : void connectionUpdated(const QLowEnergyConnectionParameters &newParameters) const; 61 : void disconnected() const; 62 : void discoveryFinished() const; 63 : void errorOccurred(QLowEnergyController::Error newError) const; 64 : void serviceDiscovered(const QBluetoothUuid &newService) const; 65 : void stateChanged(QLowEnergyController::ControllerState state) const; 66 : 67 : protected: 68 : PokitDevice * q_ptr; ///< Internal q-pointer. 69 : 70 : private: 71 : Q_DECLARE_PUBLIC(PokitDevice) 72 : Q_DISABLE_COPY(PokitDevicePrivate) 73 : friend class TestPokitDevice; 74 : }; 75 : 76 : QTPOKIT_END_NAMESPACE 77 : 78 : #endif // QTPOKIT_POKITDEVICE_P_H