Dokit
Internal development documentation
Loading...
Searching...
No Matches
DeviceCommand Class Referenceabstract

The AbstractCommand class extends AbstractCommand to add a PokitDevice instance. More...

Inheritance diagram for DeviceCommand:
[legend]
Collaboration diagram for DeviceCommand:
[legend]

Public Slots

bool start () override
 Begins scanning for the Pokit device.
 
- Public Slots inherited from AbstractCommand
virtual QStringList processOptions (const QCommandLineParser &parser)
 Processes the relevant options from the command line parser.
 
virtual bool start ()=0
 Begins the functionality of this command, and returns true if begun successfully, false otherwise.
 

Public Member Functions

 DeviceCommand (QObject *const parent=nullptr)
 Construct a new DeviceCommand object with parent.
 
- Public Member Functions inherited from AbstractCommand
 AbstractCommand (QObject *const parent=nullptr)
 Constructs a new command with parent.
 
virtual QStringList requiredOptions (const QCommandLineParser &parser) const
 Returns a list of CLI option names required by this command.
 
virtual QStringList supportedOptions (const QCommandLineParser &parser) const
 Returns a list of CLI option names supported by this command.
 
- Public Member Functions inherited from QObject
virtual const QMetaObjectmetaObject () const const
 
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
bool signalsBlocked () const const
 
bool blockSignals (bool block)
 
QThreadthread () const const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
const QObjectListchildren () const const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const const
 
void dumpObjectInfo () const const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const const
 
QList< QByteArraydynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
 Q_CLASSINFO (Name, Value)
 
 Q_INTERFACES (...)
 
 Q_PROPERTY (...)
 
 Q_ENUMS (...)
 
 Q_FLAGS (...)
 
 Q_ENUM (...)
 
 Q_FLAG (...)
 
 Q_ENUM_NS (...)
 
 Q_FLAG_NS (...)
 
 Q_OBJECT Q_OBJECT
 
 Q_GADGET Q_GADGET
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SLOTS Q_SLOTS
 
 Q_SLOT Q_SLOT
 
 Q_EMIT Q_EMIT
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 

Protected Slots

virtual void controllerError (const QLowEnergyController::Error error)
 Handles controller error events.
 
virtual void deviceDisconnected ()
 Handles devics disconnection events.
 
virtual void serviceError (const QLowEnergyService::ServiceError error)
 Handles service error events.
 
virtual void serviceDetailsDiscovered ()
 Handles service detail discovery events.
 
- Protected Slots inherited from AbstractCommand
virtual void deviceDiscovered (const QBluetoothDeviceInfo &info)=0
 Handles PokitDiscoveryAgent::pokitDeviceDiscovered signal.
 
virtual void deviceDiscoveryFinished ()=0
 Handles PokitDiscoveryAgent::deviceDiscoveryFinished signal.
 

Protected Member Functions

void disconnect (int exitCode=EXIT_SUCCESS)
 Disconnects the underlying Pokit device, and sets exitCode to be return to the OS once the disconnection has taken place.
 
virtual AbstractPokitServicegetService ()=0
 Returns a Pokit service object for the derived command class.
 
- Protected Member Functions inherited from QObject
QObjectsender () const const
 
int senderSignalIndex () const const
 
int receivers (const char *signal) const const
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 

Static Protected Member Functions

template<typename T >
static T minRange (const quint32 maxValue)
 
static quint8 minCapacitanceRange (const PokitProduct product, const quint32 maxValue)
 Returns the product's lowest capacitance range that can measure at least up to maxValue (nF), or AutoRange if no such range is available.
 
static quint8 minCurrentRange (const PokitProduct product, const quint32 maxValue)
 Returns the product's lowest current range that can measure at least up to maxValue (µA), or AutoRange if no such range is available.
 
static quint8 minResistanceRange (const PokitProduct product, const quint32 maxValue)
 Returns the product's lowest resistance range that can measure at least up to maxValue (Ω), or AutoRange if no such range is available.
 
static quint8 minVoltageRange (const PokitProduct product, const quint32 maxValue)
 t Returns the product's lowest voltage range that can measure at least up to maxValue (mV), or AutoRange if no such range is available.
 
- Static Protected Member Functions inherited from AbstractCommand
static Q_LOGGING_CATEGORY (lc, "dokit.cli.command", QtInfoMsg)
 Logging category for UI commands.
 

Protected Attributes

PokitDevicedevice { nullptr }
 Pokit Bluetooth device (if any) this command inerracts with.
 
int exitCodeOnDisconnect { EXIT_FAILURE }
 Exit code to return on device disconnection.
 
