Dokit
Internal development documentation
Loading...
Searching...
No Matches
pokitmeter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2022-2025 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
15
16/// Encapsulates details specific to Pokit Meter devices.
17namespace PokitMeter {
18
19 /// Values supported by the Pokit Meter's `Range` attributes in `*Current` modes.
20 enum class CurrentRange : quint8 {
21 _10mA = 0, ///< Up to 10mA.
22 _30mA = 1, ///< Up to 30mA.
23 _150mA = 2, ///< Up to 150mA.
24 _300mA = 3, ///< Up to 300mA.
25 _2A = 4, ///< Up to 2A.
26 AutoRange = 255 ///< Auto-range.
27 };
29 QTPOKIT_EXPORT quint32 maxValue(const CurrentRange &range);
30
31 /// Values supported by the Pokit Meter's `Range` attributes in `Resistance` mode.
32 enum class ResistanceRange : quint8 {
33 _160 = 0, ///< Up to 160Ω.
34 _330 = 1, ///< Up to 330Ω.
35 _890 = 2, ///< Up to 890Ω.
36 _1K5 = 3, ///< Up to 1.5KΩ.
37 _10K = 4, ///< Up to 10KΩ.
38 _100K = 5, ///< Up to 100KΩ.
39 _470K = 6, ///< Up to 470KΩ.
40 _1M = 7, ///< Up to 1MΩ.
41 AutoRange = 255 ///< Auto-range.
42 };
44 QTPOKIT_EXPORT quint32 maxValue(const ResistanceRange &range);
45
46 /// Values supported by the Pokit Meter's `Range` attributes in `*Voltage` modes.
47 enum class VoltageRange : quint8 {
48 _300mV = 0, ///< Up to 300mV.
49 _2V = 1, ///< Up to 2V.
50 _6V = 2, ///< Up to 6V.
51 _12V = 3, ///< Up to 12V.
52 _30V = 4, ///< Up to 30V.
53 _60V = 5, ///< Up to 60V DC (42V AC).
54 AutoRange = 255 ///< Auto-range.
55 };
57 QTPOKIT_EXPORT quint32 maxValue(const VoltageRange &range);
58
59}
60
61/// Returns \a range as a `quint8` as a convenience for assigning to services' `settings.range` members.
62constexpr quint8 operator+(PokitMeter::CurrentRange range) noexcept { return static_cast<quint8>(range); }
63
64/// Returns \a range as a `quint8` as a convenience for assigning to services' `settings.range` members.
65constexpr quint8 operator+(PokitMeter::ResistanceRange range) noexcept { return static_cast<quint8>(range); }
66
67/// Returns \a range as a `quint8` as a convenience for assigning to services' `settings.range` members.
68constexpr quint8 operator+(PokitMeter::VoltageRange range) noexcept { return static_cast<quint8>(range); }
69
71
72#endif // QTPOKIT_POKITMETER_H
Encapsulates convenience functions for working with current ranges.
Encapsulates details specific to Pokit Meter devices.
Definition pokitmeter.h:17
CurrentRange
Values supported by the Pokit Meter's Range attributes in *Current modes.
Definition pokitmeter.h:20
QTPOKIT_EXPORT QString toString(const CurrentRange &range)
Returns range as a user-friendly string.
ResistanceRange
Values supported by the Pokit Meter's Range attributes in Resistance mode.
Definition pokitmeter.h:32
VoltageRange
Values supported by the Pokit Meter's Range attributes in *Voltage modes.
Definition pokitmeter.h:47
@ _60V
Up to 60V DC (42V AC).
Definition pokitmeter.h:53
QTPOKIT_EXPORT quint32 maxValue(const CurrentRange &range)
Returns the maximum value for range in microamps, or 0 if range is not a known value for Pokit Meter ...
Encapsulates convenience functions for working with resistance ranges.
Encapsulates convenience functions for working with voltage ranges.
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:62
Global QtPokit library macros.
#define QTPOKIT_BEGIN_NAMESPACE
Macro for starting the QtPokit library's top-most namespace (if one is defined).
#define QTPOKIT_EXPORT
QtPokit library export/import macro.
#define QTPOKIT_END_NAMESPACE
Macro for ending the QtPokit library's top-most namespace (if one is defined).