cec: opcode 0x80 means the stream path changed, not the physical address
authorLars Op den Kamp <lars@opdenkamp.eu>
Sun, 6 Nov 2011 16:38:55 +0000 (17:38 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Sun, 6 Nov 2011 16:38:55 +0000 (17:38 +0100)
src/lib/devices/CECBusDevice.cpp
src/lib/devices/CECBusDevice.h
src/lib/implementations/CECCommandHandler.cpp

index 77e646174ba5975df4748429d02ad832885881bf..9a33e0de1e4e67cb25537fda9d18103a3143ae62 100644 (file)
@@ -42,6 +42,7 @@ using namespace CEC;
 
 CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress) :
   m_iPhysicalAddress(iPhysicalAddress),
+  m_iStreamPath(0),
   m_iLogicalAddress(iLogicalAddress),
   m_powerStatus(CEC_POWER_STATUS_UNKNOWN),
   m_processor(processor),
@@ -254,7 +255,7 @@ void CCECBusDevice::SetMenuLanguage(const cec_menu_language &language)
   }
 }
 
-void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress, uint16_t iOldAddress /* = 0 */)
+void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress)
 {
   if (iNewAddress > 0)
   {
@@ -266,6 +267,18 @@ void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress, uint16_t iOldAddres
   }
 }
 
+void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = 0 */)
+{
+  if (iNewAddress > 0)
+  {
+    CStdString strLog;
+    strLog.Format(">> %i stream path from %04x to %04x", m_iLogicalAddress, iOldAddress, iNewAddress);
+    AddLog(CEC_LOG_DEBUG, strLog.c_str());
+
+    m_iStreamPath = iNewAddress;
+  }
+}
+
 void CCECBusDevice::SetPowerStatus(const cec_power_status powerStatus)
 {
   if (m_powerStatus != powerStatus)
index 509e57c604dc5d6d90ed0835e281e2bd2c56af54..0a04bd70fd20f34f3ffb21d255a36581c4cf69d8 100644 (file)
@@ -71,7 +71,8 @@ namespace CEC
     virtual const char *        GetVendorName(void) { return GetVendor().AsString(); }
     virtual bool                MyLogicalAddressContains(cec_logical_address address) const;
 
-    virtual void SetPhysicalAddress(uint16_t iNewAddress, uint16_t iOldAddress = 0);
+    virtual void SetPhysicalAddress(uint16_t iNewAddress);
+    virtual void SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress = 0);
     virtual void SetCecVersion(const cec_version newVersion);
     virtual void SetMenuLanguage(const cec_menu_language &menuLanguage);
     virtual void SetVendorId(const cec_datapacket &data);
@@ -95,6 +96,7 @@ namespace CEC
     cec_device_type     m_type;
     CStdString          m_strDeviceName;
     uint16_t            m_iPhysicalAddress;
+    uint16_t            m_iStreamPath;
     cec_logical_address m_iLogicalAddress;
     cec_power_status    m_powerStatus;
     cec_menu_language   m_menuLanguage;
index e30810c6671c7c564721c0906ed5db94630db0c1..33644d8709d3972bb0ed6082f04ede397428ac0e 100644 (file)
@@ -288,7 +288,7 @@ bool CCECCommandHandler::HandleRoutingChange(const cec_command &command)
 
     CCECBusDevice *device = GetDevice(command.initiator);
     if (device)
-      device->SetPhysicalAddress(iNewAddress, iOldAddress);
+      device->SetStreamPath(iNewAddress, iOldAddress);
   }
   return true;
 }