- Protected Attributes inherited from AbstractCommand
QString deviceToScanFor
 Device (if any) that were passed to processOptions().
 
PokitDiscoveryAgentdiscoveryAgent
 Agent for Pokit device descovery.
 
OutputFormat format { OutputFormat::Text }
 Selected output format.
 

Private Slots

void deviceDiscovered (const QBluetoothDeviceInfo &info) override
 Checks if info is the device (if any) we're looking for, and if so, create a contoller and service, and begins connecting to the device.
 
void deviceDiscoveryFinished () override
 Checks that the requested device was discovered, and if not, reports and error and exits.
 

Friends

class TestDeviceCommand
 

Additional Inherited Members

- Public Types inherited from AbstractCommand
enum class  OutputFormat { Csv , Json , Text }
 Supported output formats. More...
 
- Static Public Member Functions inherited from AbstractCommand
static QString escapeCsvField (const QString &field)
 Returns an RFC 4180 compliant version of field.
 
template<typename R >
static quint32 parseNumber (const QString &value, const QString &unit, const quint32 sensibleMinimum=0)
 Returns value as an integer multiple of the ratio R.
 
- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Properties inherited from QObject
 objectName
 

Detailed Description

The AbstractCommand class extends AbstractCommand to add a PokitDevice instance.

Definition at line 15 of file devicecommand.h.

Constructor & Destructor Documentation

◆ DeviceCommand()

DeviceCommand::DeviceCommand ( QObject *const parent = nullptr)
explicit

Construct a new DeviceCommand object with parent.

Definition at line 21 of file devicecommand.cpp.

22{
23
24}
AbstractCommand(QObject *const parent=nullptr)
Constructs a new command with parent.
QObject * parent() const const

Member Function Documentation

◆ controllerError

void DeviceCommand::controllerError ( const QLowEnergyController::Error error)
protectedvirtualslot

Handles controller error events.

This base implementation simply logs error and then exits with EXIT_FAILURE. Derived classes may override this slot to implement their own error handing if desired.

Definition at line 292 of file devicecommand.cpp.

293{
294 qCWarning(lc).noquote() << tr("Bluetooth controller error:") << error;
295 QCoreApplication::exit(EXIT_FAILURE);
296}
void exit(int returnCode)
QString tr(const char *sourceText, const char *disambiguation, int n)

References QCoreApplication::exit(), and QObject::tr().

Referenced by deviceDiscovered().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deviceDisconnected

void DeviceCommand::deviceDisconnected ( )
protectedvirtualslot

Handles devics disconnection events.

This base implementation simply logs and exits the application (via QCoreApplication::exit) with the current exitCodeOnDisconnect value, which is initialise to EXIT_FAILURE in the constructor, but should be set to EXIT_SUCESS if/when the derived command class has completed its actions and requested the disconnection (as opposed to a spontaneous disconnection on error).

Definition at line 305 of file devicecommand.cpp.

306{
307 qCDebug(lc).noquote() << tr("Pokit device disconnected. Exiting with code %1.")
310}
int exitCodeOnDisconnect
Exit code to return on device disconnection.
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const

References QString::arg(), QCoreApplication::exit(), exitCodeOnDisconnect, and QObject::tr().

Referenced by deviceDiscovered().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deviceDiscovered

void DeviceCommand::deviceDiscovered ( const QBluetoothDeviceInfo & info)
overrideprivateslot

Checks if info is the device (if any) we're looking for, and if so, create a contoller and service, and begins connecting to the device.

Definition at line 340 of file devicecommand.cpp.

