Line data Source code
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 :
6 : #include <qtpokit/dataloggerservice.h>
7 :
8 2850 : class LoggerFetchCommand : public DeviceCommand
9 : {
10 12426 : Q_OBJECT
11 :
12 : public:
13 : explicit LoggerFetchCommand(QObject * const parent = nullptr);
14 :
15 : protected:
16 : AbstractPokitService * getService() override;
17 :
18 : protected slots:
19 : void serviceDetailsDiscovered() override;
20 :
21 : private:
22 : DataLoggerService * service { nullptr }; ///< Bluetooth service this command interracts with.
23 : DataLoggerService::Metadata metadata; ///< Most recent data logging metadata.
24 : qint32 samplesToGo { 0 }; ///< Number of samples we're still expecting to receive.
25 : quint64 timestamp { 0 }; ///< Current sample's epoch milliseconds timestamp.
26 : bool showCsvHeader { true }; ///< Whether or not to show a header as the first line of CSV output.
27 :
28 : private slots:
29 : void metadataRead(const DataLoggerService::Metadata &data);
30 : void outputSamples(const DataLoggerService::Samples &samples);
31 :
32 : friend class TestLoggerFetchCommand;
33 : };
|