From: Lars Op den Kamp Date: Mon, 18 Mar 2013 15:04:48 +0000 (+0100) Subject: added CCECTypeUtils::ToString(const cec_command& command) X-Git-Tag: upstream/2.2.0~1^2~4^2~19 X-Git-Url: https://git.piment-noir.org/?p=deb_libcec.git;a=commitdiff_plain;h=8187ac5fe2c685758c679b7d75c26795aa447c9c added CCECTypeUtils::ToString(const cec_command& command) --- diff --git a/src/lib/CECTypeUtils.h b/src/lib/CECTypeUtils.h index 4b406f1..68ef5d1 100644 --- a/src/lib/CECTypeUtils.h +++ b/src/lib/CECTypeUtils.h @@ -31,6 +31,8 @@ * http://www.pulse-eight.net/ */ +#include "lib/platform/util/StdString.h" + namespace CEC { class CCECTypeUtils @@ -852,5 +854,16 @@ namespace CEC } return true; } + + static CStdString ToString(const cec_command& command) + { + CStdString dataStr; + dataStr.Format(">> %1x%1x", command.initiator, command.destination); + if (command.opcode_set == 1) + dataStr.AppendFormat(":%02x", command.opcode); + for (uint8_t iPtr = 0; iPtr < command.parameters.size; iPtr++) + dataStr.AppendFormat(":%02x", (unsigned int)command.parameters[iPtr]); + return dataStr; + } }; }