341{
342 Q_ASSERT(isPokitProduct(info));
343
344 if (device) {
345 qCDebug(lc).noquote() << tr(R"(Ignoring additional Pokit device "%1" (%2) at (%3).)")
346 .arg(info.name(), info.deviceUuid().toString(), info.address().toString());
347 return;
348 }
349
350 if ((deviceToScanFor.isEmpty()) || (deviceToScanFor == info.name()) ||
351 ((!info.address().isNull()) && (info.address() == QBluetoothAddress(deviceToScanFor))) ||
352 ((!info.deviceUuid().isNull()) && (info.deviceUuid() == QBluetoothUuid(deviceToScanFor))))
353 {
354 qCDebug(lc).noquote() << tr(R"(Found Pokit device "%1" (%2) at (%3).)")
355 .arg(info.name(), info.deviceUuid().toString(), info.address().toString());
357
358 device = new PokitDevice(info, this);
362 #if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
363 QOverload<QLowEnergyController::Error>::of(&QLowEnergyController::error),
364 #else
365 &QLowEnergyController::errorOccurred,
366 #endif
368
369 AbstractPokitService * const service = getService();
370 service->setPokitProduct(pokitProduct(info));
371
372 Q_ASSERT(service);
377
378 qCDebug(lc).noquote() << tr(R"(Connecting to %1 device "%2" (%3) at (%4).)").arg(
379 toString(*service->pokitProduct()), info.name(), info.deviceUuid().toString(), info.address().toString());
381 return;
382 }
383
384 qCDebug(lc).noquote() << tr(R"(Ignoring non-matching Pokit device "%1" (%2) at (%3).)")
385 .arg(info.name(), info.deviceUuid().toString(), info.address().toString());
386 return;
387}
QString deviceToScanFor
Device (if any) that were passed to processOptions().
PokitDiscoveryAgent * discoveryAgent
Agent for Pokit device descovery.
The AbstractPokitService class provides a common base for Pokit services classes.
std::optional< PokitProduct > pokitProduct() const
Returns the Pokit product this service is attached to.
void serviceErrorOccurred(QLowEnergyService::ServiceError newError)
This signal is emitted whenever an error occurs on the underlying QLowEnergyService.
void setPokitProduct(const PokitProduct product)
Sets the current Pokit product.
void serviceDetailsDiscovered()
This signal is emitted when the Pokit service details have been discovered.
virtual void controllerError(const QLowEnergyController::Error error)
Handles controller error events.
PokitDevice * device
Pokit Bluetooth device (if any) this command inerracts with.
virtual void deviceDisconnected()
Handles devics disconnection events.
virtual AbstractPokitService * getService()=0
Returns a Pokit service object for the derived command class.
virtual void serviceDetailsDiscovered()
Handles service detail discovery events.
virtual void serviceError(const QLowEnergyService::ServiceError error)
Handles service error events.
The PokitDevice class simplifies Pokit device access.
Definition pokitdevice.h:32
QLowEnergyController * controller()
Returns a non-const pointer to the controller used to access the Pokit device.
QTPOKIT_EXPORT PokitProduct pokitProduct(const QBluetoothDeviceInfo &info)
Returns the PokitProduct corresponding the Bluetotoh device info.
QTPOKIT_EXPORT QString toString(const PokitProduct product)
Returns product as user-friendly string.
QTPOKIT_EXPORT bool isPokitProduct(const QBluetoothDeviceInfo &info)
Returns true if info describes a Pokit device.
bool isNull() const const
QString toString() const const
QBluetoothAddress address() const const
QBluetoothUuid deviceUuid() const const
QString name() const const
QLowEnergyController::Error error() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool isEmpty() const const
QueuedConnection
bool isNull() const const
QString toString() const const

References QBluetoothDeviceInfo::address(), QString::arg(), QObject::connect(), QLowEnergyController::connectToDevice(), PokitDevice::controller(), controllerError(), device, deviceDisconnected(), AbstractCommand::deviceToScanFor, QBluetoothDeviceInfo::deviceUuid(), QLowEnergyController::disconnected(), AbstractCommand::discoveryAgent, QLowEnergyController::error(), getService(), QString::isEmpty(), QBluetoothAddress::isNull(), QUuid::isNull(), isPokitProduct(), QBluetoothDeviceInfo::name(), AbstractPokitService::pokitProduct(), pokitProduct(), Qt::QueuedConnection, AbstractPokitService::serviceDetailsDiscovered(), serviceDetailsDiscovered(), serviceError(), AbstractPokitService::serviceErrorOccurred(), AbstractPokitService::setPokitProduct(), QBluetoothDeviceDiscoveryAgent::stop(), QBluetoothAddress::toString(), QUuid::toString(), toString(), and QObject::tr().

Here is the call graph for this function:

◆ deviceDiscoveryFinished

void DeviceCommand::deviceDiscoveryFinished ( )
overrideprivateslot

Checks that the requested device was discovered, and if not, reports and error and exits.

Definition at line 392 of file devicecommand.cpp.

393{
394 if (!device) {
395 qCWarning(lc).noquote() << ((deviceToScanFor.isNull())
396 ? tr("Failed to find any Pokit device.")
397 : tr(R"(Failed to find device "%1".)").arg(deviceToScanFor));
398 QCoreApplication::exit(EXIT_FAILURE);
399 }
400}
bool isNull() const const

References QString::arg(), device, AbstractCommand::deviceToScanFor, QCoreApplication::exit(), QString::isNull(), and QObject::tr().

