Dump out the decode_results structure into a human readable format. @param[in] results A ptr to a decode_results structure. @return A String containing the output.
| 396 | /// @param[in] results A ptr to a decode_results structure. |
| 397 | /// @return A String containing the output. |
| 398 | String resultToHumanReadableBasic(const decode_results * const results) { |
| 399 | String output = ""; |
| 400 | // Reserve some space for the string to reduce heap fragmentation. |
| 401 | // "Protocol : LONGEST_PROTOCOL_NAME (Repeat)\n" |
| 402 | // "Code : 0x (NNNN Bits)\n" = 70 chars |
| 403 | output.reserve(2 * kStateSizeMax + 70); // Should cover most cases. |
| 404 | // Show Encoding standard |
| 405 | output += kProtocolStr; |
| 406 | output += F(" : "); |
| 407 | output += typeToString(results->decode_type, results->repeat); |
| 408 | output += '\n'; |
| 409 | |
| 410 | // Show Code & length |
| 411 | output += kCodeStr; |
| 412 | output += F(" : "); |
| 413 | output += resultToHexidecimal(results); |
| 414 | output += kSpaceLBraceStr; |
| 415 | output += uint64ToString(results->bits); |
| 416 | output += ' '; |
| 417 | output += kBitsStr; |
| 418 | output += F(")\n"); |
| 419 | return output; |
| 420 | } |
| 421 | |
| 422 | /// Convert a decode_results into an array suitable for `sendRaw()`. |
| 423 | /// @param[in] decode A ptr to a decode_results structure that contains a mesg. |