X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fdevices%2FCECBusDevice.cpp;h=fc85d38f6f0c89854e1addc495156babbb9ff730;hb=224ea8772f229d2d7dafcdbf64c4266c9b4de35e;hp=48b75d7dda6ad936424c1801817a73c94e453f6f;hpb=b81f75db39e879e2fe05c7cbdbb2293140fea6d1;p=deb_libcec.git diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 48b75d7..fc85d38 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -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. @@ -37,6 +37,7 @@ #include "../implementations/SLCommandHandler.h" #include "../implementations/VLCommandHandler.h" #include "../LibCEC.h" +#include "../platform/util/timeutils.h" using namespace CEC; using namespace PLATFORM; @@ -581,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()) @@ -833,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; +} + //@}