Here is the call graph for this function:

◆ disconnect()

void DeviceCommand::disconnect ( int exitCode = EXIT_SUCCESS)
protected

Disconnects the underlying Pokit device, and sets exitCode to be return to the OS once the disconnection has taken place.

Definition at line 42 of file devicecommand.cpp.

43{
44 qCDebug(lc).noquote() << tr("Disconnecting Pokit device...");
45 Q_ASSERT(device);
46 Q_ASSERT(device->controller());
47 exitCodeOnDisconnect = exitCode;
49}

References PokitDevice::controller(), device, QLowEnergyController::disconnectFromDevice(), exitCodeOnDisconnect, and QObject::tr().

Referenced by FlashLedCommand::deviceLedFlashed(), SetNameCommand::deviceNameWritten(), StatusCommand::outputDeviceStatus(), MeterCommand::outputReading(), LoggerFetchCommand::outputSamples(), DsoCommand::outputSamples(), InfoCommand::serviceDetailsDiscovered(), LoggerStartCommand::settingsWritten(), LoggerStopCommand::settingsWritten(), CalibrateCommand::temperatureCalibrated(), and SetTorchCommand::torchStatusWritten().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getService()

AbstractPokitService * DeviceCommand::getService ( )
protectedpure virtual

Returns a Pokit service object for the derived command class.

This will be called by deviceDiscovered() when the requested Pokit device has been found, after which deviceDiscovered() will connect the returned service's common signals, and kick off the device's connection process.

Implemented in CalibrateCommand, DsoCommand, FlashLedCommand, InfoCommand, LoggerFetchCommand, LoggerStartCommand, LoggerStopCommand, MeterCommand, SetNameCommand, SetTorchCommand, and StatusCommand.

Referenced by deviceDiscovered().

Here is the caller graph for this function:

◆ minCapacitanceRange()

quint8 DeviceCommand::minCapacitanceRange ( const PokitProduct product,
const quint32 maxValue )
staticprotected

Returns the product's lowest capacitance range that can measure at least up to maxValue (nF), or AutoRange if no such range is available.

Note
Since Pokit Meters do not support capacitance measurement, product should not be PokitProduct::PokitMeter.
See also
minRange<PokitPro::CapacitanceRange>

Definition at line 213 of file devicecommand.cpp.

214{
215 switch (product) {
217 Q_ASSERT_X(false, "DeviceCommand::minCapacitanceRange", "Pokit Meter has no capacitance support.");
218 return 255;
220 return +minRange<PokitPro::CapacitanceRange>(maxValue);
221 }
222 Q_ASSERT_X(false, "DeviceCommand::minCapacitanceRange", "Unknown PokitProduct enum value");
223 return 255;
224}
@ PokitPro
Pokit Pro.
@ PokitMeter
Pokit Meter.

References PokitMeter, and PokitPro.

Referenced by MeterCommand::processOptions().

Here is the caller graph for this function:

◆ minCurrentRange()

quint8 DeviceCommand::minCurrentRange ( const PokitProduct product,
const quint32 maxValue )
staticprotected

Returns the product's lowest current range that can measure at least up to maxValue (µA), or AutoRange if no such range is available.

See also
DeviceCommand::minRange<PokitMeter::CurrentRange>(const quint32 maxValue)
minRange<PokitPro::CurrentRange>(const quint32 maxValue)

Definition at line 233 of file devicecommand.cpp.

234{
235 switch (product) {
237 return +minRange<PokitMeter::CurrentRange>(maxValue);
239 return +minRange<PokitPro::CurrentRange>(maxValue);
240 }
241 Q_ASSERT_X(false, "DeviceCommand::minCurrentRange", "Unknown PokitProduct enum value");
242 return 255;
243}

References PokitMeter, and PokitPro.

Referenced by DsoCommand::processOptions(), LoggerStartCommand::processOptions(), and MeterCommand::processOptions().

Here is the caller graph for this function:

◆ minRange()

template<typename T >
template< typename T > static T DeviceCommand::minRange ( const quint32 maxValue)
staticprotected

Returns the lowest T range that can measure at least up to maxValue, or AutoRange if no such range is available.

Template Parameters
TRange enumerator to evaluate ranges for. Must be one of:

◆ minResistanceRange()

quint8 DeviceCommand::minResistanceRange ( const PokitProduct product,
const quint32 maxValue )
staticprotected

Returns the product's lowest resistance range that can measure at least up to maxValue (Ω), or AutoRange if no such range is available.

