if (!types.IsSet(type))
types.Add(type);
}
+ m_processor->GetTV()->MarkHandlerReady();
// set the new type list
m_configuration.deviceTypes = types;
{
if (it->second->GetHandler()->ActiveSourcePending())
it->second->ActivateSource();
+ it->second->MarkHandlerReady();
}
}
m_iLastTransmission = GetTimeMs();
// set the number of tries
iMaxTries = initiator->GetHandler()->GetTransmitRetries() + 1;
+ initiator->MarkHandlerReady();
}
// and try to send the command
bool CCECProcessor::SetStreamPath(uint16_t iPhysicalAddress)
{
// stream path changes are sent by the TV
- return GetTV()->GetHandler()->TransmitSetStreamPath(iPhysicalAddress);
+ bool bReturn = GetTV()->GetHandler()->TransmitSetStreamPath(iPhysicalAddress);
+ GetTV()->MarkHandlerReady();
+ return bReturn;
}
bool CCECProcessor::CanPersistConfiguration(void)
CCECCommandHandler *handler = GetTV()->GetHandler();
if (handler)
handler->InitHandler();
+ GetTV()->MarkHandlerReady();
}
return bReturn;
return true;
}
+CCECCommandHandler *CCECBusDevice::GetHandler(void)
+{
+ ReplaceHandler(false);
+ MarkBusy();
+ return m_handler;
+}
+
bool CCECBusDevice::HandleCommand(const cec_command &command)
{
bool bHandled(false);
virtual ~CCECBusDevice(void);
virtual bool ReplaceHandler(bool bActivateSource = true);
- virtual CCECCommandHandler * GetHandler(void) const { return m_handler; };
+
+ // TODO use something smarter than this
+ /*!
+ * @brief Get the command handler for this device. Call MarkHandlerReady() when done with it.
+ * @return The current handler.
+ */
+ virtual CCECCommandHandler * GetHandler(void);
+
+ /*!
+ * @brief To be called after GetHandler(), when no longer using it.
+ */
+ virtual void MarkHandlerReady(void) { MarkReady(); }
+
virtual CCECProcessor * GetProcessor(void) const { return m_processor; }
virtual uint64_t GetLastActive(void) const { return m_iLastActive; }
virtual cec_device_type GetType(void) const { return m_type; }
virtual bool ActiveSourcePending(void);
virtual bool SupportsDeviceType(const cec_device_type UNUSED(type)) const { return true; };
- cec_device_type GetReplacementDeviceType(const cec_device_type type) const { return type; }
+ virtual cec_device_type GetReplacementDeviceType(const cec_device_type type) const { return type; }
protected:
virtual bool HandleActiveSource(const cec_command &command);
{
CVLCommandHandler *handler = static_cast<CVLCommandHandler *>(tv->GetHandler());
bPowerUpEventReceived = handler ? handler->PowerUpEventReceived() : false;
+ tv->MarkHandlerReady();
}
if (!bPowerUpEventReceived)