cec: moved some logic to the cec_packet struct. fix package output
[deb_libcec.git] / src / lib / LibCEC.cpp
index 0f88470554dec9957713e9d4e6d318e10634af5f..6b53f049563ff74397089944f9fcf84f307bb773 100644 (file)
@@ -42,6 +42,7 @@ using namespace std;
 using namespace CEC;
 
 CLibCEC::CLibCEC(const char *strDeviceName, cec_logical_address iLogicalAddress /* = CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress /* = CEC_DEFAULT_PHYSICAL_ADDRESS */) :
+    m_iStartTime(GetTimeMs()),
     m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN),
     m_buttontime(0)
 {
@@ -183,6 +184,7 @@ void CLibCEC::AddLog(cec_log_level level, const string &strMessage)
   {
     cec_log_message message;
     message.level = level;
+    message.time = GetTimeMs() - m_iStartTime;
     snprintf(message.message, sizeof(message.message), "%s", strMessage.c_str());
     m_logBuffer.Push(message);
   }
@@ -211,11 +213,11 @@ void CLibCEC::AddCommand(cec_logical_address source, cec_logical_address destina
   command.destination  = destination;
   command.opcode       = opcode;
   if (parameters)
-    command.parameters = *parameters;
+    command.parameters = parameters->packet;
   if (m_commandBuffer.Push(command))
   {
     CStdString strDebug;
-    strDebug.Format("stored command '%d' in the command buffer. buffer size = %d", opcode, m_commandBuffer.Size());
+    strDebug.Format("stored command '%2x' in the command buffer. buffer size = %d", opcode, m_commandBuffer.Size());
     AddLog(CEC_LOG_DEBUG, strDebug);
   }
   else