cec: added CanPersistConfiguration()/cec_can_persist_configuration() and PersistConfi...
[deb_libcec.git] / src / lib / devices / CECBusDevice.cpp
index be9e8875f614164be47b0585479f2ed6d549167b..fc85d38f6f0c89854e1addc495156babbb9ff730 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the libCEC(R) library.
  *
- * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
  * libCEC(R) is an original work, containing original code.
  *
  * libCEC(R) is a trademark of Pulse-Eight Limited.
@@ -582,7 +582,10 @@ void CCECBusDevice::SetPowerStatus(const cec_power_status powerStatus)
 
 bool CCECBusDevice::ReplaceHandler(bool bActivateSource /* = true */)
 {
-  CLockObject lock(m_mutex);
+  CTryLockObject lock(m_mutex);
+  if (!lock.IsLocked())
+    return false;
+
   CLockObject handlerLock(m_handlerMutex);
 
   if (m_vendor != m_handler->GetVendorId())
@@ -834,4 +837,19 @@ bool CCECBusDevice::ActivateSource(void)
   return m_handler->ActivateSource();
 }
 
+void CCECBusDevice::HandlePoll(cec_logical_address iDestination)
+{
+  CLockObject lock(m_mutex);
+  CLibCEC::AddLog(CEC_LOG_DEBUG, "<< POLL: %s (%x) -> %s (%x)", ToString(m_iLogicalAddress), m_iLogicalAddress, ToString(iDestination), iDestination);
+  m_bAwaitingReceiveFailed = true;
+}
+
+bool CCECBusDevice::HandleReceiveFailed(void)
+{
+  CLockObject lock(m_handlerMutex);
+  bool bReturn = m_bAwaitingReceiveFailed;
+  m_bAwaitingReceiveFailed = false;
+  return bReturn;
+}
+
 //@}