return bReturn;
}
+void CCECProcessor::SetActiveSource(bool bSetTo, bool bClientUnregistered)
+{
+ if (m_communication)
+ m_communication->SetActiveSource(bSetTo, bClientUnregistered);
+}
+
void CCECProcessor::SetStandardLineTimeout(uint8_t iTimeout)
{
CLockObject lock(m_mutex);
m_clients.erase(entry);
// reset the device status
- (*it)->ResetDeviceStatus();
+ (*it)->ResetDeviceStatus(true);
}
}
bool SetDeckInfo(cec_deck_info info, bool bSendUpdate = true);
bool ActivateSource(uint16_t iStreamPath);
+ void SetActiveSource(bool bSetTo, bool bClientUnregistered);
bool PollDevice(cec_logical_address iAddress);
void SetStandardLineTimeout(uint8_t iTimeout);
uint8_t GetStandardLineTimeout(void);
*/
virtual uint16_t GetAdapterProductId(void) const = 0;
+ /*!
+ * @brief Marks the adapter as active or inactive source
+ * @param bSetTo True to mark as active source, false to mark as inactive source
+ * @param bClientUnregistered True when the client was unregistered, false when the device was explicitly marked as (in)active source
+ */
+ virtual void SetActiveSource(bool bSetTo, bool bClientUnregistered) = 0;
+
IAdapterCommunicationCallback *m_callback;
};
};
return bReturn;
}
+void CUSBCECAdapterCommands::SetActiveSource(bool bSetTo, bool bClientUnregistered)
+{
+ if (bClientUnregistered) return;
+ if (m_persistedConfiguration.iFirmwareVersion >= 3)
+ {
+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "marking the adapter as %s source", bSetTo ? "active" : "inactive");
+ CCECAdapterMessage params;
+ params.PushEscaped(bSetTo ? 1 : 0);
+ CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_SET_ACTIVE_SOURCE, params);
+ delete message;
+ }
+}
+
bool CUSBCECAdapterCommands::StartBootloader(void)
{
LIB_CEC->AddLog(CEC_LOG_DEBUG, "starting the bootloader");
*/
bool WriteEEPROM(void);
+ void SetActiveSource(bool bSetTo, bool bClientUnregistered);
+
private:
/*!
* @brief Reads all settings from the eeprom.
return iBuildDate >= CEC_FW_DATE_DESCRIPTOR2 ? CEC_PID2 : CEC_PID;
}
+void CUSBCECAdapterCommunication::SetActiveSource(bool bSetTo, bool bClientUnregistered)
+{
+ if (m_commands)
+ m_commands->SetActiveSource(bSetTo, bClientUnregistered);
+}
+
bool CUSBCECAdapterCommunication::IsRunningLatestFirmware(void)
{
return GetFirmwareBuildDate() >= CEC_LATEST_ADAPTER_FW_DATE &&
cec_adapter_type GetAdapterType(void);
uint16_t GetAdapterVendorId(void) const;
uint16_t GetAdapterProductId(void) const;
+ void SetActiveSource(bool bSetTo, bool bClientUnregistered);
///}
bool ProvidesExtendedResponse(void);
MSGCODE_SET_OSD_NAME,
MSGCODE_WRITE_EEPROM,
MSGCODE_GET_ADAPTER_TYPE,
+ MSGCODE_SET_ACTIVE_SOURCE,
+
MSGCODE_FRAME_EOM = 0x80,
MSGCODE_FRAME_ACK = 0x40,
} cec_adapter_messagecode;
thisMsgCode == MSGCODE_SET_HDMI_VERSION ||
thisMsgCode == MSGCODE_SET_OSD_NAME ||
thisMsgCode == MSGCODE_WRITE_EEPROM ||
- thisMsgCode == MSGCODE_TRANSMIT_IDLETIME)
+ thisMsgCode == MSGCODE_TRANSMIT_IDLETIME ||
+ thisMsgCode == MSGCODE_SET_ACTIVE_SOURCE)
return thisMsgCode == msgResponse;
if (!m_message->IsTranmission())
cec_adapter_type GetAdapterType(void) { return ADAPTERTYPE_RPI; };
uint16_t GetAdapterVendorId(void) const { return RPI_ADAPTER_VID; }
uint16_t GetAdapterProductId(void) const { return RPI_ADAPTER_PID; }
+ void SetActiveSource(bool UNUSED(bSetTo), bool UNUSED(bClientUnregistered)) {}
///}
bool IsInitialised(void);
uint16_t GetAdapterVendorId(void) const { return TDA995X_ADAPTER_VID; }
uint16_t GetAdapterProductId(void) const { return TDA995X_ADAPTER_PID; }
void HandleLogicalAddressLost(cec_logical_address oldAddress);
+ void SetActiveSource(bool UNUSED(bSetTo), bool UNUSED(bClientUnregistered)) {}
///}
/** @name PLATFORM::CThread implementation */
if (m_deviceStatus != newStatus)
{
LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s (%X): device status changed into 'not present'", GetLogicalAddressName(), m_iLogicalAddress);
- ResetDeviceStatus();
+ ResetDeviceStatus(true);
m_deviceStatus = newStatus;
}
break;
}
}
-void CCECBusDevice::ResetDeviceStatus(void)
+void CCECBusDevice::ResetDeviceStatus(bool bClientUnregistered /* = false */)
{
CLockObject lock(m_mutex);
SetPowerStatus (CEC_POWER_STATUS_UNKNOWN);
SetCecVersion (CEC_VERSION_UNKNOWN);
SetStreamPath (CEC_INVALID_PHYSICAL_ADDRESS);
SetOSDName (ToString(m_iLogicalAddress));
- MarkAsInactiveSource();
+ MarkAsInactiveSource(bClientUnregistered);
m_iLastActive = 0;
m_bVendorIdRequested = false;
if (bWasActivated)
{
+ m_processor->SetActiveSource(true, false);
CCECClient *client = GetClient();
if (client)
client->SourceActivated(m_iLogicalAddress);
}
}
-void CCECBusDevice::MarkAsInactiveSource(void)
+void CCECBusDevice::MarkAsInactiveSource(bool bClientUnregistered /* = false */)
{
bool bWasDeactivated(false);
{
if (bWasDeactivated)
{
+ m_processor->SetActiveSource(false, bClientUnregistered);
CCECClient *client = GetClient();
if (client)
client->SourceDeactivated(m_iLogicalAddress);
virtual cec_bus_device_status GetCurrentStatus(void) { return GetStatus(false, true); }
virtual cec_bus_device_status GetStatus(bool bForcePoll = false, bool bSuppressPoll = false);
virtual void SetDeviceStatus(const cec_bus_device_status newStatus, cec_version libCECSpecVersion = CEC_VERSION_1_4);
- virtual void ResetDeviceStatus(void);
+ virtual void ResetDeviceStatus(bool bClientUnregistered = false);
virtual bool TransmitPoll(const cec_logical_address destination, bool bUpdateDeviceStatus);
virtual void HandlePoll(const cec_logical_address destination);
virtual void HandlePollFrom(const cec_logical_address initiator);
virtual bool IsActiveSource(void) const { return m_bActiveSource; }
virtual bool RequestActiveSource(bool bWaitForResponse = true);
virtual void MarkAsActiveSource(void);
- virtual void MarkAsInactiveSource(void);
+ virtual void MarkAsInactiveSource(bool bClientUnregistered = false);
virtual bool TransmitActiveSource(bool bIsReply);
virtual bool TransmitImageViewOn(void);
virtual bool TransmitInactiveSource(void);