Dokit
Internal development documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
PokitDevicePrivate Class Reference

The PokitDevicePrivate class provides private implementation for PokitDevice. More...

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

Public Slots

void connected () const
 Handle connected signals.
 
void connectionUpdated (const QLowEnergyConnectionParameters &newParameters) const
 Handle connectionUpdated signals.
 
void disconnected () const
 Handle disconnected signals.
 
void discoveryFinished () const
 Handle discoveryFinished signals.
 
void errorOccurred (QLowEnergyController::Error newError) const
 Handle error signals.
 
void serviceDiscovered (const QBluetoothUuid &newService) const
 Handle serviceDiscovered signals.
 
void stateChanged (QLowEnergyController::ControllerState state) const
 Handle stateChanged signals.
 

Public Member Functions

 PokitDevicePrivate (PokitDevice *const q)
 Constructs a new PokitDevicePrivate object with public implementation q.
 
void setController (QLowEnergyController *newController)
 Sets newController to be used for accessing Pokit devices.
 
- 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
 

Static Public Member Functions

static Q_LOGGING_CATEGORY (lc, "pokit.ble.controller", QtInfoMsg)
 Logging category.
 
- 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

QLowEnergyControllercontroller { nullptr }
 BLE controller for accessing the Pokit device.
 
CalibrationServicecalibration { nullptr }
 Calibration service for this Pokit device.
 
DataLoggerServicedataLogger { nullptr }
 Data Logger service for this Pokit device.
 
DeviceInfoServicedeviceInfo { nullptr }
 Device Info service for this Pokit device.
 
DsoServicedso { nullptr }
 DSO service for this Pokit device.
 
MultimeterServicemultimeter { nullptr }
 Multimeter service for this Pokit device.
 
StatusServicestatus { nullptr }
 Status service for this Pokit device.
 
QMutex calibrationMutex
 Mutex for protecting access to calibration.
 
QMutex dataLoggerMutex
 Mutex for protecting access to dataLogger.
 
QMutex deviceInfoMutex
 Mutex for protecting access to deviceInfo.
 
QMutex dsoMutex
 Mutex for protecting access to dso.
 
QMutex multimeterMutex
 Mutex for protecting access to multimeter.
 
QMutex statusMutex
 Mutex for protecting access to status.
 
- Public Attributes inherited from QObject
typedef QObjectList
 

Protected Attributes

PokitDeviceq_ptr
 Internal q-pointer.
 

Additional Inherited Members

- 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)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

The PokitDevicePrivate class provides private implementation for PokitDevice.

Definition at line 31 of file pokitdevice_p.h.

Constructor & Destructor Documentation

◆ PokitDevicePrivate()

PokitDevicePrivate::PokitDevicePrivate ( PokitDevice *const q)
explicit

Constructs a new PokitDevicePrivate object with public implementation q.

Definition at line 277 of file pokitdevice.cpp.

277 : q_ptr(q)
278{
279
280}
PokitDevice * q_ptr
Internal q-pointer.

References q_ptr.

Member Function Documentation

◆ connected

void PokitDevicePrivate::connected ( ) const
slot

Handle connected signals.

Definition at line 350 of file pokitdevice.cpp.

351{
352 if (controller == nullptr) {
353 qCCritical(lc).noquote() << tr("PokitDevicePrivate::connected slot invoked without a controller.");
354 return; // Just to avoid the nullptr dereference below.
355 }
356 qCDebug(lc).noquote() << tr(R"(Connected to "%1" (%2) at (%3).)").arg(
357 controller->remoteName(), controller->remoteDeviceUuid().toString(),
358 controller->remoteAddress().toString());
359}
QLowEnergyController * controller
BLE controller for accessing the Pokit device.
QString tr(const char *sourceText, const char *disambiguation, int n)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const

References QString::arg(), controller, and QObject::tr().

Referenced by setController().

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

◆ connectionUpdated

void PokitDevicePrivate::connectionUpdated ( const QLowEnergyConnectionParameters & newParameters) const
slot

Handle connectionUpdated signals.

Definition at line 364 of file pokitdevice.cpp.

