cec: only switch handlers once when using the generic handler
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 3 Jan 2012 12:58:03 +0000 (13:58 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 3 Jan 2012 12:58:03 +0000 (13:58 +0100)
src/lib/devices/CECBusDevice.cpp
src/lib/implementations/ANCommandHandler.h
src/lib/implementations/CECCommandHandler.cpp
src/lib/implementations/CECCommandHandler.h
src/lib/implementations/SLCommandHandler.cpp
src/lib/implementations/SLCommandHandler.h
src/lib/implementations/VLCommandHandler.cpp
src/lib/implementations/VLCommandHandler.h

index a2ce01d1aeaeabcec1edd89abe412563328c2dde..044cd9c0b938e341ac58ca0e4512687c106bd5d5 100644 (file)
@@ -655,6 +655,7 @@ bool CCECBusDevice::ReplaceHandler(bool bActivateSource /* = true */)
       break;
     }
 
+    m_handler->SetVendorId(m_vendor);
     m_handler->InitHandler();
 
     if (bActivateSource && m_processor->GetLogicalAddresses().IsSet(m_iLogicalAddress) && m_processor->IsInitialised())
index 0207a6321f67c435c9d627b66481b0ca320446ee..8966c1a13fb4c986cdcb1e109d3d6da0f1cf700e 100644 (file)
@@ -42,9 +42,6 @@ namespace CEC
     virtual ~CANCommandHandler(void) {};
 
     virtual bool HandleCommand(const cec_command &command);
-
-    virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_SAMSUNG; };
-
   protected:
     virtual bool HandleVendorRemoteButtonDown(const cec_command &command);
   };
index 336baba0af07e6a1648c74e9bf9e2360c759dee1..9f442be160d6ebf52711cc507c15e932dbb791f7 100644 (file)
@@ -48,7 +48,8 @@ CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice) :
     m_bHandlerInited(false),
     m_iUseCounter(0),
     m_expectedResponse(CEC_OPCODE_NONE),
-    m_bOPTSendDeckStatusUpdateOnActiveSource(true)
+    m_bOPTSendDeckStatusUpdateOnActiveSource(true),
+    m_vendorId(CEC_VENDOR_UNKNOWN)
 {
 }
 
index 70763c8e3182cb15508f83d2cf144f2b2250a871..afd1315afa02d473a3ed24fe691b99d083cd1079 100644 (file)
@@ -48,7 +48,8 @@ namespace CEC
     virtual ~CCECCommandHandler(void);
 
     virtual bool HandleCommand(const cec_command &command);
-    virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_UNKNOWN; };
+    virtual cec_vendor_id GetVendorId(void) { return m_vendorId; };
+    virtual void SetVendorId(cec_vendor_id vendorId) { m_vendorId = vendorId; }
     virtual void HandlePoll(const cec_logical_address iInitiator, const cec_logical_address iDestination);
     virtual bool HandleReceiveFailed(void);
 
@@ -142,6 +143,7 @@ namespace CEC
     uint8_t        m_iUseCounter;
     cec_opcode     m_expectedResponse;
     bool           m_bOPTSendDeckStatusUpdateOnActiveSource;
+    cec_vendor_id  m_vendorId;
     CMutex         m_receiveMutex;
     CCondition     m_condition;
   };
index 31376e59b1c12cbc66c1b34d86c7e80285db1d6b..7a357d319f7d003c5ab086f191448c460016006a 100644 (file)
@@ -54,6 +54,7 @@ CSLCommandHandler::CSLCommandHandler(CCECBusDevice *busDevice) :
     m_bSLEnabled(false),
     m_bPowerStateReset(false)
 {
+  m_vendorId = CEC_VENDOR_LG;
   CCECBusDevice *primary = m_processor->GetPrimaryDevice();
 
   /* imitate LG devices */
index 8243d98546564e10f570df23da1009add6b28ce8..e398dc878d84af2030526b715a3835abaca45221 100644 (file)
@@ -40,7 +40,6 @@ namespace CEC
   public:
     CSLCommandHandler(CCECBusDevice *busDevice);
     virtual ~CSLCommandHandler(void) {};
-    virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_LG; };
 
     virtual void HandlePoll(const cec_logical_address iInitiator, const cec_logical_address iDestination);
     virtual bool HandleReceiveFailed(void);
index dfef4a09e75dfa46e8c66572e0dfd663dc58bec1..6a6bad2a50d168ded8a8b0656bb7502626f036bc 100644 (file)
@@ -39,6 +39,7 @@ using namespace CEC;
 CVLCommandHandler::CVLCommandHandler(CCECBusDevice *busDevice) :
     CCECCommandHandler(busDevice)
 {
+  m_vendorId = CEC_VENDOR_PANASONIC;
   m_bOPTSendDeckStatusUpdateOnActiveSource = false;
 }
 
index 9ed71cb04f5b5b2b809fd0d8c1cab91936186ca3..cff1da4dfcdf3eb4aaad5966713fbdea614698eb 100644 (file)
@@ -40,7 +40,6 @@ namespace CEC
   public:
     CVLCommandHandler(CCECBusDevice *busDevice);
     virtual ~CVLCommandHandler(void) {};
-    virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_PANASONIC; };
     virtual bool InitHandler(void);
   };
 };