See also
DeviceCommand::minRange<PokitMeter::ResistanceRange>(const quint32 maxValue)
minRange<PokitPro::ResistanceRange>(const quint32 maxValue)

Definition at line 252 of file devicecommand.cpp.

253{
254 switch (product) {
256 return +minRange<PokitMeter::ResistanceRange>(maxValue);
258 return +minRange<PokitPro::ResistanceRange>(maxValue);
259 }
260 Q_ASSERT_X(false, "DeviceCommand::minResistanceRange", "Unknown PokitProduct enum value");
261 return 255;
262}

References PokitMeter, and PokitPro.

Referenced by MeterCommand::processOptions().

Here is the caller graph for this function:

◆ minVoltageRange()

quint8 DeviceCommand::minVoltageRange ( const PokitProduct product,
const quint32 maxValue )
staticprotected

t Returns the product's lowest voltage range that can measure at least up to maxValue (mV), or AutoRange if no such range is available.

See also
DeviceCommand::minRange<PokitMeter::VoltageRange>(const quint32 maxValue)
minRange<PokitPro::VoltageRange>(const quint32 maxValue)

Definition at line 272 of file devicecommand.cpp.

273{
274 switch (product) {
276 return +minRange<PokitMeter::VoltageRange>(maxValue);
278 return +minRange<PokitPro::VoltageRange>(maxValue);
279 }
280 Q_ASSERT_X(false, "DeviceCommand::minVoltageRange", "Unknown PokitProduct enum value");
281 return 255;
282}

References PokitMeter, and PokitPro.

Referenced by DsoCommand::processOptions(), LoggerStartCommand::processOptions(), and MeterCommand::processOptions().

Here is the caller graph for this function:

◆ serviceDetailsDiscovered

void DeviceCommand::serviceDetailsDiscovered ( )
protectedvirtualslot

Handles service detail discovery events.

This base implementation simply logs the event, and nothing more. Derived classes may (usually do) override this slot to provide their own processing when a services details have been discovered.

Definition at line 331 of file devicecommand.cpp.

332{
333 qCDebug(lc).noquote() << tr("Service details discovered.");
334}

References QObject::tr().

Referenced by deviceDiscovered(), CalibrateCommand::serviceDetailsDiscovered(), DsoCommand::serviceDetailsDiscovered(), FlashLedCommand::serviceDetailsDiscovered(), InfoCommand::serviceDetailsDiscovered(), LoggerFetchCommand::serviceDetailsDiscovered(), LoggerStartCommand::serviceDetailsDiscovered(), LoggerStopCommand::serviceDetailsDiscovered(), MeterCommand::serviceDetailsDiscovered(), and StatusCommand::serviceDetailsDiscovered().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ serviceError

void DeviceCommand::serviceError ( const QLowEnergyService::ServiceError error)
protectedvirtualslot

Handles service error events.

This base implementation simply logs error and then exits with EXIT_FAILURE. Derived classes may override this slot to implement their own error handing if desired.

Note
As this base class does not construct services (derived classed do), its up to the derived classed to connect this slot to the relevant service's error signal if desired.

Definition at line 320 of file devicecommand.cpp.

321{
322 qCWarning(lc).noquote() << tr("Bluetooth service error:") << error;
323 QCoreApplication::exit(EXIT_FAILURE);
324}

References QCoreApplication::exit(), and QObject::tr().

Referenced by deviceDiscovered().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start

bool DeviceCommand::start ( )
overrideslot

Begins scanning for the Pokit device.

Definition at line 29 of file devicecommand.cpp.

30{
31 qCInfo(lc).noquote() << ((deviceToScanFor.isNull())
32 ? tr("Looking for first available Pokit device...")
33 : tr(R"(Looking for device "%1"...)").arg(deviceToScanFor));
35 return true;
36}
void start(QBluetoothDeviceDiscoveryAgent::DiscoveryMethods methods)
Starts Pokit device discovery.

References QString::arg(), AbstractCommand::deviceToScanFor, AbstractCommand::discoveryAgent, QString::isNull(), PokitDiscoveryAgent::start(), and QObject::tr().

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ TestDeviceCommand

friend class TestDeviceCommand
friend

Definition at line 49 of file devicecommand.h.

Member Data Documentation

◆ device

◆ exitCodeOnDisconnect

int DeviceCommand::exitCodeOnDisconnect { EXIT_FAILURE }
protected

Exit code to return on device disconnection.

Definition at line 27 of file devicecommand.h.

27{ EXIT_FAILURE }; ///< Exit code to return on device disconnection.

Referenced by deviceDisconnected(), and disconnect().


The documentation for this class was generated from the following files: