X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=src%2Flib%2FCECProcessor.cpp;h=9cf771bda124bda87edc00b93e607c398e29cb6d;hb=a8559e01ffc0239556097fbbe99f88f663f3fd6f;hp=708536f3ae2c3eeaeca87b26eb117465ca68f388;hpb=33dd87a962743d205ade8dc83693f23e94e36f03;p=deb_libcec.git diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 708536f..9cf771b 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -210,7 +210,7 @@ bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint bool CCECProcessor::IsInitialised(void) { - CLockObject lock(m_mutex); + CLockObject lock(m_threadMutex); return m_bInitialised; } @@ -1012,7 +1012,7 @@ uint16_t CCECProcessor::GetPhysicalAddress(void) const bool CCECProcessor::SetAckMask(uint16_t iMask) { - return m_communication->SetAckMask(iMask); + return m_communication ? m_communication->SetAckMask(iMask) : false; } bool CCECProcessor::TransmitKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait /* = true */) @@ -1048,7 +1048,10 @@ bool CCECProcessor::StandbyDevices(cec_logical_address address /* = CECDEVICE_BR for (uint8_t iPtr = 0; iPtr <= 0xF; iPtr++) { if (m_configuration.powerOffDevices[iPtr]) + { + CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - putting '%s' in standby mode", __FUNCTION__, ToString((cec_logical_address)iPtr)); bReturn &= m_busDevices[iPtr]->Standby(); + } } return bReturn; } @@ -1063,8 +1066,11 @@ bool CCECProcessor::PowerOnDevices(cec_logical_address address /* = CECDEVICE_BR bool bReturn(true); for (uint8_t iPtr = 0; iPtr <= 0xF; iPtr++) { - if (m_configuration.powerOffDevices[iPtr]) + if (m_configuration.wakeDevices[iPtr]) + { + CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - powering on '%s'", __FUNCTION__, ToString((cec_logical_address)iPtr)); bReturn &= m_busDevices[iPtr]->PowerOn(); + } } return bReturn; } @@ -1438,6 +1444,8 @@ const char *CCECProcessor::ToString(const cec_client_version version) return "1.6.0"; case CEC_CLIENT_VERSION_1_6_1: return "1.6.1"; + case CEC_CLIENT_VERSION_1_6_2: + return "1.6.2"; default: return "Unknown"; } @@ -1461,6 +1469,8 @@ const char *CCECProcessor::ToString(const cec_server_version version) return "1.6.0"; case CEC_SERVER_VERSION_1_6_1: return "1.6.1"; + case CEC_SERVER_VERSION_1_6_2: + return "1.6.2"; default: return "Unknown"; } @@ -1750,17 +1760,17 @@ bool CCECProcessor::GetCurrentConfiguration(libcec_configuration *configuration) bool CCECProcessor::CanPersistConfiguration(void) { - return m_communication->GetFirmwareVersion() >= 2; + return m_communication ? m_communication->GetFirmwareVersion() >= 2 : false; } bool CCECProcessor::PersistConfiguration(libcec_configuration *configuration) { - return m_communication->PersistConfiguration(configuration); + return m_communication ? m_communication->PersistConfiguration(configuration) : false; } void CCECProcessor::RescanActiveDevices(void) { - for (unsigned int iPtr = 0; iPtr < 16; iPtr++) + for (unsigned int iPtr = 0; iPtr < CECDEVICE_BROADCAST; iPtr++) m_busDevices[iPtr]->GetStatus(true); } @@ -1776,3 +1786,11 @@ bool CCECProcessor::GetDeviceInformation(const char *strPort, libcec_configurati m_communication = NULL; return true; } + +bool CCECProcessor::TransmitPendingActiveSourceCommands(void) +{ + bool bReturn(true); + for (unsigned int iPtr = 0; iPtr < CECDEVICE_BROADCAST; iPtr++) + bReturn &= m_busDevices[iPtr]->TransmitPendingActiveSourceCommands(); + return bReturn; +}