Dokit
Internal development documentation
Loading...
Searching...
No Matches
settorchcommand.h
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
7
9{
11
12public:
13 explicit SetTorchCommand(QObject * const parent = nullptr);
14
15 QStringList requiredOptions(const QCommandLineParser &parser) const override;
16 QStringList supportedOptions(const QCommandLineParser &parser) const override;
17
18public slots:
19 QStringList processOptions(const QCommandLineParser &parser) override;
20
21protected:
23
24protected slots:
25 void serviceDetailsDiscovered() override;
26
27private:
28 StatusService::TorchStatus newStatus { }; ///< New status to set on the Pokit device's torch to.
29 StatusService * service { nullptr }; ///< Bluetooth service this command interracts with.
30
31private slots:
32 void torchStatusWritten();
33
34 friend class TestSetTorchCommand;
35};
The AbstractPokitService class provides a common base for Pokit services classes.
The AbstractCommand class extends AbstractCommand to add a PokitDevice instance.
The SetTorchCommand class implements the set-torch CLI command.
StatusService::TorchStatus newStatus
New status to set on the Pokit device's torch to.
SetTorchCommand(QObject *const parent=nullptr)
Construct a new SetTorchCommand object with parent.
QStringList processOptions(const QCommandLineParser &parser) override
Processes the relevant options from the command line parser.
QStringList requiredOptions(const QCommandLineParser &parser) const override
Returns a list of CLI option names required by this command.
StatusService * service
Bluetooth service this command interracts with.
QStringList supportedOptions(const QCommandLineParser &parser) const override
Returns a list of CLI option names supported by this command.
void serviceDetailsDiscovered() override
Handles service detail discovery events.
void torchStatusWritten()
Handles StatusService::torchStatusWritten events, by outputting the result and exiting.
AbstractPokitService * getService() override
Returns a Pokit service object for the derived command class.
The StatusService class accesses the Pokit Status service of Pokit devices.
TorchStatus
Values supported by the single byte of the attribute of the (undocumented) Torch characteristic.
Q_OBJECTQ_OBJECT
QObject * parent() const const
Declares the StatusService class.