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 : #include "devicecommand.h" 5 : 6 : #include <qtpokit/dsoservice.h> 7 : #include <qtpokit/pokitmeter.h> 8 : #include <qtpokit/pokitpro.h> 9 : 10 1584 : class DsoCommand : public DeviceCommand 11 : { 12 3834 : Q_OBJECT 13 : 14 : public: 15 : explicit DsoCommand(QObject * const parent = nullptr); 16 : 17 : QStringList requiredOptions(const QCommandLineParser &parser) const override; 18 : QStringList supportedOptions(const QCommandLineParser &parser) const override; 19 : 20 : public slots: 21 : QStringList processOptions(const QCommandLineParser &parser) override; 22 : 23 : protected: 24 : AbstractPokitService * getService() override; 25 : 26 : protected slots: 27 : void serviceDetailsDiscovered() override; 28 : 29 : private: 30 : quint8 (* minRangeFunc)(const PokitProduct product, const quint32 maxValue) { nullptr }; 31 : quint32 rangeOptionValue { 0 }; ///< The parsed value of range option. 32 : DsoService * service { nullptr }; ///< Bluetooth service this command interracts with. 33 : DsoService::Settings settings { ///< Settings for the Pokit device's DSO mode. 34 : DsoService::Command::FreeRunning, 0.0f, DsoService::Mode::DcVoltage, 35 : +PokitMeter::VoltageRange::AutoRange, 1000*1000, 1000 36 : }; 37 : DsoService::Metadata metadata; ///< Most recent DSO metadata. 38 : qint32 samplesToGo { 0 }; ///< Number of samples we're expecting in the current window. 39 : bool showCsvHeader { true }; ///< Whether or not to show a header as the first line of CSV output. 40 : 41 : private slots: 42 : void settingsWritten(); 43 : void metadataRead(const DsoService::Metadata &data); 44 : void outputSamples(const DsoService::Samples &samples); 45 : 46 : friend class TestDsoCommand; 47 : };