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.
 
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.
 

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

273 : q_ptr(q)
274{
275
276}
PokitDevice * q_ptr
Internal q-pointer.

Member Function Documentation

◆ connected

void PokitDevicePrivate::connected ( ) const
slot

Handle connected signals.

Definition at line 346 of file pokitdevice.cpp.

347{
348 if (controller == nullptr) {
349 qCCritical(lc).noquote() << tr("PokitDevicePrivate::connected slot invoked without a controller.");
350 return; // Just to avoid the nullptr dereference below.
351 }
352 qCDebug(lc).noquote() << tr(R"(Connected to "%1" (%2) at (%3).)").arg(
355}
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 360 of file pokitdevice.cpp.

361{
362 qCDebug(lc).noquote() << tr("Connection updated:") << newParameters.latency()
363 << newParameters.minimumInterval() << newParameters.maximumInterval()
364 << newParameters.supervisionTimeout();
365}
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 370 of file pokitdevice.cpp.

371{
372 qCDebug(lc).noquote() << tr("Device disconnected.");
373}

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

379{
380 qCDebug(lc).noquote() << tr("Service discovery finished.");
381}

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

387{
388 qCDebug(lc).noquote() << tr("Controller error:") << newError;
389}

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

395{
396 qCDebug(lc).noquote() << tr(R"(Service discovered: %1 "%2")")
397 .arg(newService.toString(), PokitDevice::serviceToString(newService));
398}
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 291 of file pokitdevice.cpp.

292{
293 if (newController == this->controller) {
294 qCDebug(lc).noquote() << tr("Controller already set to:") << newController;
295 return;
296 }
297
298 if (this->controller) {
299 qCDebug(lc).noquote() << tr("Disconnecting signals from previous controller:")
300 << controller;
301 disconnect(this->controller, nullptr, this, nullptr);
302 }
303
304 qCDebug(lc).noquote() << tr("Setting new controller:") << newController;
305 this->controller = newController;
306 if (!newController) {
307 return; // Don't bother continuing to connect if new controller is null.
308 }
309
310 qCDebug(lc).noquote() << tr(R"(Set new controller "%1" (%2) at (%3).)").arg(
313
316
319
322
325
326
328 #if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
329 QOverload<QLowEnergyController::Error>::of(&QLowEnergyController::error),
330 #else
331 &QLowEnergyController::errorOccurred,
332 #endif
334
335
338
341}
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(), QLowEnergyController::remoteAddress(), QLowEnergyController::remoteDeviceUuid(), QLowEnergyController::remoteName(), serviceDiscovered(), QLowEnergyController::serviceDiscovered(), stateChanged(), QLowEnergyController::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 403 of file pokitdevice.cpp.

404{
405 qCDebug(lc).noquote() << tr("State changed to:") << state;
406}

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 73 of file pokitdevice_p.h.

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.

◆ 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: