Dokit
Internal development documentation
Loading...
Searching...
No Matches
pokitpro.cpp
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 * Defined the PokitPro helper functions.
7 */
8
9#include "qtpokit/pokitpro.h"
10
11#include <QCoreApplication>
12
13namespace PokitPro {
14
15/*!
16 * \cond internal
17 * \enum CapacitanceRange
18 * \pokitApi These Pokit Pro enumeration values are as-yet undocumented by Pokit Innovations.
19 * [\@pcolby](https://github.com/pcolby) reverse-engineered them as part of the
20 * [dokit](https://github.com/pcolby/dokit) project.
21 * \endcond
22 */
23
24/// Returns \a range as a user-friendly string.
26{
27 switch (range) {
28 case CapacitanceRange::_100nF: return QCoreApplication::translate("PokitPro", "Up to 100nF", "CapacitanceRange");
29 case CapacitanceRange::_10uF: return QCoreApplication::translate("PokitPro", "Up to 10μF", "CapacitanceRange");
30 case CapacitanceRange::_1mF: return QCoreApplication::translate("PokitPro", "Up to 1mF", "CapacitanceRange");
31 case CapacitanceRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto-range", "CapacitanceRange");
32 default: return QString();
33 }
34}
35
36/*!
37 * Returns the maximum value for \a range in (integer) nanofarads, or the string "Auto".
38 * If \a range is not a known valid value, then an null QVariant is returned.
39 */
41{
42 switch (range) {
43 case CapacitanceRange::_100nF: return 100;
44 case CapacitanceRange::_10uF: return 10'000;
45 case CapacitanceRange::_1mF: return 1'000'000;
46 case CapacitanceRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto", "CapacitanceRange");
47 default: return QVariant();
48 }
49}
50
51/*!
52 * \cond internal
53 * \enum CurrentRange
54 * \pokitApi These Pokit Pro enumeration values are as-yet undocumented by Pokit Innovations.
55 * [\@pcolby](https://github.com/pcolby) reverse-engineered them as part of the
56 * [dokit](https://github.com/pcolby/dokit) project.
57 * \endcond
58 */
59
60/// Returns \a range as a user-friendly string.
62{
63 switch (range) {
64 case CurrentRange::_500uA: return QCoreApplication::translate("PokitPro", "Up to 500μA", "CurrentRange");
65 case CurrentRange::_2mA: return QCoreApplication::translate("PokitPro", "Up to 2mA", "CurrentRange");
66 case CurrentRange::_10mA: return QCoreApplication::translate("PokitPro", "Up to 10mA", "CurrentRange");
67 case CurrentRange::_125mA: return QCoreApplication::translate("PokitPro", "Up to 125mA", "CurrentRange");
68 case CurrentRange::_300mA: return QCoreApplication::translate("PokitPro", "Up to 300mA", "CurrentRange");
69 case CurrentRange::_3A: return QCoreApplication::translate("PokitPro", "Up to 3A", "CurrentRange");
70 case CurrentRange::_10A: return QCoreApplication::translate("PokitPro", "Up to 10A", "CurrentRange");
71 case CurrentRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto-range", "CurrentRange");
72 default: return QString();
73 }
74}
75
76/*!
77 * Returns the maximum value for \a range in (integer) microamps, or the string "Auto".
78 * If \a range is not a known valid value, then an null QVariant is returned.
79 */
81{
82 switch (range) {
83 case CurrentRange::_500uA: return 500;
84 case CurrentRange::_2mA: return 2'000;
85 case CurrentRange::_10mA: return 10'000;
86 case CurrentRange::_125mA: return 125'000;
87 case CurrentRange::_300mA: return 300'000;
88 case CurrentRange::_3A: return 3'000'000;
89 case CurrentRange::_10A: return 10'000'000;
90 case CurrentRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto", "CurrentRange");
91 default: return QVariant();
92 }
93}
94
95/*!
96 * \cond internal
97 * \enum ResistanceRange
98 * \pokitApi These Pokit Pro enumeration values are as-yet undocumented by Pokit Innovations.
99 * [\@pcolby](https://github.com/pcolby) reverse-engineered them as part of the
100 * [dokit](https://github.com/pcolby/dokit) project.
101 * \endcond
102 */
103
104/// Returns \a range as a user-friendly string.
106{
107 switch (range) {
108 case ResistanceRange::_30: return QCoreApplication::translate("PokitPro", "Up to 30Ω", "ResistanceRange");
109 case ResistanceRange::_75: return QCoreApplication::translate("PokitPro", "Up to 75Ω", "ResistanceRange");
110 case ResistanceRange::_400: return QCoreApplication::translate("PokitPro", "Up to 400Ω", "ResistanceRange");
111 case ResistanceRange::_5K: return QCoreApplication::translate("PokitPro", "Up to 5KΩ", "ResistanceRange");
112 case ResistanceRange::_10K: return QCoreApplication::translate("PokitPro", "Up to 10KΩ", "ResistanceRange");
113 case ResistanceRange::_15K: return QCoreApplication::translate("PokitPro", "Up to 15KΩ", "ResistanceRange");
114 case ResistanceRange::_40K: return QCoreApplication::translate("PokitPro", "Up to 40KΩ", "ResistanceRange");
115 case ResistanceRange::_500K: return QCoreApplication::translate("PokitPro", "Up to 500KΩ", "ResistanceRange");
116 case ResistanceRange::_700K: return QCoreApplication::translate("PokitPro", "Up to 700KΩ", "ResistanceRange");
117 case ResistanceRange::_1M: return QCoreApplication::translate("PokitPro", "Up to 1MΩ", "ResistanceRange");
118 case ResistanceRange::_3M: return QCoreApplication::translate("PokitPro", "Up to 3MΩ", "ResistanceRange");
119 case ResistanceRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto-range", "ResistanceRange");
120 default: return QString();
121 }
122}
123
124/*!
125 * Returns the maximum value for \a range in (integer) ohms, or the string "Auto".
126 * If \a range is not a known valid value, then an null QVariant is returned.
127 */
129{
130 switch (range) {
131 case ResistanceRange::_30: return 30;
132 case ResistanceRange::_75: return 75;
133 case ResistanceRange::_400: return 400;
134 case ResistanceRange::_5K: return 5'000;
135 case ResistanceRange::_10K: return 10'000;
136 case ResistanceRange::_15K: return 15'000;
137 case ResistanceRange::_40K: return 40'000;
138 case ResistanceRange::_500K: return 500'000;
139 case ResistanceRange::_700K: return 700'000;
140 case ResistanceRange::_1M: return 1'000'000;
141 case ResistanceRange::_3M: return 3'000'000;
142 case ResistanceRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto", "ResistanceRange");
143 default: return QVariant();
144 }
145}
146
147/*!
148 * \cond internal
149 * \enum VoltageRange
150 * \pokitApi These Pokit Pro enumeration values are as-yet undocumented by Pokit Innovations.
151 * [\@pcolby](https://github.com/pcolby) reverse-engineered them as part of the
152 * [dokit](https://github.com/pcolby/dokit) project.
153 * \endcond
154 */
155
156/// Returns \a range as a user-friendly string.
158{
159 switch (range) {
160 case VoltageRange::_250mV: return QCoreApplication::translate("PokitPro", "Up to 250mV", "VoltageRange");
161 case VoltageRange::_2V: return QCoreApplication::translate("PokitPro", "Up to 2V", "VoltageRange");
162 case VoltageRange::_10V: return QCoreApplication::translate("PokitPro", "Up to 10V", "VoltageRange");
163 case VoltageRange::_30V: return QCoreApplication::translate("PokitPro", "Up to 30V", "VoltageRange");
164 case VoltageRange::_60V: return QCoreApplication::translate("PokitPro", "Up to 60V", "VoltageRange");
165 case VoltageRange::_125V: return QCoreApplication::translate("PokitPro", "Up to 125V", "VoltageRange");
166 case VoltageRange::_400V: return QCoreApplication::translate("PokitPro", "Up to 400V", "VoltageRange");
167 case VoltageRange::_600V: return QCoreApplication::translate("PokitPro", "Up to 600V", "VoltageRange");
168 case VoltageRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto-range", "VoltageRange");
169 default: return QString();
170 }
171}
172
173/*!
174 * Returns the maximum value for \a range in (integer) millivolts, or the string "Auto".
175 * If \a range is not a known valid value, then an null QVariant is returned.
176 */
178{
179 switch (range) {
180 case VoltageRange::_250mV: return 250;
181 case VoltageRange::_2V: return 2'000;
182 case VoltageRange::_10V: return 10'000;
183 case VoltageRange::_30V: return 30'000;
184 case VoltageRange::_60V: return 60'000;
185 case VoltageRange::_125V: return 125'000;
186 case VoltageRange::_400V: return 400'000;
187 case VoltageRange::_600V: return 600'000;
188 case VoltageRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto", "VoltageRange");
189 default: return QVariant();
190 }
191}
192
193}
Encapsulates convenience functions for working with capacitance ranges.
Encapsulates convenience functions for working with current ranges.
Encapsulates details specific to Pokit Pro devices.
Definition pokitpro.h:19
QTPOKIT_EXPORT QVariant maxValue(const CapacitanceRange &range)
Returns the maximum value for range in (integer) nanofarads, or the string "Auto".
Definition pokitpro.cpp:40
QTPOKIT_EXPORT QString toString(const CapacitanceRange &range)
Returns range as a user-friendly string.
Definition pokitpro.cpp:25
@ AutoRange
Auto-range.
@ _250mV
Up to 250mV.
@ AutoRange
Auto-range.
@ _300mA
Up to 300mA.
@ _125mA
Up to 125mA.
Encapsulates convenience functions for working with resistance ranges.
Encapsulates convenience functions for working with voltage ranges.
Declares the PokitPro namespace.
QString translate(const char *context, const char *sourceText, const char *disambiguation, int n)