365{
366 qCDebug(lc).noquote() << tr("Connection updated:") << newParameters.latency()
367 << newParameters.minimumInterval() << newParameters.maximumInterval()
368 << newParameters.supervisionTimeout();
369}
double maximumInterval() const const
double minimumInterval() const const
int supervisionTimeout() const const

References QLowEnergyConnectionParameters::latency(), QLowEnergyConnectionParameters::maximumInterval(), QLowEnergyConnectionParameters::minimumInterval(), QLowEnergyConnectionParameters::supervisionTimeout(), and QObject::tr().

Referenced by setController().

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

◆ disconnected

void PokitDevicePrivate::disconnected ( ) const
slot

Handle disconnected signals.

Definition at line 374 of file pokitdevice.cpp.

375{
376 qCDebug(lc).noquote() << tr("Device disconnected.");
377}

References QObject::tr().

Referenced by setController().

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

◆ discoveryFinished

void PokitDevicePrivate::discoveryFinished ( ) const
slot

Handle discoveryFinished signals.

Definition at line 382 of file pokitdevice.cpp.

383{
384 qCDebug(lc).noquote() << tr("Service discovery finished.");
385}

References QObject::tr().

Referenced by setController().

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

◆ errorOccurred

void PokitDevicePrivate::errorOccurred ( QLowEnergyController::Error newError) const
slot

Handle error signals.

Definition at line 390 of file pokitdevice.cpp.

391{
392 qCDebug(lc).noquote() << tr("Controller error:") << newError;
393}

References QObject::tr().

Referenced by setController().

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

◆ serviceDiscovered

void PokitDevicePrivate::serviceDiscovered ( const QBluetoothUuid & newService) const
slot

Handle serviceDiscovered signals.

Definition at line 398 of file pokitdevice.cpp.

399{
400 qCDebug(lc).noquote() << tr(R"(Service discovered: %1 "%2")")
401 .arg(newService.toString(), PokitDevice::serviceToString(newService));
402}
static QString serviceToString(const QBluetoothUuid &uuid)
Returns a human-readable name for the uuid service, or a null QString if unknown.
QString toString() const const

References QString::arg(), PokitDevice::serviceToString(), QUuid::toString(), and QObject::tr().

Referenced by setController().

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

◆ setController()

void PokitDevicePrivate::setController ( QLowEnergyController * newController)

Sets newController to be used for accessing Pokit devices.

If a controller has already been set (and is not the same pointer), then the previous controller will be disconnected, and replaced with newController.

This function will not take ownership of the new controller. The caller is responsible for ensuring that newContorller remains valid for the lifetime of this instance, or until this function is used again to replace newController with another one (which may be a nullptr).

See also
controller
PokitDevice::controller()

Definition at line 295 of file pokitdevice.cpp.

296{
297 if (newController == this->controller) {
298 qCDebug(lc).noquote() << tr("Controller already set to:") << newController;
299 return;
300 }
301
302 if (this->controller) {
303 qCDebug(lc).noquote() << tr("Disconnecting signals from previous controller:")
304 << controller;
305 disconnect(this->controller, nullptr, this, nullptr);
306 }
307
308 qCDebug(lc).noquote() << tr("Setting new controller:") << newController;
309 this->controller = newController;
310 if (!newController) {
311 return; // Don't bother continuing to connect if new controller is null.
312 }
313
314 qCDebug(lc).noquote() << tr(R"(Set new controller "%1" (%2) at (%3).)").arg(
315 controller->remoteName(), controller->remoteDeviceUuid().toString(),
316 controller->remoteAddress().toString());
317
320
323
326
329
330
332 #if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
333 QOverload<QLowEnergyController::Error>::of(&QLowEnergyController::error),
334 #else
335 &QLowEnergyController::errorOccurred,
336 #endif
338
339
342
345}
void connected() const
Handle connected signals.
void disconnected() const
Handle disconnected signals.
void errorOccurred(QLowEnergyController::Error newError) const
Handle error signals.
void stateChanged(QLowEnergyController::ControllerState state) const
Handle stateChanged signals.
void connectionUpdated(const QLowEnergyConnectionParameters &newParameters) const
Handle connectionUpdated signals.
void discoveryFinished() const
Handle discoveryFinished signals.
void serviceDiscovered(const QBluetoothUuid &newService) const
Handle serviceDiscovered signals.
void connectionUpdated(const QLowEnergyConnectionParameters &newParameters)
QLowEnergyController::Error error() const const
void serviceDiscovered(const QBluetoothUuid &newService)
void stateChanged(QLowEnergyController::ControllerState state)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)

