return CEC_POWER_STATUS_UNKNOWN;
}
-cec_logical_address CCECProcessor::GetActiveSource(void)
+cec_logical_address CCECProcessor::GetActiveSource(bool bRequestActiveSource /* = true */)
{
for (uint8_t iPtr = 0; iPtr <= 11; iPtr++)
{
return (cec_logical_address)iPtr;
}
+ if (bRequestActiveSource && m_configuration.logicalAddresses.primary != CECDEVICE_UNKNOWN)
+ {
+ CCECBusDevice *primary = m_busDevices[m_configuration.logicalAddresses.primary];
+ if (primary)
+ primary->RequestActiveSource();
+
+ return GetActiveSource(false);
+ }
+
return CECDEVICE_UNKNOWN;
}
bool IsPresentDeviceType(cec_device_type type);
uint16_t GetPhysicalAddress(void) const;
uint64_t GetLastTransmission(void) const { return m_iLastTransmission; }
- cec_logical_address GetActiveSource(void);
+ cec_logical_address GetActiveSource(bool bRequestActiveSource = true);
bool IsActiveSource(cec_logical_address iAddress);
bool IsInitialised(void);
bool SetStreamPath(uint16_t iPhysicalAddress);
return m_cecVersion;
}
+bool CCECBusDevice::RequestActiveSource(bool bWaitForResponse /* = true */)
+{
+ bool bReturn(false);
+
+ if (MyLogicalAddressContains(m_iLogicalAddress))
+ {
+ MarkBusy();
+ CLibCEC::AddLog(CEC_LOG_NOTICE, "<< requesting active source");
+
+ bReturn = m_handler->TransmitRequestActiveSource(GetMyLogicalAddress(), bWaitForResponse);
+ MarkReady();
+ }
+ return bReturn;
+}
+
bool CCECBusDevice::RequestCecVersion(bool bWaitForResponse /* = true */)
{
bool bReturn(false);
bool ReplaceHandler(bool bActivateSource = true);
virtual bool TransmitPendingActiveSourceCommands(void);
+ virtual bool RequestActiveSource(bool bWaitForResponse = true);
+
protected:
void ResetDeviceStatus(void);
void CheckVendorIdRequested(void);
return Transmit(command);
}
+bool CCECCommandHandler::TransmitRequestActiveSource(const cec_logical_address iInitiator, bool bWaitForResponse /* = true */)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, CECDEVICE_BROADCAST, CEC_OPCODE_REQUEST_ACTIVE_SOURCE);
+
+ return Transmit(command, !bWaitForResponse);
+}
+
bool CCECCommandHandler::TransmitRequestCecVersion(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
{
cec_command command;
virtual bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination);
virtual bool TransmitImageViewOn(const cec_logical_address iInitiator, const cec_logical_address iDestination);
virtual bool TransmitStandby(const cec_logical_address iInitiator, const cec_logical_address iDestination);
+ virtual bool TransmitRequestActiveSource(const cec_logical_address iInitiator, bool bWaitForResponse = true);
virtual bool TransmitRequestCecVersion(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
virtual bool TransmitRequestMenuLanguage(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
virtual bool TransmitRequestOSDName(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
}
cec_logical_address activeSource = parser->GetActiveSource();
- strLog.AppendFormat("currently active source: %s (%X)", parser->ToString(activeSource), (int)activeSource);
+ strLog.AppendFormat("currently active source: %s (%d)", parser->ToString(activeSource), (int)activeSource);
PrintToStdOut(strLog);
return true;