LCOV - code coverage report
Current view: top level - src/cli - devicecommand.h Coverage Total Hit
Project: Dokit Lines: 100.0 % 1 1
Version: Functions: - 0 0

            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              : #ifndef DOKIT_DEVICECOMMAND_H
       5              : #define DOKIT_DEVICECOMMAND_H
       6              : 
       7              : #include "abstractcommand.h"
       8              : #include <qtpokit/pokitproducts.h>
       9              : 
      10              : #include <QLowEnergyController>
      11              : 
      12              : QTPOKIT_FORWARD_DECLARE_CLASS(AbstractPokitService)
      13              : QTPOKIT_FORWARD_DECLARE_CLASS(PokitDevice)
      14              : QTPOKIT_USE_NAMESPACE
      15              : 
      16              : class DeviceCommand : public AbstractCommand
      17              : {
      18          720 :     Q_OBJECT
      19              : 
      20              : public:
      21              :     explicit DeviceCommand(QObject * const parent = nullptr);
      22              : 
      23              : public slots:
      24              :     bool start() override;
      25              : 
      26              : protected:
      27              :     PokitDevice * device { nullptr }; ///< Pokit Bluetooth device (if any) this command interacts with.
      28              :     int exitCodeOnDisconnect { EXIT_FAILURE }; ///< Exit code to return on device disconnection.
      29              : 
      30              :     void disconnect(int exitCode=EXIT_SUCCESS);
      31              :     virtual AbstractPokitService * getService() = 0;
      32              : 
      33              :     template<typename T> static T minRange(const quint32 maxValue);
      34              :     static quint8 minCapacitanceRange(const PokitProduct product, const quint32 maxValue);
      35              :     static quint8 minCurrentRange(const PokitProduct product, const quint32 maxValue);
      36              :     static quint8 minResistanceRange(const PokitProduct product, const quint32 maxValue);
      37              :     static quint8 minVoltageRange(const PokitProduct product, const quint32 maxValue);
      38              : 
      39              : protected slots:
      40              :     virtual void controllerError(const QLowEnergyController::Error error);
      41              :     virtual void deviceDisconnected();
      42              :     virtual void serviceError(const QLowEnergyService::ServiceError error);
      43              :     virtual void serviceDetailsDiscovered();
      44              : 
      45              : private slots:
      46              :     // These are protected in the base class, but hidden (private) for our descendents.
      47              :     void deviceDiscovered(const QBluetoothDeviceInfo &info) override;
      48              :     void deviceDiscoveryFinished() override;
      49              : 
      50              :     QTPOKIT_BEFRIEND_TEST(DeviceCommand)
      51              : };
      52              : 
      53              : #endif // DOKIT_DEVICECOMMAND_H
        

Generated by: LCOV version 2.3.1-1