Dokit
Internal development documentation
Loading...
Searching...
No Matches
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.
 
GenericAccessServicegenericAccess { nullptr }
 Generic Access 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 genericAccessMutex
 Mutex for protecting access to genericAccess.
 
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.
 

Friends

class TestPokitDevice
 

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 32 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 290 of file pokitdevice.cpp.

290 : q_ptr(q)
291{
292
293}
PokitDevice * q_ptr
Internal q-pointer.

Member Function Documentation

◆ connected

void PokitDevicePrivate::connected ( ) const
slot

Handle connected signals.

Definition at line 363 of file pokitdevice.cpp.

364{
365 if (controller == nullptr) {
366 qCCritical(lc).noquote() << tr("PokitDevicePrivate::connected slot invoked without a controller.");
367 return; // Just to avoid the nullptr dereference below.
368 }
369 qCDebug(lc).noquote() << tr(R"(Connected to "%1" (%2) at (%3).)").arg(
372}
QLowEnergyController * controller
BLE controller for accessing the Pokit device.
QString toString() const const
QBluetoothAddress remoteAddress() const const
QBluetoothUuid remoteDeviceUuid() const const
QString remoteName() const const
QString tr(const char *sourceText, const char *disambiguation, int n)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString toString() const const

References QString::arg(), controller, QLowEnergyController::remoteAddress(), QLowEnergyController::remoteDeviceUuid(), QLowEnergyController::remoteName(), QBluetoothAddress::toString(), QUuid::toString(), 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 377 of file pokitdevice.cpp.

378{
379 qCDebug(lc).noquote() << tr("Connection updated:") << newParameters.latency()
380 << newParameters.minimumInterval() << newParameters.maximumInterval()
381 << newParameters.supervisionTimeout();
382}
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 387 of file pokitdevice.cpp.

388{
389 qCDebug(lc).noquote() << tr("Device disconnected.");
390}

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 395 of file pokitdevice.cpp.

396{
397 qCDebug(lc).noquote() << tr("Service discovery finished.");
398}

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 403 of file pokitdevice.cpp.

404{
405 qCDebug(lc).noquote() << tr("Controller error:") << newError;
406}

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 411 of file pokitdevice.cpp.

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

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 308 of file pokitdevice.cpp.

309{
310 if (newController == this->controller) {
311 qCDebug(lc).noquote() << tr("Controller already set to:") << newController;
312 return;
313 }
314
315 if (this->controller) {
316 qCDebug(lc).noquote() << tr("Disconnecting signals from previous controller:")
317 << controller;
318 disconnect(this->controller, nullptr, this, nullptr);
319 }
320
321 qCDebug(lc).noquote() << tr("Setting new controller:") << newController;
322 this->controller = newController;
323 if (!newController) {
324 return; // Don't bother continuing to connect if new controller is null.
325 }
326
327 qCDebug(lc).noquote() << tr(R"(Set new controller "%1" (%2) at (%3).)").arg(
330
333
336
339
342
343
345 #if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
346 QOverload<QLowEnergyController::Error>::of(&QLowEnergyController::error),
347 #else
348 &QLowEnergyController::errorOccurred,
349 #endif
351
352
355
358}
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(), QLowEnergyController::connected(), connected(), QLowEnergyController::connectionUpdated(), connectionUpdated(), controller, QObject::disconnect(), QLowEnergyController::disconnected(), disconnected(), QLowEnergyController::discoveryFinished(), discoveryFinished(), QLowEnergyController::error(), errorOccurred(), QLowEnergyController::remoteAddress(), QLowEnergyController::remoteDeviceUuid(), QLowEnergyController::remoteName(), QLowEnergyController::serviceDiscovered(), serviceDiscovered(), QLowEnergyController::stateChanged(), stateChanged(), QBluetoothAddress::toString(), QUuid::toString(), 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 420 of file pokitdevice.cpp.

421{
422 qCDebug(lc).noquote() << tr("State changed to:") << state;
423}

References QObject::tr().

Referenced by setController().

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

Friends And Related Symbol Documentation

◆ TestPokitDevice

friend class TestPokitDevice
friend

Definition at line 76 of file pokitdevice_p.h.

Member Data Documentation

◆ calibration

CalibrationService* PokitDevicePrivate::calibration { nullptr }

Calibration service for this Pokit device.

Definition at line 41 of file pokitdevice_p.h.

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

◆ calibrationMutex

QMutex PokitDevicePrivate::calibrationMutex

Mutex for protecting access to calibration.

Definition at line 49 of file pokitdevice_p.h.

◆ controller

QLowEnergyController* PokitDevicePrivate::controller { nullptr }

BLE controller for accessing the Pokit device.

Definition at line 39 of file pokitdevice_p.h.

39{ 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 42 of file pokitdevice_p.h.

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

◆ dataLoggerMutex

QMutex PokitDevicePrivate::dataLoggerMutex

Mutex for protecting access to dataLogger.

Definition at line 50 of file pokitdevice_p.h.

◆ deviceInfo

DeviceInfoService* PokitDevicePrivate::deviceInfo { nullptr }

Device Info service for this Pokit device.

Definition at line 43 of file pokitdevice_p.h.

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

◆ deviceInfoMutex

QMutex PokitDevicePrivate::deviceInfoMutex

Mutex for protecting access to deviceInfo.

Definition at line 51 of file pokitdevice_p.h.

◆ dso

DsoService* PokitDevicePrivate::dso { nullptr }

DSO service for this Pokit device.

Definition at line 44 of file pokitdevice_p.h.

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

◆ dsoMutex

QMutex PokitDevicePrivate::dsoMutex

Mutex for protecting access to dso.

Definition at line 52 of file pokitdevice_p.h.

◆ genericAccess

GenericAccessService* PokitDevicePrivate::genericAccess { nullptr }

Generic Access service for this Pokit device.

Definition at line 45 of file pokitdevice_p.h.

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

◆ genericAccessMutex

QMutex PokitDevicePrivate::genericAccessMutex

Mutex for protecting access to genericAccess.

Definition at line 53 of file pokitdevice_p.h.

◆ multimeter

MultimeterService* PokitDevicePrivate::multimeter { nullptr }

Multimeter service for this Pokit device.

Definition at line 46 of file pokitdevice_p.h.

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

◆ multimeterMutex

QMutex PokitDevicePrivate::multimeterMutex

Mutex for protecting access to multimeter.

Definition at line 54 of file pokitdevice_p.h.

◆ q_ptr

PokitDevice* PokitDevicePrivate::q_ptr
protected

Internal q-pointer.

Definition at line 71 of file pokitdevice_p.h.

◆ status

StatusService* PokitDevicePrivate::status { nullptr }

Status service for this Pokit device.

Definition at line 47 of file pokitdevice_p.h.

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

◆ statusMutex

QMutex PokitDevicePrivate::statusMutex

Mutex for protecting access to status.

Definition at line 55 of file pokitdevice_p.h.


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