added CCECTypeUtils::ToString(const cec_command& command)
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 18 Mar 2013 15:04:48 +0000 (16:04 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 18 Mar 2013 15:04:48 +0000 (16:04 +0100)
src/lib/CECTypeUtils.h

index 4b406f12edf271a641f01f1d9d7855688191932d..68ef5d1838406793d77021a14e9b19decf0f0cfa 100644 (file)
@@ -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;
+    }
   };
 }