cec: set the physical address in CCECBusDevice
authorLars Op den Kamp <lars@opdenkamp.eu>
Fri, 28 Oct 2011 07:53:46 +0000 (09:53 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Fri, 28 Oct 2011 07:53:46 +0000 (09:53 +0200)
src/lib/CECBusDevice.cpp
src/lib/CECBusDevice.h
src/lib/implementations/CECCommandHandler.cpp

index 45f30a5951f691a551e1345ca1e1ecf0671ce250..19f4e669b3c24a9cf29cb7bc4b05256c71e1a0cc 100644 (file)
@@ -127,6 +127,15 @@ void CCECBusDevice::PollVendorId(void)
   }
 }
 
+void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress, uint16_t iOldAddress /* = 0 */)
+{
+  CStdString strLog;
+  strLog.Format(">> %i changed physical address from %04x to %04x", GetLogicalAddress(), m_iPhysicalAddress, iNewAddress);
+  AddLog(CEC_LOG_DEBUG, strLog.c_str());
+
+  m_iPhysicalAddress = iNewAddress;
+}
+
 const char *CCECBusDevice::CECVendorIdToString(const uint64_t iVendorId)
 {
   switch (iVendorId)
index 9cc7fdc05f94931f74351a10fd9e6d66d97721b3..7f96e6f4f8d3dda10d03575e8f3f1bf219b66f89 100644 (file)
@@ -48,6 +48,7 @@ namespace CEC
 
     virtual cec_logical_address GetLogicalAddress(void) const { return m_iLogicalAddress; }
     virtual uint16_t GetPhysicalAddress(void) const { return m_iPhysicalAddress; }
+    virtual void SetPhysicalAddress(uint16_t iNewAddress, uint16_t iOldAddress = 0);
 
     virtual cec_logical_address GetMyLogicalAddress(void) const;
     virtual uint16_t GetMyPhysicalAddress(void) const;
index 951434722ca8d036c715b0dcdcbc4fb91bf98821..9e3867ef192957fd97caf653d4d1028d3168dedb 100644 (file)
@@ -196,11 +196,8 @@ bool CCECCommandHandler::HandleRoutingChange(const cec_command &command)
   {
     uint16_t iOldAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
     uint16_t iNewAddress = ((uint16_t)command.parameters[2] << 8) | ((uint16_t)command.parameters[3]);
-    CStdString strLog;
-    strLog.Format(">> %i changed physical address from %04x to %04x", command.initiator, iOldAddress, iNewAddress);
-    m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
 
-    m_busDevice->GetProcessor()->AddCommand(command);
+    m_busDevice->SetPhysicalAddress(iNewAddress, iOldAddress);
   }
   return true;
 }