Go to the documentation of this file.
2 #ifndef SIGNALMONITORVALUES_H
3 #define SIGNALMONITORVALUES_H
9 #include <QCoreApplication>
20 int _threshold,
bool _high_threshold,
21 int _min,
int _max, std::chrono::milliseconds _timeout);
35 return QString(
"%1 %2 %3 %4 %5 %6 %7 %8")
65 float rangeconv = ((float) (newmax - newmin)) / (
GetMax() -
GetMin());
66 int newval = (int) (((
GetValue() -
GetMin()) * rangeconv) + newmin);
105 Create(
const QString& _name,
const QString& _longString);
123 return QString(
"Name(%1) Val(%2) thr(%3%4) range(%5,%6) "
124 "timeout(%7 ms) %8 set. %9 good.")
128 .arg(
m_set ?
"is" :
"is NOT",
129 IsGood() ?
"Is" :
"Is NOT" );
134 int _value,
int _threshold,
bool _high_threshold,
135 int _min,
int _max, std::chrono::milliseconds _timeout,
bool _set);
136 bool Set(
const QString& _name,
const QString& _longString);
151 #endif // SIGNALMONITORVALUES_H
static SignalMonitorList Parse(const QStringList &slist)
Converts a list of strings to SignalMonitorValue classes.
void SetValue(int _value)
void SetThreshold(int _threshold)
QString GetStatus() const
Returns a signal monitor value as one long string.
static SignalMonitorValue * Create(const QString &_name, const QString &_longString)
int GetNormalizedValue(int newmin, int newmax) const
Returns the value normalized to the [newmin, newmax] range.
static std::chrono::milliseconds MaxWait(const SignalMonitorList &slist)
Returns the maximum timeout value in the signal monitor list.
static QStringList SIGNAL_LOCK
QString GetName(void) const
Returns the long name of this value.
std::vector< SignalMonitorValue > SignalMonitorList
int GetMax() const
Returns greatest value possible, used for signal monitor bars.
int GetValue() const
Returns the value.
void SetTimeout(std::chrono::milliseconds _timeout)
QString GetShortName(void) const
Returns a space free name of the value. Used by GetStatus().
static bool run_static_init
static QStringList ERROR_NO_CHANNEL
static QStringList ERROR_NO_LINK
void SetRange(int _min, int _max)
Sets the minimum and maximum values.
static eu8 clamp(eu8 value, eu8 low, eu8 high)
void SetThreshold(int _threshold, bool _high_threshold)
bool IsGood() const
Returns true if the value is equal to the threshold, or on the right side of the threshold (depends o...
bool IsHighThreshold() const
Returns true if values greater than the threshold are considered good, false otherwise.
std::chrono::milliseconds GetTimeout() const
Returns how long to wait for a good value in milliseconds.
std::vector< SignalMonitorValue > SignalMonitorList
std::chrono::milliseconds m_timeout
int GetMin() const
Returns smallest value possible, used for signal monitor bars.
static bool AllGood(const SignalMonitorList &slist)
Returns true if all the values in the list return true on IsGood().
SignalMonitorValue()=default
bool Set(const QString &_name, const QString &_longString)
int GetThreshold() const
Returns the threshold at which the value is considered "good".
static void Init()
Initializes the some static constants needed by SignalMonitorValue.