Dokit 0.5.3-pre
Internal development documentation
Loading...
Searching...
No Matches
pokitproducts.h File Reference

Declares the PokitProduct enumeration, and related helper functions. More...

#include "qtpokit_global.h"
#include <QBluetoothDeviceInfo>
#include <QFlags>
#include <QString>
Include dependency graph for pokitproducts.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum class  PokitProduct : quint8 { PokitMeter = 0 , PokitPro = 1 }
 Pokit products known to, and supported by, the QtPokit library. More...
 

Functions

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.
 
QTPOKIT_EXPORT PokitProduct pokitProduct (const QBluetoothDeviceInfo &info)
 Returns the PokitProduct corresponding the Bluetotoh device info.
 

Detailed Description

Declares the PokitProduct enumeration, and related helper functions.

Definition in file pokitproducts.h.

Enumeration Type Documentation

◆ PokitProduct

enum class PokitProduct : quint8
strong

Pokit products known to, and supported by, the QtPokit library.

Enumerator
PokitMeter 

Pokit Meter.

PokitPro 

Pokit Pro.

Definition at line 21 of file pokitproducts.h.

21 : quint8 {
22 //PokitClamp = 3, ///< \todo Pokit Clamp
23 PokitMeter = 0, ///< Pokit Meter
24 PokitPro = 1, ///< Pokit Pro
25};
Encapsulates details specific to Pokit Meter devices.
Definition pokitmeter.h:19
Encapsulates details specific to Pokit Pro devices.
Definition pokitpro.h:19

Function Documentation

◆ isPokitProduct()

QTPOKIT_EXPORT bool isPokitProduct ( const QBluetoothDeviceInfo & info)

Returns true if info describes a Pokit device.

Currently, this is based on whether or not info's service UUIDs includes a known Pokit Status service, but this test criteria might be swapped for something else sometime.

Definition at line 43 of file pokitproducts.cpp.

44{
45 return isPokitProduct(info.serviceUuids());
46}
bool isPokitProduct(const QBluetoothDeviceInfo &info)
Returns true if info describes a Pokit device.
QList< QBluetoothUuid > serviceUuids(QBluetoothDeviceInfo::DataCompleteness *completeness) const const

References isPokitProduct(), and QBluetoothDeviceInfo::serviceUuids().

Referenced by DeviceCommand::deviceDiscovered(), PokitDiscoveryAgentPrivate::deviceDiscovered(), PokitDiscoveryAgentPrivate::deviceUpdated(), isPokitProduct(), and isPokitProduct().

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

◆ pokitProduct()

QTPOKIT_EXPORT PokitProduct pokitProduct ( const QBluetoothDeviceInfo & info)

Returns the PokitProduct corresponding the Bluetotoh device info.

If info is not a Pokit device, then result is undefined.

See also
isPokitProduct

Definition at line 55 of file pokitproducts.cpp.

56{
57 return pokitProduct(info.serviceUuids());
58}
PokitProduct pokitProduct(const QBluetoothDeviceInfo &info)
Returns the PokitProduct corresponding the Bluetotoh device info.

References pokitProduct(), and QBluetoothDeviceInfo::serviceUuids().

Referenced by DeviceCommand::deviceDiscovered(), pokitProduct(), and pokitProduct().

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

◆ toString()

QTPOKIT_EXPORT QString toString ( const PokitProduct product)

Returns product as user-friendly string.

Definition at line 26 of file pokitproducts.cpp.

27{
28 switch (product) {
29 case PokitProduct::PokitMeter: return QStringLiteral("Pokit Meter");
30 case PokitProduct::PokitPro: return QStringLiteral("Pokit Pro");
31 }
32 qCWarning(lc).noquote() << QCoreApplication::translate("PokitProducts",
33 "Unknown PokitProduct value: %1", "toString").arg((int)product);
34 return QString();
35}
@ PokitPro
Pokit Pro.
@ PokitMeter
Pokit Meter.
QString translate(const char *context, const char *sourceText, const char *disambiguation, int n)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const

References QString::arg(), PokitMeter, PokitPro, and QCoreApplication::translate().

Referenced by AbstractPokitServicePrivate::createServiceObject(), and DeviceCommand::deviceDiscovered().

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