Line data Source code
1 : // SPDX-FileCopyrightText: 2022 Paul Colby <git@colby.id.au> 2 : // SPDX-License-Identifier: LGPL-3.0-or-later 3 : 4 : #include "devicecommand.h" 5 : 6 : #include <qtpokit/dsoservice.h> 7 : 8 1462 : class DsoCommand : public DeviceCommand 9 : { 10 : public: 11 : explicit DsoCommand(QObject * const parent); 12 : 13 : QStringList requiredOptions(const QCommandLineParser &parser) const override; 14 : QStringList supportedOptions(const QCommandLineParser &parser) const override; 15 : 16 : public slots: 17 : QStringList processOptions(const QCommandLineParser &parser) override; 18 : 19 : protected: 20 : AbstractPokitService * getService() override; 21 : 22 : protected slots: 23 : void serviceDetailsDiscovered() override; 24 : 25 : private: 26 : DsoService * service; ///< Bluetooth service this command interracts with. 27 : DsoService::Settings settings; ///< Settings for the Pokit device's DSO mode. 28 : DsoService::Metadata metadata; ///< Most recent DSO metadata. 29 : qint32 samplesToGo; ///< Number of samples we're expecting in the current window. 30 : bool showCsvHeader; ///< Whether or not to show a header as the first line of CSV output. 31 : 32 : static DsoService::Range lowestRange(const DsoService::Mode mode, 33 : const quint32 desiredMax); 34 : static DsoService::CurrentRange lowestCurrentRange(const quint32 desiredMax); 35 : static DsoService::VoltageRange lowestVoltageRange(const quint32 desiredMax); 36 : 37 : private slots: 38 : void settingsWritten(); 39 : void metadataRead(const DsoService::Metadata &metadata); 40 : void outputSamples(const DsoService::Samples &samples); 41 : 42 : friend class TestDsoCommand; 43 : };