Dokit
Native Qt library for Pokit devices
Loading...
Searching...
No Matches
pokitmeter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2022-2023 Paul Colby <git@colby.id.au>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4/*!
5 * \file
6 * Declares the PokitMeter namespace.
7 */
8
9#ifndef QTPOKIT_POKITMETER_H
10#define QTPOKIT_POKITMETER_H
11
12#include "qtpokit_global.h"
13
14#include <QVariant>
15
16QTPOKIT_BEGIN_NAMESPACE
17
18/// Encapsulates details specific to Pokit Meter devices.
19namespace PokitMeter {
20
21 /// Values supported by the Pokit Meter's `Range` attributes in `*Current` modes.
22 enum class CurrentRange : quint8 {
23 _10mA = 0, ///< Up to 10mA.
24 _30mA = 1, ///< Up to 30mA.
25 _150mA = 2, ///< Up to 150mA.
26 _300mA = 3, ///< Up to 300mA.
27 _2A = 4, ///< Up to 2A.
28 AutoRange = 255 ///< Auto-range.
29 };
30 QTPOKIT_EXPORT QString toString(const CurrentRange &range);
31 QTPOKIT_EXPORT QVariant maxValue(const CurrentRange &range);
32
33 /// Values supported by the Pokit Meter's `Range` attributes in `Resistance` mode.
34 enum class ResistanceRange : quint8 {
35 _160 = 0, ///< Up to 160Ω.
36 _330 = 1, ///< Up to 330Ω.
37 _890 = 2, ///< Up to 890Ω.
38 _1K5 = 3, ///< Up to 1.5KΩ.
39 _10K = 4, ///< Up to 10KΩ.
40 _100K = 5, ///< Up to 100KΩ.
41 _470K = 6, ///< Up to 470KΩ.
42 _1M = 7, ///< Up to 1MΩ.
43 AutoRange = 255 ///< Auto-range.
44 };
45 QTPOKIT_EXPORT QString toString(const ResistanceRange &range);
46 QTPOKIT_EXPORT QVariant maxValue(const ResistanceRange &range);
47
48 /// Values supported by the Pokit Meter's `Range` attributes in `*Voltage` modes.
49 enum class VoltageRange : quint8 {
50 _300mV = 0, ///< Up to 300mV.
51 _2V = 1, ///< Up to 2V.
52 _6V = 2, ///< Up to 6V.
53 _12V = 3, ///< Up to 12V.
54 _30V = 4, ///< Up to 30V.
55 _60V = 5, ///< Up to 60V DC (42V AC).
56 AutoRange = 255 ///< Auto-range.
57 };
58 QTPOKIT_EXPORT QString toString(const VoltageRange &range);
59 QTPOKIT_EXPORT QVariant maxValue(const VoltageRange &range);
60
61}
62
63/// Returns \a range as a `quint8` as a convenience for assigning to services' `settings.range` members.
64constexpr quint8 operator+(PokitMeter::CurrentRange range) noexcept { return static_cast<quint8>(range); }
65
66/// Returns \a range as a `quint8` as a convenience for assigning to services' `settings.range` members.
67constexpr quint8 operator+(PokitMeter::ResistanceRange range) noexcept { return static_cast<quint8>(range); }
68
69/// Returns \a range as a `quint8` as a convenience for assigning to services' `settings.range` members.
70constexpr quint8 operator+(PokitMeter::VoltageRange range) noexcept { return static_cast<quint8>(range); }
71
72QTPOKIT_END_NAMESPACE
73
74#endif // QTPOKIT_POKITMETER_H
Encapsulates details specific to Pokit Meter devices.
Definition pokitmeter.h:19
CurrentRange
Values supported by the Pokit Meter's Range attributes in *Current modes.
Definition pokitmeter.h:22
QTPOKIT_EXPORT QString toString(const CurrentRange &range)
Returns range as a user-friendly string.
Definition pokitmeter.cpp:16
QTPOKIT_EXPORT QVariant maxValue(const CurrentRange &range)
Returns the maximum value for range in (integer) microamps, or the string "Auto".
Definition pokitmeter.cpp:33
ResistanceRange
Values supported by the Pokit Meter's Range attributes in Resistance mode.
Definition pokitmeter.h:34
VoltageRange
Values supported by the Pokit Meter's Range attributes in *Voltage modes.
Definition pokitmeter.h:49
@ _60V
Up to 60V DC (42V AC).
constexpr quint8 operator+(PokitMeter::CurrentRange range) noexcept
Returns range as a quint8 as a convenience for assigning to services' settings.range members.
Definition pokitmeter.h:64
Global QtPokit library macros.