4#include "settorchcommand.h"
55 errors.
append(
tr(
"Invalid status value: %1").arg(value));
97 std::cout << qUtf8Printable(
tr(
"set_torch_result\nsuccess\n"));
103 std::cout << qUtf8Printable(
tr(
"Done.\n"));
virtual QStringList supportedOptions(const QCommandLineParser &parser) const
Returns a list of CLI option names supported by this command.
OutputFormat format
Selected output format.
@ Text
Plain unstructured text.
@ Csv
RFC 4180 compliant CSV text.
@ Json
RFC 8259 compliant JSON text.
virtual QStringList processOptions(const QCommandLineParser &parser)
Processes the relevant options from the command line parser.
virtual QStringList requiredOptions(const QCommandLineParser &parser) const
Returns a list of CLI option names required by this command.
The AbstractPokitService class provides a common base for Pokit services classes.
The AbstractCommand class extends AbstractCommand to add a PokitDevice instance.
PokitDevice * device
Pokit Bluetooth device (if any) this command inerracts with.
void disconnect(int exitCode=EXIT_SUCCESS)
Disconnects the underlying Pokit device, and sets exitCode to be return to the OS once the disconnect...
StatusService * status()
Returns a pointer to StatusService instance that uses this device's controller for access.
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.
void torchStatusWritten()
This signal is emitted when the Torch characteristic has been written successfully.
bool setTorchStatus(const TorchStatus status)
Set the Pokit device's torch to status.
static QString toString(const StatusService::DeviceStatus &status)
Returns a string version of the status enum label.
Declares the PokitDevice class.
QString value(const QString &optionName) const const
void exit(int returnCode)
void append(const T &value)
bool isEmpty() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString tr(const char *sourceText, const char *disambiguation, int n)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
int compare(const QString &other, Qt::CaseSensitivity cs) const const
QString trimmed() const const