cec: let CCECProcessor replace the command handlers
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 27 Dec 2011 19:22:53 +0000 (20:22 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 27 Dec 2011 19:22:53 +0000 (20:22 +0100)
src/lib/CECProcessor.cpp
src/lib/CECProcessor.h
src/lib/devices/CECBusDevice.cpp

index 63205f460f416e31649ed94327721a67ff7225e5..dc094ac4f9c8079ff11c40c85ca49dd1840a1a32 100644 (file)
@@ -268,6 +268,12 @@ bool CCECProcessor::FindLogicalAddresses(void)
   return bReturn;
 }
 
+void CCECProcessor::ReplaceHandlers(void)
+{
+  for (uint8_t iPtr = 0; iPtr <= CECDEVICE_PLAYBACKDEVICE3; iPtr++)
+    m_busDevices[iPtr]->ReplaceHandler(true);
+}
+
 void *CCECProcessor::Process(void)
 {
   bool                  bParseFrame(false);
@@ -283,6 +289,8 @@ void *CCECProcessor::Process(void)
 
   while (!IsStopped())
   {
+    ReplaceHandlers();
+
     command.Clear();
     msg.clear();
 
index 9cb1bf9fe9982a1bc936b8e5d9d0877991bd8320..13243ab897f5247f24f5130ad620941623b821a5 100644 (file)
@@ -134,6 +134,7 @@ namespace CEC
       CMutex         m_transmitMutex;
 
   private:
+      void ReplaceHandlers(void);
       void ScanCECBus(void);
       bool PhysicalAddressInUse(uint16_t iPhysicalAddress);
       bool TryLogicalAddress(cec_logical_address address);
index 1ea78d72fdf0d6418b9cd3d22f1903b479d770a1..824e56154cfe25eb595ec598952d06d87af515fd 100644 (file)
@@ -92,7 +92,6 @@ bool CCECBusDevice::HandleCommand(const cec_command &command)
   }
 
   /* handle the command */
-  ReplaceHandler(true);
   bHandled = m_handler->HandleCommand(command);
 
   /* change status to present */
@@ -844,7 +843,6 @@ void CCECBusDevice::SetUnsupportedFeature(cec_opcode opcode)
 bool CCECBusDevice::InitHandler(void)
 {
   CLockObject lock(&m_mutex);
-  ReplaceHandler(false);
   return m_handler->InitHandler();
 }