cec: introduced CEC_LOG_TRAFFIC log level and log all traffic in that level
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 27 Oct 2011 22:00:39 +0000 (00:00 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 27 Oct 2011 22:00:39 +0000 (00:00 +0200)
include/cectypes.h
src/lib/CECProcessor.cpp
src/testclient/main.cpp

index 941b5427bcdfaaa5adc68805beb6304c6920096d..4c029e87ccb9c18ffef1972a056f470542d58e3f 100644 (file)
@@ -530,6 +530,7 @@ typedef enum cec_opcode
 typedef enum cec_log_level
 {
   CEC_LOG_DEBUG = 0,
+  CEC_LOG_TRAFFIC,
   CEC_LOG_NOTICE,
   CEC_LOG_WARNING,
   CEC_LOG_ERROR
index 648ec205babcd70cf6faf3b9e34ff1fea00048c7..468d981776f900768e3d8a3655ddb325044b008d 100644 (file)
@@ -186,13 +186,12 @@ bool CCECProcessor::SetInactiveView(void)
 
 void CCECProcessor::LogOutput(const cec_command &data)
 {
-  CStdString txStr = "transmit ";
-  txStr.AppendFormat(" %02x", ((uint8_t)data.initiator << 4) + (uint8_t)data.destination);
-  txStr.AppendFormat(":%02x", (uint8_t)data.opcode);
+  CStdString strTx;
+  strTx.Format("<< %02x:%02x", ((uint8_t)data.initiator << 4) + (uint8_t)data.destination, (uint8_t)data.opcode);
 
   for (uint8_t iPtr = 0; iPtr < data.parameters.size; iPtr++)
-    txStr.AppendFormat(":%02x", data.parameters[iPtr]);
-  m_controller->AddLog(CEC_LOG_DEBUG, txStr.c_str());
+    strTx.AppendFormat(":%02x", data.parameters[iPtr]);
+  m_controller->AddLog(CEC_LOG_TRAFFIC, strTx.c_str());
 }
 
 bool CCECProcessor::Transmit(const cec_command &data, bool bWaitForAck /* = true */)
@@ -543,10 +542,10 @@ void CCECProcessor::ParseVendorId(cec_logical_address device, const cec_datapack
 void CCECProcessor::ParseCommand(cec_command &command)
 {
   CStdString dataStr;
-  dataStr.Format(">> received frame: %1x%1x:%02x", command.initiator, command.destination, command.opcode);
+  dataStr.Format(">> %1x%1x:%02x", command.initiator, command.destination, command.opcode);
   for (uint8_t iPtr = 0; iPtr < command.parameters.size; iPtr++)
     dataStr.AppendFormat(":%02x", (unsigned int)command.parameters[iPtr]);
-  m_controller->AddLog(CEC_LOG_DEBUG, dataStr.c_str());
+  m_controller->AddLog(CEC_LOG_TRAFFIC, dataStr.c_str());
 
   if (!m_bMonitor)
     m_busDevices[(uint8_t)command.initiator]->HandleCommand(command);
index b13f446860c2b743e4d36c06e99f82a75c5cf6a1..8ca3faafe05ab892f14283a56e8ea37a2711bebc 100644 (file)
@@ -115,6 +115,9 @@ void flush_log(ICECAdapter *cecParser)
     case CEC_LOG_NOTICE:
       cout << "NOTICE:  ";
       break;
+    case CEC_LOG_TRAFFIC:
+      cout << "TRAFFIC: ";
+      break;
     case CEC_LOG_DEBUG:
       cout << "DEBUG:   ";
       break;