Dokit
dev
v0.6.0
v0.5.8
v0.5.7
v0.5.6
v0.5.5
v0.5.4
v0.5.3
v0.5.2
v0.5.1
v0.5.0
v0.4.0
v0.3.0
v0.2.0
v0.1.2
v0.1.1
v0.1.0
User docs
Internal
Coverage
Internal development documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
pokitpro.cpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2022-2026 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
#include <QLoggingCategory>
13
14
QTPOKIT_BEGIN_NAMESPACE
15
16
namespace
PokitPro
{
17
18
static
Q_LOGGING_CATEGORY
(lc,
"dokit.pokit.products.pro"
, QtInfoMsg);
///< Logging category for this file.
19
20
namespace
{
21
class
Private
22
{
23
Q_DECLARE_TR_FUNCTIONS(
PokitPro
)
24
};
25
}
26
27
/*!
28
* \cond internal
29
* \enum CapacitanceRange
30
* \pokitApi These Pokit Pro enumeration values are as-yet undocumented by Pokit Innovations.
31
* [\@pcolby](https://github.com/pcolby) reverse-engineered them as part of the
32
* [dokit](https://github.com/pcolby/dokit) project.
33
* \endcond
34
*/
35
36
/// Returns \a range as a user-friendly string.
37
QString
toString
(
const
CapacitanceRange
&range)
38
{
39
switch
(range) {
40
case
CapacitanceRange::_100nF
:
return
Private::tr(
"Up to 100nF"
);
41
case
CapacitanceRange::_10uF
:
return
Private::tr(
"Up to 10μF"
);
42
case
CapacitanceRange::_1mF
:
return
Private::tr(
"Up to 1mF"
);
43
case
CapacitanceRange::AutoRange
:
return
Private::tr(
"Auto-range"
);
44
default
:
return
QString
();
45
}
46
}
47
48
/*!
49
* Returns the maximum value for \a range in nanofarads, or 0 if \a range is not a known value for Pokit Pro devices.
50
*/
51
quint32
maxValue
(
const
CapacitanceRange
&range)
52
{
53
switch
(range) {
54
case
CapacitanceRange::_100nF
:
return
100;
55
case
CapacitanceRange::_10uF
:
return
10'000;
56
case
CapacitanceRange::_1mF
:
return
1'000'000;
57
case
CapacitanceRange::AutoRange
:
return
1'000'000;
58
default
:
59
qCWarning(lc).noquote() << Private::tr(
"Unknown CapacitanceRange value: %1"
).arg((
int
)range);
60
return
0;
61
}
62
}
63
64
/*!
65
* \cond internal
66
* \enum CurrentRange
67
* \pokitApi These Pokit Pro enumeration values are as-yet undocumented by Pokit Innovations.
68
* [\@pcolby](https://github.com/pcolby) reverse-engineered them as part of the
69
* [dokit](https://github.com/pcolby/dokit) project.
70
* \endcond
71
*/
72
73
/// Returns \a range as a user-friendly string.
74
QString
toString
(
const
CurrentRange
&range)
75
{
76
switch
(range) {
77
case
CurrentRange::_500uA
:
return
Private::tr(
"Up to 500μA"
);
78
case
CurrentRange::_2mA
:
return
Private::tr(
"Up to 2mA"
);
79
case
CurrentRange::_10mA
:
return
Private::tr(
"Up to 10mA"
);
80
case
CurrentRange::_125mA
:
return
Private::tr(
"Up to 125mA"
);
81
case
CurrentRange::_300mA
:
return
Private::tr(
"Up to 300mA"
);
82
case
CurrentRange::_3A
:
return
Private::tr(
"Up to 3A"
);
83
case
CurrentRange::_10A
:
return
Private::tr(
"Up to 10A"
);
84
case
CurrentRange::AutoRange
:
return
Private::tr(
"Auto-range"
);
85
default
:
return
QString
();
86
}
87
}
88
89
/*!
90
* Returns the maximum value for \a range in microamps, or 0 if \a range is not a known value for Pokit Pro devices.
91
*/
92
quint32
maxValue
(
const
CurrentRange
&range)
93
{
94
switch
(range) {
95
case
CurrentRange::_500uA
:
return
500;
96
case
CurrentRange::_2mA
:
return
2'000;
97
case
CurrentRange::_10mA
:
return
10'000;
98
case
CurrentRange::_125mA
:
return
125'000;
99
case
CurrentRange::_300mA
:
return
300'000;
100
case
CurrentRange::_3A
:
return
3'000'000;
101
case
CurrentRange::_10A
:
return
10'000'000;
102
case
CurrentRange::AutoRange
:
return
10'000'000;
103
default
:
104
qCWarning(lc).noquote() << Private::tr(
"Unknown CurrentRange value: %1"
).arg((
int
)range);
105
return
0;
106
}
107
}
108
109
/*!
110
* \cond internal
111
* \enum ResistanceRange
112
* \pokitApi These Pokit Pro enumeration values are as-yet undocumented by Pokit Innovations.
113
* [\@pcolby](https://github.com/pcolby) reverse-engineered them as part of the
114
* [dokit](https://github.com/pcolby/dokit) project.
115
* \endcond
116
*/
117
118
/// Returns \a range as a user-friendly string.
119
QString
toString
(
const
ResistanceRange
&range)
120
{
121
switch
(range) {
122
case
ResistanceRange::_30
:
return
Private::tr(
"Up to 30Ω"
);
123
case
ResistanceRange::_75
:
return
Private::tr(
"Up to 75Ω"
);
124
case
ResistanceRange::_400
:
return
Private::tr(
"Up to 400Ω"
);
125
case
ResistanceRange::_5K
:
return
Private::tr(
"Up to 5KΩ"
);
126
case
ResistanceRange::_10K
:
return
Private::tr(
"Up to 10KΩ"
);
127
case
ResistanceRange::_15K
:
return
Private::tr(
"Up to 15KΩ"
);
128
case
ResistanceRange::_40K
:
return
Private::tr(
"Up to 40KΩ"
);
129
case
ResistanceRange::_500K
:
return
Private::tr(
"Up to 500KΩ"
);
130
case
ResistanceRange::_700K
:
return
Private::tr(
"Up to 700KΩ"
);
131
case
ResistanceRange::_1M
:
return
Private::tr(
"Up to 1MΩ"
);
132
case
ResistanceRange::_3M
:
return
Private::tr(
"Up to 3MΩ"
);
133
case
ResistanceRange::AutoRange
:
return
Private::tr(
"Auto-range"
);
134
default
:
return
QString
();
135
}
136
}
137
138
/*!
139
* Returns the maximum value for \a range in ohms, or 0 if \a range is not a known value for Pokit Pro devices.
140
*/
141
quint32
maxValue
(
const
ResistanceRange
&range)
142
{
143
switch
(range) {
144
case
ResistanceRange::_30
:
return
30;
145
case
ResistanceRange::_75
:
return
75;
146
case
ResistanceRange::_400
:
return
400;
147
case
ResistanceRange::_5K
:
return
5'000;
148
case
ResistanceRange::_10K
:
return
10'000;
149
case
ResistanceRange::_15K
:
return
15'000;
150
case
ResistanceRange::_40K
:
return
40'000;
151
case
ResistanceRange::_500K
:
return
500'000;
152
case
ResistanceRange::_700K
:
return
700'000;
153
case
ResistanceRange::_1M
:
return
1'000'000;
154
case
ResistanceRange::_3M
:
return
3'000'000;
155
case
ResistanceRange::AutoRange
:
return
3'000'000;
156
default
:
157
qCWarning(lc).noquote() << Private::tr(
"Unknown ResistanceRange value: %1"
).arg((
int
)range);
158
return
0;
159
}
160
}
161
162
/*!
163
* \cond internal
164
* \enum VoltageRange
165
* \pokitApi These Pokit Pro enumeration values are as-yet undocumented by Pokit Innovations.
166
* [\@pcolby](https://github.com/pcolby) reverse-engineered them as part of the
167
* [dokit](https://github.com/pcolby/dokit) project.
168
* \endcond
169
*/
170
171
/// Returns \a range as a user-friendly string.
172
QString
toString
(
const
VoltageRange
&range)
173
{
174
switch
(range) {
175
case
VoltageRange::_250mV
:
return
Private::tr(
"Up to 250mV"
);
176
case
VoltageRange::_2V
:
return
Private::tr(
"Up to 2V"
);
177
case
VoltageRange::_10V
:
return
Private::tr(
"Up to 10V"
);
178
case
VoltageRange::_30V
:
return
Private::tr(
"Up to 30V"
);
179
case
VoltageRange::_60V
:
return
Private::tr(
"Up to 60V"
);
180
case
VoltageRange::_125V
:
return
Private::tr(
"Up to 125V"
);
181
case
VoltageRange::_400V
:
return
Private::tr(
"Up to 400V"
);
182
case
VoltageRange::_600V
:
return
Private::tr(
"Up to 600V"
);
183
case
VoltageRange::AutoRange
:
return
Private::tr(
"Auto-range"
);
184
default
:
return
QString
();
185
}
186
}
187
188
/*!
189
* Returns the maximum value for \a range in millivolts, or 0 if \a range is not a known value for Pokit Pro devices.
190
*/
191
quint32
maxValue
(
const
VoltageRange
&range)
192
{
193
switch
(range) {
194
case
VoltageRange::_250mV
:
return
250;
195
case
VoltageRange::_2V
:
return
2'000;
196
case
VoltageRange::_10V
:
return
10'000;
197
case
VoltageRange::_30V
:
return
30'000;
198
case
VoltageRange::_60V
:
return
60'000;
199
case
VoltageRange::_125V
:
return
125'000;
200
case
VoltageRange::_400V
:
return
400'000;
201
case
VoltageRange::_600V
:
return
600'000;
202
case
VoltageRange::AutoRange
:
return
600'000;
203
default
:
204
qCWarning(lc).noquote() << Private::tr(
"Unknown VoltageRange value: %1"
).arg((
int
)range);
205
return
0;
206
}
207
}
208
209
}
210
211
QTPOKIT_END_NAMESPACE
PokitPro::anonymous_namespace{pokitpro.cpp}::Private
Definition
pokitpro.cpp:22
CapacitanceRange
Encapsulates convenience functions for working with capacitance ranges.
Definition
pokitproducts.cpp:130
CurrentRange
Encapsulates convenience functions for working with current ranges.
Definition
pokitproducts.cpp:175
PokitPro
Encapsulates details specific to Pokit Pro devices.
Definition
pokitpro.h:17
PokitPro::toString
QTPOKIT_EXPORT QString toString(const CapacitanceRange &range)
Returns range as a user-friendly string.
Definition
pokitpro.cpp:37
PokitPro::VoltageRange::_10V
@ _10V
Up to 10V.
Definition
pokitpro.h:66
PokitPro::VoltageRange::_60V
@ _60V
Up to 60V.
Definition
pokitpro.h:68
PokitPro::VoltageRange::AutoRange
@ AutoRange
Auto-range. Note, Pokit Pro does not allow AutoRange in DSO service.
Definition
pokitpro.h:72
PokitPro::VoltageRange::_250mV
@ _250mV
Up to 250mV.
Definition
pokitpro.h:64
PokitPro::VoltageRange::_2V
@ _2V
Up to 2V.
Definition
pokitpro.h:65
PokitPro::VoltageRange::_30V
@ _30V
Up to 30V.
Definition
pokitpro.h:67
PokitPro::VoltageRange::_400V
@ _400V
Up to 400V.
Definition
pokitpro.h:70
PokitPro::VoltageRange::_600V
@ _600V
Up to 600V.
Definition
pokitpro.h:71
PokitPro::VoltageRange::_125V
@ _125V
Up to 125V.
Definition
pokitpro.h:69
PokitPro::CurrentRange::_10A
@ _10A
Up to 10A.
Definition
pokitpro.h:38
PokitPro::CurrentRange::_500uA
@ _500uA
Up to 5μA.
Definition
pokitpro.h:32
PokitPro::CurrentRange::AutoRange
@ AutoRange
Auto-range. Note, Pokit Pro does not allow AutoRange in DSO service.
Definition
pokitpro.h:39
PokitPro::CurrentRange::_10mA
@ _10mA
Up to 10mA.
Definition
pokitpro.h:34
PokitPro::CurrentRange::_2mA
@ _2mA
Up to 2mA.
Definition
pokitpro.h:33
PokitPro::CurrentRange::_300mA
@ _300mA
Up to 300mA.
Definition
pokitpro.h:36
PokitPro::CurrentRange::_3A
@ _3A
Up to 3A.
Definition
pokitpro.h:37
PokitPro::CurrentRange::_125mA
@ _125mA
Up to 125mA.
Definition
pokitpro.h:35
PokitPro::ResistanceRange::_15K
@ _15K
Up to 15KΩ.
Definition
pokitpro.h:51
PokitPro::ResistanceRange::_400
@ _400
Up to 400Ω.
Definition
pokitpro.h:48
PokitPro::ResistanceRange::_40K
@ _40K
Up to 40KΩ.
Definition
pokitpro.h:52
PokitPro::ResistanceRange::_10K
@ _10K
Up to 10KΩ.
Definition
pokitpro.h:50
PokitPro::ResistanceRange::_1M
@ _1M
Up to 1MΩ.
Definition
pokitpro.h:55
PokitPro::ResistanceRange::_500K
@ _500K
Up to 500KΩ.
Definition
pokitpro.h:53
PokitPro::ResistanceRange::AutoRange
@ AutoRange
Auto-range.
Definition
pokitpro.h:57
PokitPro::ResistanceRange::_3M
@ _3M
Up to 3MΩ.
Definition
pokitpro.h:56
PokitPro::ResistanceRange::_700K
@ _700K
Up to 700KΩ.
Definition
pokitpro.h:54
PokitPro::ResistanceRange::_5K
@ _5K
Up to 5KΩ.
Definition
pokitpro.h:49
PokitPro::ResistanceRange::_30
@ _30
Up to 30Ω.
Definition
pokitpro.h:46
PokitPro::ResistanceRange::_75
@ _75
Up to 75Ω.
Definition
pokitpro.h:47
PokitPro::Q_LOGGING_CATEGORY
static Q_LOGGING_CATEGORY(lc, "dokit.pokit.products.pro", QtInfoMsg)
Logging category for this file.
PokitPro::CapacitanceRange::_1mF
@ _1mF
Up 1mF.
Definition
pokitpro.h:23
PokitPro::CapacitanceRange::_10uF
@ _10uF
Up 10μF.
Definition
pokitpro.h:22
PokitPro::CapacitanceRange::AutoRange
@ AutoRange
Auto-range.
Definition
pokitpro.h:24
PokitPro::CapacitanceRange::_100nF
@ _100nF
Up 100nF.
Definition
pokitpro.h:21
PokitPro::maxValue
QTPOKIT_EXPORT quint32 maxValue(const CapacitanceRange &range)
Returns the maximum value for range in nanofarads, or 0 if range is not a known value for Pokit Pro d...
Definition
pokitpro.cpp:51
ResistanceRange
Encapsulates convenience functions for working with resistance ranges.
Definition
pokitproducts.cpp:216
VoltageRange
Encapsulates convenience functions for working with voltage ranges.
Definition
pokitproducts.cpp:257
pokitpro.h
Declares the PokitPro namespace.
QString
QString::QString
QString()
QTPOKIT_BEGIN_NAMESPACE
#define QTPOKIT_BEGIN_NAMESPACE
Macro for starting the QtPokit library's top-most namespace (if one is defined).
Definition
qtpokit_global.h:81
QTPOKIT_END_NAMESPACE
#define QTPOKIT_END_NAMESPACE
Macro for ending the QtPokit library's top-most namespace (if one is defined).
Definition
qtpokit_global.h:82
dokit
dokit
src
lib
pokitpro.cpp
Generated by
1.18.0