#include <cerrno>
#include <QString>
#include <QTime>
Go to the source code of this file.
|
| QString | valueToString (double value, Unit unit, int precision=-1) |
| | Converts double to string containing value and (prefix+)unit (Counterpart to stringToValue). More...
|
| |
| double | stringToValue (const QString &text, Unit unit, bool *ok=nullptr) |
| | Converts string containing value and (prefix+)unit to double (Counterpart to valueToString). More...
|
| |
| QString | hexDump (unsigned char *data, unsigned int length) |
| | Returns the hex dump for the given data. More...
|
| |
| unsigned int | hexParse (const QString dump, unsigned char *data, unsigned int length) |
| | Returns the hex dump for the given data. More...
|
| |
◆ timestampDebug
| #define timestampDebug |
( |
|
ARG | ) |
|
Print debug information with timestamp.
- Parameters
-
| text | Text that will be output via qDebug. |
◆ Unit
The various units supported by valueToString.
utils/printutils.h
| Enumerator |
|---|
| UNIT_VOLTS | |
| UNIT_DECIBEL | |
| UNIT_SECONDS | |
| UNIT_HERTZ | |
| UNIT_SAMPLES | |
| UNIT_COUNT | |
◆ hexDump()
| QString hexDump |
( |
unsigned char * |
data, |
|
|
unsigned int |
length |
|
) |
| |
Returns the hex dump for the given data.
- Parameters
-
| data | Pointer to the data bytes that should be dumped. |
| length | The length of the data array in bytes. |
- Returns
- String with the hex dump of the data.
◆ hexParse()
| unsigned int hexParse |
( |
const QString |
dump, |
|
|
unsigned char * |
data, |
|
|
unsigned int |
length |
|
) |
| |
Returns the hex dump for the given data.
- Parameters
-
| dump | The string with the hex dump of the data. |
| data | Pointer to the address where the data bytes should be saved. |
| length | The maximum length of the data array in bytes. |
- Returns
- The length of the saved data.
◆ stringToValue()
| double stringToValue |
( |
const QString & |
text, |
|
|
Unit |
unit, |
|
|
bool * |
ok = nullptr |
|
) |
| |
Converts string containing value and (prefix+)unit to double (Counterpart to valueToString).
- Parameters
-
| text | The text containing the value and its unit. |
| unit | The base unit of the value. |
| ok | Pointer to a success-flag, true on success, false on error. |
- Returns
- Decoded value.
◆ valueToString()
| QString valueToString |
( |
double |
value, |
|
|
Unit |
unit, |
|
|
int |
precision = -1 |
|
) |
| |
Converts double to string containing value and (prefix+)unit (Counterpart to stringToValue).
- Parameters
-
| value | The value in prefixless units. |
| unit | The unit for the value. |
| precision | Significant digits, 0 for integer, -1 for auto. |
- Returns
- String with the value and unit.