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
scancommand.h
1
// SPDX-FileCopyrightText: 2022-2026 Paul Colby <git@colby.id.au>
2
// SPDX-License-Identifier: LGPL-3.0-or-later
3
4
#include "abstractcommand.h"
5
6
class
ScanCommand
:
public
AbstractCommand
7
{
8
Q_OBJECT
9
10
public
:
11
explicit
ScanCommand
(
QObject
*
const
parent
=
nullptr
);
12
13
QStringList
requiredOptions
(
const
QCommandLineParser
&parser)
const override
;
14
QStringList
supportedOptions
(
const
QCommandLineParser
&parser)
const override
;
15
16
public
slots:
17
QStringList
processOptions
(
const
QCommandLineParser
&parser)
override
;
18
bool
start
()
override
;
19
20
protected
slots:
21
void
deviceDiscovered
(
const
QBluetoothDeviceInfo
&info)
override
;
22
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
// Required signal, and Fields, added in Qt 5.12.
23
void
deviceUpdated
(
const
QBluetoothDeviceInfo
&info,
24
const
QBluetoothDeviceInfo::Fields
updatedFields);
25
#endif
26
void
deviceDiscoveryFinished
()
override
;
27
28
private
:
29
bool
showCsvHeader
{
true
};
///< Whether or not to show a header as the first line of CSV output.
30
31
static
QJsonObject
toJson
(
const
QBluetoothDeviceInfo
&info);
32
static
QJsonArray
toJson
(
const
QBluetoothDeviceInfo::CoreConfigurations
&configurations);
33
static
QJsonValue
toJson
(
const
QBluetoothDeviceInfo::MajorDeviceClass
&majorClass);
34
static
QJsonValue
toJson
(
const
QBluetoothDeviceInfo::MajorDeviceClass
&majorClass,
const
quint8 minorClass);
35
static
QJsonArray
toJson
(
const
QBluetoothDeviceInfo::ServiceClasses
&classes);
36
static
QJsonArray
toJson
(
const
QList<QBluetoothUuid>
&uuids);
37
static
QJsonObject
toJson
(
const
QMultiHash<quint16, QByteArray>
&data);
38
39
static
QString
toString
(
const
QBluetoothDeviceInfo::MajorDeviceClass
&majorClass);
40
static
QString
toString
(
const
QBluetoothDeviceInfo::MajorDeviceClass
&majorClass,
const
quint8 minorClass);
41
42
QTPOKIT_BEFRIEND_TEST
(
ScanCommand
)
43
};
AbstractCommand::AbstractCommand
AbstractCommand(QObject *const parent=nullptr)
Constructs a new command with parent.
Definition
abstractcommand.cpp:28
ScanCommand
The ScanCommand class implements the scan CLI command, by scanning for nearby Pokit Bluetooth devices...
Definition
scancommand.h:7
ScanCommand::toJson
static QJsonObject toJson(const QBluetoothDeviceInfo &info)
Returns info as a JSON object.
Definition
scancommand.cpp:118
ScanCommand::requiredOptions
QStringList requiredOptions(const QCommandLineParser &parser) const override
Returns a list of CLI option names required by this command.
Definition
scancommand.cpp:36
ScanCommand::deviceUpdated
void deviceUpdated(const QBluetoothDeviceInfo &info, const QBluetoothDeviceInfo::Fields updatedFields)
Handles updated Pokit devices, writing info to stdout.
Definition
scancommand.cpp:97
ScanCommand::ScanCommand
ScanCommand(QObject *const parent=nullptr)
Construct a new ScanCommand object with parent.
Definition
scancommand.cpp:28
ScanCommand::deviceDiscoveryFinished
void deviceDiscoveryFinished() override
Handles the completion of device discovery.
Definition
scancommand.cpp:109
ScanCommand::start
bool start() override
Begins scanning for Pokit devices.
Definition
scancommand.cpp:61
ScanCommand::processOptions
QStringList processOptions(const QCommandLineParser &parser) override
Processes the relevant options from the command line parser.
Definition
scancommand.cpp:48
ScanCommand::showCsvHeader
bool showCsvHeader
Whether or not to show a header as the first line of CSV output.
Definition
scancommand.h:29
ScanCommand::deviceDiscovered
void deviceDiscovered(const QBluetoothDeviceInfo &info) override
Handles discovered Pokit devices, writing info to stdout.
Definition
scancommand.cpp:72
ScanCommand::supportedOptions
QStringList supportedOptions(const QCommandLineParser &parser) const override
Returns a list of CLI option names supported by this command.
Definition
scancommand.cpp:41
toString
QTPOKIT_EXPORT QString toString(const PokitProduct product)
Returns product as user-friendly string.
Definition
pokitproducts.cpp:35
QBluetoothDeviceInfo
QBluetoothDeviceInfo::CoreConfigurations
QBluetoothDeviceInfo::CoreConfiguration CoreConfigurations
QBluetoothDeviceInfo::Fields
QBluetoothDeviceInfo::Field Fields
QBluetoothDeviceInfo::MajorDeviceClass
MajorDeviceClass
QBluetoothDeviceInfo::ServiceClasses
QBluetoothDeviceInfo::ServiceClass ServiceClasses
QCommandLineParser
QJsonArray
QJsonObject
QJsonValue
QList
QMultiHash
QObject::QObject
QObject(QObject *parent)
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QObject::parent
QObject * parent() const const
QString
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
dokit
dokit
src
cli
scancommand.h
Generated by
1.18.0