+ MarkBusy();
+ if (iVendorId == CEC_VENDOR_UNKNOWN)
+ {
+ if (bSendAbort)
+ {
+ CLibCEC::AddLog(CEC_LOG_NOTICE, "<< %s (%X) -> %s (%X): vendor id feature abort", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest);
+ m_processor->TransmitAbort(dest, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
+ bReturn = true;
+ }
+ }
+ else
+ {
+ CLibCEC::AddLog(CEC_LOG_NOTICE, "<< %s (%X) -> %s (%X): vendor id %s (%x)", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, ToString((cec_vendor_id)iVendorId), iVendorId);
+ bReturn = m_handler->TransmitVendorID(m_iLogicalAddress, iVendorId);
+ }
+ MarkReady();
+ return bReturn;
+}
+
+bool CCECBusDevice::TransmitKeypress(cec_user_control_code key, bool bWait /* = true */)
+{
+ MarkBusy();
+ bool bReturn = m_handler->TransmitKeypress(m_processor->GetLogicalAddress(), m_iLogicalAddress, key, bWait);
+ MarkReady();
+ return bReturn;
+}
+
+bool CCECBusDevice::TransmitKeyRelease(bool bWait /* = true */)
+{
+ MarkBusy();
+ bool bReturn = m_handler->TransmitKeyRelease(m_processor->GetLogicalAddress(), m_iLogicalAddress, bWait);
+ MarkReady();
+ return bReturn;
+}
+
+bool CCECBusDevice::IsUnsupportedFeature(cec_opcode opcode)
+{
+ CLockObject lock(m_mutex);
+ bool bUnsupported = (m_unsupportedFeatures.find(opcode) != m_unsupportedFeatures.end());
+ if (bUnsupported)
+ CLibCEC::AddLog(CEC_LOG_NOTICE, "'%s' is marked as unsupported feature for device '%s'", ToString(opcode), GetLogicalAddressName());
+ return bUnsupported;
+}
+
+void CCECBusDevice::SetUnsupportedFeature(cec_opcode opcode)
+{
+ CLockObject lock(m_mutex);
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "marking opcode '%s' as unsupported feature for device '%s'", ToString(opcode), GetLogicalAddressName());
+ m_unsupportedFeatures.insert(opcode);
+}
+
+bool CCECBusDevice::ActivateSource(void)
+{
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "activating source '%s'", ToString(m_iLogicalAddress));
+ MarkBusy();
+ bool bReturn = m_handler->ActivateSource();
+ MarkReady();
+ return bReturn;
+}
+
+void CCECBusDevice::HandlePoll(cec_logical_address destination)
+{
+ if (destination >= 0 && destination < CECDEVICE_BROADCAST)
+ {
+ CCECBusDevice *device = m_processor->m_busDevices[destination];
+ if (device)
+ device->HandlePollFrom(m_iLogicalAddress);
+ }
+}
+
+void CCECBusDevice::HandlePollFrom(cec_logical_address initiator)
+{
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "<< POLL: %s (%x) -> %s (%x)", ToString(initiator), initiator, ToString(m_iLogicalAddress), m_iLogicalAddress);
+ m_bAwaitingReceiveFailed = true;