Skip to content

Commit

Permalink
Use quint32 for all maxValue return types
Browse files Browse the repository at this point in the history
  • Loading branch information
pcolby committed Dec 26, 2024
1 parent f947fde commit d5a12ab
Show file tree
Hide file tree
Showing 21 changed files with 586 additions and 539 deletions.
4 changes: 2 additions & 2 deletions include/qtpokit/dataloggerservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class QTPOKIT_EXPORT DataLoggerService : public AbstractPokitService

static QString toString(const PokitProduct product, const quint8 range, const Mode mode);
QString toString(const quint8 range, const Mode mode) const;
static std::optional<quint32> maxValue(const PokitProduct product, const quint8 range, const Mode mode);
std::optional<quint32> maxValue(const quint8 range, const Mode mode) const;
static quint32 maxValue(const PokitProduct product, const quint8 range, const Mode mode);
quint32 maxValue(const quint8 range, const Mode mode) const;

/// Attributes included in the `Settings` characterstic.
struct Settings {
Expand Down
4 changes: 2 additions & 2 deletions include/qtpokit/dsoservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class QTPOKIT_EXPORT DsoService : public AbstractPokitService

static QString toString(const PokitProduct product, const quint8 range, const Mode mode);
QString toString(const quint8 range, const Mode mode) const;
static std::optional<quint32> maxValue(const PokitProduct product, const quint8 range, const Mode mode);
std::optional<quint32> maxValue(const quint8 range, const Mode mode) const;
static quint32 maxValue(const PokitProduct product, const quint8 range, const Mode mode);
quint32 maxValue(const quint8 range, const Mode mode) const;

/// Attributes included in the `Settings` characterstic.
struct Settings {
Expand Down
4 changes: 2 additions & 2 deletions include/qtpokit/multimeterservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class QTPOKIT_EXPORT MultimeterService : public AbstractPokitService

static QString toString(const PokitProduct product, const quint8 range, const Mode mode);
QString toString(const quint8 range, const Mode mode) const;
static std::optional<quint32> maxValue(const PokitProduct product, const quint8 range, const Mode mode);
std::optional<quint32> maxValue(const quint8 range, const Mode mode) const;
static quint32 maxValue(const PokitProduct product, const quint8 range, const Mode mode);
quint32 maxValue(const quint8 range, const Mode mode) const;

/// Attributes included in the `Settings` characterstic.
struct Settings {
Expand Down
6 changes: 3 additions & 3 deletions include/qtpokit/pokitmeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace PokitMeter {
AutoRange = 255 ///< Auto-range.
};
QTPOKIT_EXPORT QString toString(const CurrentRange &range);
QTPOKIT_EXPORT std::optional<quint32> maxValue(const CurrentRange &range);
QTPOKIT_EXPORT quint32 maxValue(const CurrentRange &range);

/// Values supported by the Pokit Meter's `Range` attributes in `Resistance` mode.
enum class ResistanceRange : quint8 {
Expand All @@ -41,7 +41,7 @@ namespace PokitMeter {
AutoRange = 255 ///< Auto-range.
};
QTPOKIT_EXPORT QString toString(const ResistanceRange &range);
QTPOKIT_EXPORT std::optional<quint32> maxValue(const ResistanceRange &range);
QTPOKIT_EXPORT quint32 maxValue(const ResistanceRange &range);

/// Values supported by the Pokit Meter's `Range` attributes in `*Voltage` modes.
enum class VoltageRange : quint8 {
Expand All @@ -54,7 +54,7 @@ namespace PokitMeter {
AutoRange = 255 ///< Auto-range.
};
QTPOKIT_EXPORT QString toString(const VoltageRange &range);
QTPOKIT_EXPORT std::optional<quint32> maxValue(const VoltageRange &range);
QTPOKIT_EXPORT quint32 maxValue(const VoltageRange &range);

}

Expand Down
8 changes: 4 additions & 4 deletions include/qtpokit/pokitpro.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace PokitPro {
AutoRange = 255 ///< Auto-range.
};
QTPOKIT_EXPORT QString toString(const CapacitanceRange &range);
QTPOKIT_EXPORT std::optional<quint32> maxValue(const CapacitanceRange &range);
QTPOKIT_EXPORT quint32 maxValue(const CapacitanceRange &range);


/// Values supported by the Pokit Pro's `Range` attributes in `*Current` modes.
Expand All @@ -39,7 +39,7 @@ namespace PokitPro {
AutoRange = 255 ///< Auto-range.
};
QTPOKIT_EXPORT QString toString(const CurrentRange &range);
QTPOKIT_EXPORT std::optional<quint32> maxValue(const CurrentRange &range);
QTPOKIT_EXPORT quint32 maxValue(const CurrentRange &range);

/// Values supported by the Pokit Pro's `Range` attributes in `Resistance` mode.
enum class ResistanceRange : quint8 {
Expand All @@ -57,7 +57,7 @@ namespace PokitPro {
AutoRange = 255 ///< Auto-range.
};
QTPOKIT_EXPORT QString toString(const ResistanceRange &range);
QTPOKIT_EXPORT std::optional<quint32> maxValue(const ResistanceRange &range);
QTPOKIT_EXPORT quint32 maxValue(const ResistanceRange &range);

/// Values supported by the Pokit Pro's `Range` attributes in `*Voltage` modes.
enum class VoltageRange : quint8 {
Expand All @@ -72,7 +72,7 @@ namespace PokitPro {
AutoRange = 255 ///< Auto-range.
};
QTPOKIT_EXPORT QString toString(const VoltageRange &range);
QTPOKIT_EXPORT std::optional<quint32> maxValue(const VoltageRange &range);
QTPOKIT_EXPORT quint32 maxValue(const VoltageRange &range);

}

Expand Down
15 changes: 5 additions & 10 deletions src/lib/dataloggerservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ QString DataLoggerService::toString(const quint8 range, const Mode mode) const
}

/*!
* Returns the maximum value for \a range, or the string "Auto".
*
* If \a range is not a known valid enumeration value for \a product's \a mode, then a null QVariant is returned.
* Returns the maximum value for \a range, or 0 if \a range is not a known value for \a product's \a mode.
*/
std::optional<quint32> DataLoggerService::maxValue(const PokitProduct product, const quint8 range, const Mode mode)
quint32 DataLoggerService::maxValue(const PokitProduct product, const quint8 range, const Mode mode)
{
switch (mode) {
case Mode::Idle:
Expand All @@ -80,16 +78,13 @@ std::optional<quint32> DataLoggerService::maxValue(const PokitProduct product, c
case Mode::Temperature:
break;
}
return std::optional<quint32>();
return 0;
}

/*!
* Returns the maximum value for \a range, or the string "Auto".
*
* If \a range is not a known valid enumeration value for the current \a product's \a mode,
* then a null QVariant is returned.
* Returns the maximum value for \a range, or 0 \a range is not a known value for the current \a product's \a mode.
*/
std::optional<quint32> DataLoggerService::maxValue(const quint8 range, const Mode mode) const
quint32 DataLoggerService::maxValue(const quint8 range, const Mode mode) const
{
return maxValue(*pokitProduct(), range, mode);
}
Expand Down
15 changes: 5 additions & 10 deletions src/lib/dsoservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ QString DsoService::toString(const quint8 range, const Mode mode) const
}

/*!
* Returns the maximum value for \a range, or the string "Auto".
*
* If \a range is not a known valid enumeration value for \a product's \a mode, then a null QVariant is returned.
* Returns the maximum value for \a range, or 0 if \a range is not a known value for \a product's \a mode.
*/
std::optional<quint32> DsoService::maxValue(const PokitProduct product, const quint8 range, const Mode mode)
quint32 DsoService::maxValue(const PokitProduct product, const quint8 range, const Mode mode)
{
switch (mode) {
case Mode::Idle:
Expand All @@ -74,16 +72,13 @@ std::optional<quint32> DsoService::maxValue(const PokitProduct product, const qu
case Mode::AcCurrent:
return CurrentRange::maxValue(product, range);
}
return std::optional<quint32>();
return 0;
}

/*!
* Returns the maximum value for \a range, or the string "Auto".
*
* If \a range is not a known valid enumeration value for the current \a product's \a mode,
* then a null QVariant is returned.
* Returns the maximum value for \a range, or 0 \a range is not a known value for the current \a product's \a mode.
*/
std::optional<quint32> DsoService::maxValue(const quint8 range, const Mode mode) const
quint32 DsoService::maxValue(const quint8 range, const Mode mode) const
{
return maxValue(*pokitProduct(), range, mode);
}
Expand Down
Loading

0 comments on commit d5a12ab

Please sign in to comment.