Dokit
dev
v0.6.0
v0.5.8
v0.5.7
v0.5.6
v0.5.5
v0.5.4
v0.5.3
v0.5.2
v0.5.1
v0.5.0
v0.4.0
v0.3.0
v0.2.0
v0.1.2
v0.1.1
v0.1.0
User docs
Internal
Coverage
Internal development documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
settorchcommand.h
1
// SPDX-FileCopyrightText: 2022-2026 Paul Colby <git@colby.id.au>
2
// SPDX-License-Identifier: LGPL-3.0-or-later
3
4
#include "devicecommand.h"
5
6
#include <
qtpokit/statusservice.h
>
7
8
class
SetTorchCommand
:
public
DeviceCommand
9
{
10
Q_OBJECT
11
12
public
:
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
18
public
slots:
19
QStringList
processOptions
(
const
QCommandLineParser
&parser)
override
;
20
21
protected
:
22
AbstractPokitService
*
getService
()
override
;
23
24
protected
slots:
25
void
serviceDetailsDiscovered
()
override
;
26
27
private
:
28
StatusService::TorchStatus
newStatus
{ };
///< New status to set on the Pokit device's torch to.
29
StatusService
*
service
{
nullptr
};
///< Bluetooth service this command interacts with.
30
31
private
slots:
32
void
torchStatusWritten
();
33
34
QTPOKIT_BEFRIEND_TEST
(
SetTorchCommand
)
35
};
AbstractPokitService
The AbstractPokitService class provides a common base for Pokit services classes.
Definition
abstractpokitservice.h:27
DeviceCommand::DeviceCommand
DeviceCommand(QObject *const parent=nullptr)
Construct a new DeviceCommand object with parent.
Definition
devicecommand.cpp:21
SetTorchCommand
The SetTorchCommand class implements the set-torch CLI command.
Definition
settorchcommand.h:9
SetTorchCommand::newStatus
StatusService::TorchStatus newStatus
New status to set on the Pokit device's torch to.
Definition
settorchcommand.h:28
SetTorchCommand::SetTorchCommand
SetTorchCommand(QObject *const parent=nullptr)
Construct a new SetTorchCommand object with parent.
Definition
settorchcommand.cpp:22
SetTorchCommand::processOptions
QStringList processOptions(const QCommandLineParser &parser) override
Processes the relevant options from the command line parser.
Definition
settorchcommand.cpp:45
SetTorchCommand::requiredOptions
QStringList requiredOptions(const QCommandLineParser &parser) const override
Returns a list of CLI option names required by this command.
Definition
settorchcommand.cpp:27
SetTorchCommand::service
StatusService * service
Bluetooth service this command interacts with.
Definition
settorchcommand.h:29
SetTorchCommand::supportedOptions
QStringList supportedOptions(const QCommandLineParser &parser) const override
Returns a list of CLI option names supported by this command.
Definition
settorchcommand.cpp:34
SetTorchCommand::serviceDetailsDiscovered
void serviceDetailsDiscovered() override
Handles service detail discovery events.
Definition
settorchcommand.cpp:85
SetTorchCommand::torchStatusWritten
void torchStatusWritten()
Handles StatusService::torchStatusWritten events, by outputting the result and exiting.
Definition
settorchcommand.cpp:96
SetTorchCommand::getService
AbstractPokitService * getService() override
Returns a Pokit service object for the derived command class.
Definition
settorchcommand.cpp:68
StatusService
The StatusService class accesses the Pokit Status service of Pokit devices.
Definition
statusservice.h:23
StatusService::TorchStatus
TorchStatus
Values supported by the single byte of the attribute of the (undocumented) Torch characteristic.
Definition
statusservice.h:127
QCommandLineParser
QObject::QObject
QObject(QObject *parent)
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QObject::parent
QObject * parent() const const
QStringList
QTPOKIT_BEFRIEND_TEST
#define QTPOKIT_BEFRIEND_TEST(Class)
Macro for befriending a related unit test class, but only when QT_TESTLIB_LIB is defined.
Definition
qtpokit_global.h:118
statusservice.h
Declares the StatusService class.
dokit
dokit
src
cli
settorchcommand.h
Generated by
1.18.0