9#ifndef QTPOKIT_STATUSSERVICE_H
10#define QTPOKIT_STATUSSERVICE_H
14#include <QBluetoothAddress>
15#include <QBluetoothUuid>
16#include <QVersionNumber>
18QTPOKIT_BEGIN_NAMESPACE
20class StatusServicePrivate;
45 static inline const QBluetoothUuid name { QStringLiteral(
"7f0375de-077e-4555-8f78-800494509cc3") };
145 bool readDeviceCharacteristics();
146 bool readStatusCharacteristic();
147 bool readNameCharacteristic();
148 bool readTorchCharacteristic();
149 bool readButtonPressCharacteristic();
152 DeviceCharacteristics deviceCharacteristics()
const;
155 Status status()
const;
156 bool enableStatusNotifications();
157 bool disableStatusNotifications();
161 bool setDeviceName(
const QString &name);
167 std::optional<TorchStatus> torchStatus()
const;
168 bool setTorchStatus(
const TorchStatus status);
169 bool enableTorchStatusNotifications();
170 bool disableTorchStatusNotifications();
173 std::optional<ButtonStatus> buttonPress()
const;
174 bool enableButtonPressedNotifications();
175 bool disableButtonPressedNotifications();
Declares the AbstractPokitService class.
virtual bool readCharacteristics()=0
Read all characteristics.
The StatusService class accesses the Pokit Status service of Pokit devices.
Definition statusservice.h:23
StatusService(QLowEnergyController *const pokitDevice, QObject *parent=nullptr)
Constructs a new Pokit service with parent.
Definition statusservice.cpp:124
QString deviceName() const
Returns the most recent value of the Status services's Device Name characteristic.
Definition statusservice.cpp:317
ButtonStatus
Values supported by the second byte of the attribute of the (undocumented) Button Press characteristi...
Definition statusservice.h:134
@ Pressed
Button was pressed.
Definition statusservice.h:136
@ Released
Button was released.
Definition statusservice.h:135
@ Held
Button was held down (for typically 1,500ms).
Definition statusservice.h:137
void torchStatusRead(const TorchStatus &status)
This signal is emitted when the Torch characteristic has been read successfully.
void buttonPressRead(const quint8 &unknown, const ButtonStatus status)
This signal is emitted when the Button Press characteristic has been read successfully.
BatteryStatus
Values supported by the Battery Status attribute of the Status characteristic.
Definition statusservice.h:95
@ Good
Good.
Definition statusservice.h:97
@ Low
Low (replace battery).
Definition statusservice.h:96
void deviceLedFlashed()
This signal is emitted when device's LED has flashed in response to a write of the Flash LED characte...
DeviceStatus
Values supported by the Status attribute of the Status characteristic.
Definition statusservice.h:79
@ MultimeterContinuity
Multimeter is measuring continuity.
Definition statusservice.h:87
@ MultimeterAcCurrent
Multimeter is measuring AC current.
Definition statusservice.h:84
@ LoggerModeSampling
Data Logger is sampling.
Definition statusservice.h:90
@ MultimeterDcVoltage
Multimeter is measuring DC voltage.
Definition statusservice.h:81
@ DsoModeSampling
DSO is sampling.
Definition statusservice.h:89
@ MultimeterDcCurrent
Multimeter is measuring DC current.
Definition statusservice.h:83
@ MultimeterTemperature
Multimeter is measuring temperature.
Definition statusservice.h:88
@ MultimeterResistance
Multimeter is measuring resistance.
Definition statusservice.h:85
@ MultimeterDiode
Multimeter is measuring diode.
Definition statusservice.h:86
@ MultimeterAcVoltage
Multimeter is measuring AC voltage.
Definition statusservice.h:82
@ Idle
Device is idle.
Definition statusservice.h:80
SwitchPosition
Values supported by the (undocumented) Switch Position attribute of the Status characteristic.
Definition statusservice.h:102
@ HighCurrent
Device is switched to High Current position.
Definition statusservice.h:105
@ Voltage
Device is switched to Voltage position.
Definition statusservice.h:103
@ MultiMode
Device is switched to Resistance / Low Current / Capacitance / Diode position.
Definition statusservice.h:104
void deviceNameRead(const QString &deviceName)
This signal is emitted when the Device Name characteristic has been read successfully.
void deviceStatusRead(const StatusService::Status &status)
This signal is emitted when the Status characteristic has been read successfully.
void deviceCharacteristicsRead(const StatusService::DeviceCharacteristics &characteristics)
This signal is emitted when the Device Characteristics characteristic has been read successfully.
TorchStatus
Values supported by the single byte of the attribute of the (undocumented) Torch characteristic.
Definition statusservice.h:127
@ On
Torch is on.
Definition statusservice.h:129
@ Off
Torch is off.
Definition statusservice.h:128
void deviceNameWritten()
This signal is emitted when the Device Name characteristic has been written successfully.
Status status() const
Returns the most recent value of the Status service's Status characteristic.
Definition statusservice.cpp:272
void torchStatusWritten()
This signal is emitted when the Torch characteristic has been written successfully.
ChargingStatus
Values supported by the (undocumented) Charging Statue attribute of the Status characteristic.
Definition statusservice.h:110
@ Discharging
Battery is dischargin.
Definition statusservice.h:111
@ Charged
Battery is fully charged.
Definition statusservice.h:113
@ Charging
Battery is being charged.
Definition statusservice.h:112
QTPOKIT_EXPORT QString toString(const PokitProduct product)
Returns product as user-friendly string.
Definition pokitproducts.cpp:33
QObject * parent() const const
Characteristics available via the Pokit Status service.
Definition statusservice.h:37
static const QBluetoothUuid name
UUID of the Pokit Status service's Device Name characterstic.
Definition statusservice.h:45
static const QBluetoothUuid torch
UUID of the Pokit Status service's (undocumented) Torch characterstic.
Definition statusservice.h:51
static const QBluetoothUuid deviceCharacteristics
UUID of the Pokit Status service's Device Characteristics characterstic.
Definition statusservice.h:39
static const QBluetoothUuid buttonPress
UUID of the Pokit Status service's (undocumented) Button Press characterstic.
Definition statusservice.h:54
static const QBluetoothUuid flashLed
UUID of the Pokit Status service's Flash LED characterstic.
Definition statusservice.h:48
static const QBluetoothUuid status
UUID of the Pokit Status service's Status characterstic.
Definition statusservice.h:42
Attributes included in the Device Characteristics characterstic.
Definition statusservice.h:67
quint16 maximumCurrent
Device's maximum input current.
Definition statusservice.h:70
quint16 maximumSamplingRate
Device's maximum sampling rate.
Definition statusservice.h:72
quint16 samplingBufferSize
Device's sampling buffer size.
Definition statusservice.h:73
quint16 maximumVoltage
Device's maximum input voltage.
Definition statusservice.h:69
quint16 capabilityMask
Reserved.
Definition statusservice.h:74
QBluetoothAddress macAddress
Device's MAC address.
Definition statusservice.h:75
quint16 maximumResistance
Device's maximum input resistance.
Definition statusservice.h:71
QVersionNumber firmwareVersion
Device's major and minor firmware version.
Definition statusservice.h:68
UUIDs of the Pokit Status service.
Definition statusservice.h:28
static const QBluetoothUuid pokitPro
UUID of the Pokit Pro's Pokit Status service.
Definition statusservice.h:33
static const QBluetoothUuid pokitMeter
UUID of the Pokit Meter's Pokit Status service.
Definition statusservice.h:30
Attributes included in the Status characterstic.
Definition statusservice.h:118
float batteryVoltage
Current battery voltage level.
Definition statusservice.h:120
std::optional< ChargingStatus > chargingStatus
Current charging status, if supported by the device.
Definition statusservice.h:123
DeviceStatus deviceStatus
Current Pokit device status.
Definition statusservice.h:119
BatteryStatus batteryStatus
Logical interpretation the battery voltage level.
Definition statusservice.h:121
std::optional< SwitchPosition > switchPosition
Position of the Pokit device's physical mode switch.
Definition statusservice.h:122