References QString::arg(), QObject::connect(), connected(), QLowEnergyController::connected(), connectionUpdated(), QLowEnergyController::connectionUpdated(), controller, QObject::disconnect(), disconnected(), QLowEnergyController::disconnected(), discoveryFinished(), QLowEnergyController::discoveryFinished(), QLowEnergyController::error(), errorOccurred(), serviceDiscovered(), QLowEnergyController::serviceDiscovered(), stateChanged(), QLowEnergyController::stateChanged(), and QObject::tr().

Here is the call graph for this function:

◆ stateChanged

void PokitDevicePrivate::stateChanged ( QLowEnergyController::ControllerState state) const
slot

Handle stateChanged signals.

Definition at line 407 of file pokitdevice.cpp.

408{
409 qCDebug(lc).noquote() << tr("State changed to:") << state;
410}

References QObject::tr().

Referenced by setController().

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

Member Data Documentation

◆ calibration

CalibrationService* PokitDevicePrivate::calibration { nullptr }

Calibration service for this Pokit device.

Definition at line 40 of file pokitdevice_p.h.

40{ nullptr }; ///< Calibration service for this Pokit device.

◆ calibrationMutex

QMutex PokitDevicePrivate::calibrationMutex

Mutex for protecting access to calibration.

Definition at line 47 of file pokitdevice_p.h.

◆ controller

QLowEnergyController* PokitDevicePrivate::controller { nullptr }

BLE controller for accessing the Pokit device.

Definition at line 38 of file pokitdevice_p.h.

38{ nullptr }; ///< BLE controller for accessing the Pokit device.

Referenced by connected(), and setController().

◆ dataLogger

DataLoggerService* PokitDevicePrivate::dataLogger { nullptr }

Data Logger service for this Pokit device.

Definition at line 41 of file pokitdevice_p.h.

41{ nullptr }; ///< Data Logger service for this Pokit device.

◆ dataLoggerMutex

QMutex PokitDevicePrivate::dataLoggerMutex

Mutex for protecting access to dataLogger.

Definition at line 48 of file pokitdevice_p.h.

◆ deviceInfo

DeviceInfoService* PokitDevicePrivate::deviceInfo { nullptr }

Device Info service for this Pokit device.

Definition at line 42 of file pokitdevice_p.h.

42{ nullptr }; ///< Device Info service for this Pokit device.

◆ deviceInfoMutex

QMutex PokitDevicePrivate::deviceInfoMutex

Mutex for protecting access to deviceInfo.

Definition at line 49 of file pokitdevice_p.h.

◆ dso

DsoService* PokitDevicePrivate::dso { nullptr }

DSO service for this Pokit device.

Definition at line 43 of file pokitdevice_p.h.

43{ nullptr }; ///< DSO service for this Pokit device.

◆ dsoMutex

QMutex PokitDevicePrivate::dsoMutex

Mutex for protecting access to dso.

Definition at line 50 of file pokitdevice_p.h.

◆ multimeter

MultimeterService* PokitDevicePrivate::multimeter { nullptr }

Multimeter service for this Pokit device.

Definition at line 44 of file pokitdevice_p.h.

44{ nullptr }; ///< Multimeter service for this Pokit device.

◆ multimeterMutex

QMutex PokitDevicePrivate::multimeterMutex

Mutex for protecting access to multimeter.

Definition at line 51 of file pokitdevice_p.h.

◆ q_ptr

PokitDevice* PokitDevicePrivate::q_ptr
protected

Internal q-pointer.

Definition at line 68 of file pokitdevice_p.h.

Referenced by PokitDevicePrivate().

◆ status

StatusService* PokitDevicePrivate::status { nullptr }

Status service for this Pokit device.

Definition at line 45 of file pokitdevice_p.h.

45{ nullptr }; ///< Status service for this Pokit device.

◆ statusMutex

QMutex PokitDevicePrivate::statusMutex

Mutex for protecting access to status.

Definition at line 52 of file pokitdevice_p.h.


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