added verbose arg to decode()

This commit is contained in:
john30
2014-12-14 11:36:14 +01:00
parent 7a975dd274
commit a9a9865583
2 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -293,7 +293,7 @@ result_t Message::prepareSlave(SymbolString& slaveData)
} }
result_t Message::decode(const PartType partType, SymbolString& data, result_t Message::decode(const PartType partType, SymbolString& data,
ostringstream& output, bool leadingSeparator, char separator) ostringstream& output, bool leadingSeparator, bool verbose, char separator)
{ {
unsigned char offset; unsigned char offset;
if (partType == pt_masterData) if (partType == pt_masterData)
@@ -301,7 +301,7 @@ result_t Message::decode(const PartType partType, SymbolString& data,
else else
offset = 0; offset = 0;
int startPos = output.str().length(); int startPos = output.str().length();
result_t result = m_data->read(partType, data, offset, output, leadingSeparator, false, separator); result_t result = m_data->read(partType, data, offset, output, leadingSeparator, verbose, separator);
time(&m_lastUpdateTime); time(&m_lastUpdateTime);
if (result != RESULT_OK) { if (result != RESULT_OK) {
m_lastValue.clear(); m_lastValue.clear();
+3 -1
View File
@@ -165,11 +165,13 @@ public:
* @param data the unescaped data @a SymbolString for reading binary data. * @param data the unescaped data @a SymbolString for reading binary data.
* @param output the @a ostringstream to append the formatted value to. * @param output the @a ostringstream to append the formatted value to.
* @param leadingSeparator whether to prepend a separator before the formatted value. * @param leadingSeparator whether to prepend a separator before the formatted value.
* @param verbose whether to prepend the name, append the unit (if present), and append
* the comment in square brackets (if present).
* @param separator the separator character between multiple fields. * @param separator the separator character between multiple fields.
* @return @a RESULT_OK on success, or an error code. * @return @a RESULT_OK on success, or an error code.
*/ */
result_t decode(const PartType partType, SymbolString& data, result_t decode(const PartType partType, SymbolString& data,
ostringstream& output, bool leadingSeparator=false, char separator=UI_FIELD_SEPARATOR); ostringstream& output, bool leadingSeparator=false, bool verbose=false, char separator=UI_FIELD_SEPARATOR);
/** /**
* @brief Get the last decoded value. * @brief Get the last decoded value.