4#ifndef DOKIT_DEVICECOMMAND_H
5#define DOKIT_DEVICECOMMAND_H
7#include "abstractcommand.h"
10#include <QLowEnergyController>
23 bool start()
override;
32 template<
typename T>
static T
minRange(
const quint32 maxValue);
49 friend class TestDeviceCommand;
The AbstractCommand class provides a consistent base for the classes that implement CLI commands.
The AbstractPokitService class provides a common base for Pokit services classes.
The AbstractCommand class extends AbstractCommand to add a PokitDevice instance.
static quint8 minResistanceRange(const PokitProduct product, const quint32 maxValue)
Returns the product's lowest resistance range that can measure at least up to maxValue (Ω),...
virtual void controllerError(const QLowEnergyController::Error error)
Handles controller error events.
PokitDevice * device
Pokit Bluetooth device (if any) this command inerracts with.
static T minRange(const quint32 maxValue)
virtual void deviceDisconnected()
Handles devics disconnection events.
DeviceCommand(QObject *const parent=nullptr)
Construct a new DeviceCommand object with parent.
bool start() override
Begins scanning for the Pokit device.
int exitCodeOnDisconnect
Exit code to return on device disconnection.
void deviceDiscoveryFinished() override
Checks that the requested device was discovered, and if not, reports and error and exits.
static quint8 minCapacitanceRange(const PokitProduct product, const quint32 maxValue)
Returns the product's lowest capacitance range that can measure at least up to maxValue (nF),...
virtual AbstractPokitService * getService()=0
Returns a Pokit service object for the derived command class.
virtual void serviceDetailsDiscovered()
Handles service detail discovery events.
static quint8 minVoltageRange(const PokitProduct product, const quint32 maxValue)
t Returns the product's lowest voltage range that can measure at least up to maxValue (mV),...
virtual void serviceError(const QLowEnergyService::ServiceError error)
Handles service error events.
static quint8 minCurrentRange(const PokitProduct product, const quint32 maxValue)
Returns the product's lowest current range that can measure at least up to maxValue (µA),...
void deviceDiscovered(const QBluetoothDeviceInfo &info) override
Checks if info is the device (if any) we're looking for, and if so, create a contoller and service,...
void disconnect(int exitCode=EXIT_SUCCESS)
Disconnects the underlying Pokit device, and sets exitCode to be return to the OS once the disconnect...
The PokitDevice class simplifies Pokit device access.
Declares the PokitProduct enumeration, and related helper functions.
PokitProduct
Pokit products known to, and supported by, the QtPokit library.
QObject * parent() const const