don't get caught in a loop in CVLCommandHandler when the source switch was not allowe...
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 8 Oct 2012 16:14:05 +0000 (18:14 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 8 Oct 2012 16:14:05 +0000 (18:14 +0200)
src/lib/implementations/VLCommandHandler.cpp
src/lib/implementations/VLCommandHandler.h

index a60f897f105ff61c4832d72a94950341a2846d6b..227d8a0aa3b67e25ebe4ec8f71a4f51c85a22d1a 100644 (file)
@@ -61,7 +61,8 @@ CVLCommandHandler::CVLCommandHandler(CCECBusDevice *busDevice,
                                      int64_t iActiveSourcePending /* = 0 */) :
     CCECCommandHandler(busDevice, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending),
     m_iPowerUpEventReceived(0),
-    m_bCapabilitiesSent(false)
+    m_bCapabilitiesSent(false),
+    m_bPowerStatusRequested(false)
 {
   m_vendorId = CEC_VENDOR_PANASONIC;
 }
@@ -246,8 +247,17 @@ int CVLCommandHandler::HandleVendorCommand(const cec_command &command)
   return CEC_ABORT_REASON_INVALID_OPERAND;
 }
 
+bool CVLCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
+{
+  m_bPowerStatusRequested = true;
+  return CCECCommandHandler::TransmitRequestPowerStatus(iInitiator, iDestination, bWaitForResponse);
+}
+
 bool CVLCommandHandler::SourceSwitchAllowed(void)
 {
+  if (!PowerUpEventReceived() && !m_bPowerStatusRequested)
+    TransmitRequestPowerStatus(m_processor->GetPrimaryDevice()->GetLogicalAddress(), CECDEVICE_TV, false);
+
   return PowerUpEventReceived();
 }
 
index 3ad80b49150b53749bc61d0f306f972631a5a00c..ae6b9f60d63a291b3d34c5449ed87ffd91e10c67 100644 (file)
@@ -55,6 +55,7 @@ namespace CEC
     bool PowerUpEventReceived(void);
     bool SupportsDeviceType(const cec_device_type type) const { return type != CEC_DEVICE_TYPE_RECORDING_DEVICE; };
     cec_device_type GetReplacementDeviceType(const cec_device_type type) const { return type == CEC_DEVICE_TYPE_RECORDING_DEVICE ? CEC_DEVICE_TYPE_PLAYBACK_DEVICE : type; }
+    bool TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
 
     bool SourceSwitchAllowed(void);
 
@@ -66,5 +67,6 @@ namespace CEC
     PLATFORM::CMutex m_mutex;
     uint64_t         m_iPowerUpEventReceived;
     bool             m_bCapabilitiesSent;
+    bool             m_bPowerStatusRequested;
   };
 };