|
OpenHantek
|
#include <cerrno>#include <QString>#include <QTime>Go to the source code of this file.
Macros | |
| #define | timestampDebug(ARG) |
| Print debug information with timestamp. | |
Enumerations | |
| enum | Unit { UNIT_NONE , UNIT_VOLTS , UNIT_DECIBEL , UNIT_SECONDS , UNIT_HERTZ , UNIT_SAMPLES , UNIT_COUNT , UNIT_WATTS , UNIT_VOLTSQUARE } |
| The various units supported by valueToString. More... | |
Functions | |
| QString | valueToString (double value, Unit unit, int precision=-1) |
| Converts double to string containing value and (prefix+)unit (Counterpart to stringToValue). | |
| double | stringToValue (const QString &text, Unit unit, bool *ok=nullptr) |
| Converts string containing value and (prefix+)unit to double (Counterpart to valueToString). | |
| QString | hexDump (unsigned char *data, unsigned int length) |
| Returns the hex or decimal dump for the given data. | |
| QString | decDump (unsigned char *data, unsigned int length) |
| QString | hexdecDump (unsigned char *data, unsigned int length) |
| unsigned int | hexParse (const QString dump, unsigned char *data, unsigned int length) |
| Returns the hex dump for the given data. | |
| #define timestampDebug | ( | ARG | ) |
Print debug information with timestamp.
| text | Text that will be output via qDebug. |
| enum Unit |
| QString decDump | ( | unsigned char * | data, |
| unsigned int | length ) |
| QString hexdecDump | ( | unsigned char * | data, |
| unsigned int | length ) |
| QString hexDump | ( | unsigned char * | data, |
| unsigned int | length ) |
Returns the hex or decimal dump for the given data.
| data | Pointer to the data bytes that should be dumped. |
| length | The length of the data array in bytes. |
| unsigned int hexParse | ( | const QString | dump, |
| unsigned char * | data, | ||
| unsigned int | length ) |
Returns the hex dump for the given data.
| 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. |
| double stringToValue | ( | const QString & | text, |
| Unit | unit, | ||
| bool * | ok = nullptr ) |
Converts string containing value and (prefix+)unit to double (Counterpart to valueToString).
| 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. |
| QString valueToString | ( | double | value, |
| Unit | unit, | ||
| int | precision = -1 ) |
Converts double to string containing value and (prefix+)unit (Counterpart to stringToValue).
| value | The value in prefixless units. |
| unit | The unit for the value. |
| precision | Significant digits, 0 for integer, -1 for auto. |