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