Dokit
Internal development documentation
Loading...
Searching...
No Matches
dsocommand.h
1// SPDX-FileCopyrightText: 2022-2024 Paul Colby <git@colby.id.au>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4#include "devicecommand.h"
5
8#include <qtpokit/pokitpro.h>
9
11{
13
14public:
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
20public slots:
21 QStringList processOptions(const QCommandLineParser &parser) override;
22
23protected:
25
26protected slots:
27 void serviceDetailsDiscovered() override;
28
29private:
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.
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
41private slots:
42 void settingsWritten();
43 void metadataRead(const DsoService::Metadata &data);
44 void outputSamples(const DsoService::Samples &samples);
45
46 friend class TestDsoCommand;
47};
The AbstractPokitService class provides a common base for Pokit services classes.
The AbstractCommand class extends AbstractCommand to add a PokitDevice instance.
The DsoCommand class implements the dso CLI command.
Definition dsocommand.h:11
DsoService::Settings settings
Settings for the Pokit device's DSO mode.
Definition dsocommand.h:33
quint8(* minRangeFunc)(const PokitProduct product, const quint32 maxValue)
Pointer to function for converting rangeOptionValue to a Pokit device's range enumerator.
Definition dsocommand.h:30
qint32 samplesToGo
Number of samples we're expecting in the current window.
Definition dsocommand.h:38
bool showCsvHeader
Whether or not to show a header as the first line of CSV output.
Definition dsocommand.h:39
void serviceDetailsDiscovered() override
Handles service detail discovery events.
void outputSamples(const DsoService::Samples &samples)
Outputs DSO samples in the selected ouput format.
QStringList supportedOptions(const QCommandLineParser &parser) const override
Returns a list of CLI option names supported by this command.
DsoCommand(QObject *const parent=nullptr)
Construct a new DsoCommand object with parent.
DsoService * service
Bluetooth service this command interracts with.
Definition dsocommand.h:32
QStringList processOptions(const QCommandLineParser &parser) override
Processes the relevant options from the command line parser.
void settingsWritten()
Invoked when the DSO settings have been written.
quint32 rangeOptionValue
The parsed value of range option.
Definition dsocommand.h:31
QStringList requiredOptions(const QCommandLineParser &parser) const override
Returns a list of CLI option names required by this command.
AbstractPokitService * getService() override
Returns a Pokit service object for the derived command class.
DsoService::Metadata metadata
Most recent DSO metadata.
Definition dsocommand.h:37
void metadataRead(const DsoService::Metadata &data)
Invoked when metadata has been received from the DSO.
The DsoService class accesses the DSO (Digital Storage Oscilloscope) service of Pokit devices.
Definition dsoservice.h:24
@ DcVoltage
Measure DC voltage.
@ FreeRunning
Run free, without waiting for edge triggers.
Declares the DsoService class.
Declares the PokitMeter namespace.
Declares the PokitPro namespace.
PokitProduct
Pokit products known to, and supported by, the QtPokit library.
Q_OBJECTQ_OBJECT
QObject * parent() const const
Attributes included in the Metadata characterstic.
Definition dsoservice.h:84
Attributes included in the Settings characterstic.
Definition dsoservice.h:67