if (bHandled && !bHandlerChanged)
{
- CLockObject lock(&m_processor->m_transmitMutex);
+ CLockObject lock(&m_receiveMutex);
m_condition.Signal();
}
bool CCECCommandHandler::HandleDeviceVendorCommandWithId(const cec_command &command)
{
- if (m_busDevice->MyLogicalAddressContains(command.destination))
+ if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination))
m_processor->TransmitAbort(command.initiator, command.opcode, CEC_ABORT_REASON_REFUSED);
return true;
bool CCECCommandHandler::HandleGetCecVersion(const cec_command &command)
{
- if (m_busDevice->MyLogicalAddressContains(command.destination))
+ if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination))
{
CCECBusDevice *device = GetDevice(command.destination);
if (device)
bool CCECCommandHandler::HandleGiveAudioStatus(const cec_command &command)
{
- if (m_busDevice->MyLogicalAddressContains(command.destination))
+ if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination))
{
CCECBusDevice *device = GetDevice(command.destination);
if (device && device->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM)
bool CCECCommandHandler::HandleGiveDeckStatus(const cec_command &command)
{
- if (m_busDevice->MyLogicalAddressContains(command.destination))
+ if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination))
{
CCECBusDevice *device = GetDevice(command.destination);
if (device && (device->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE || device->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE))
bool CCECCommandHandler::HandleGiveDevicePowerStatus(const cec_command &command)
{
- if (m_busDevice->MyLogicalAddressContains(command.destination))
+ if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination))
{
CCECBusDevice *device = GetDevice(command.destination);
if (device)
bool CCECCommandHandler::HandleGiveDeviceVendorId(const cec_command &command)
{
- if (m_busDevice->MyLogicalAddressContains(command.destination))
+ if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination))
{
CCECBusDevice *device = GetDevice(command.destination);
if (device)
bool CCECCommandHandler::HandleGiveOSDName(const cec_command &command)
{
- if (m_busDevice->MyLogicalAddressContains(command.destination))
+ if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination))
{
CCECBusDevice *device = GetDevice(command.destination);
if (device)
bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command &command)
{
- if (m_busDevice->MyLogicalAddressContains(command.destination))
+ if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination))
{
CCECBusDevice *device = GetDevice(command.destination);
if (device)
bool CCECCommandHandler::HandleGiveSystemAudioModeStatus(const cec_command &command)
{
- if (m_busDevice->MyLogicalAddressContains(command.destination))
+ if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination))
{
CCECBusDevice *device = GetDevice(command.destination);
if (device && device->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM)
bool CCECCommandHandler::HandleImageViewOn(const cec_command &command)
{
- m_processor->SetActiveSource(command.initiator);
+ m_processor->SetStreamPath(m_processor->m_busDevices[command.initiator]->GetPhysicalAddress(false));
return true;
}
bool CCECCommandHandler::HandleMenuRequest(const cec_command &command)
{
- if (m_busDevice->MyLogicalAddressContains(command.destination))
+ if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination))
{
if (command.parameters[0] == CEC_MENU_REQUEST_TYPE_QUERY)
{
bool CCECCommandHandler::HandleRequestActiveSource(const cec_command &command)
{
- CStdString strLog;
- strLog.Format(">> %i requests active source", (uint8_t) command.initiator);
- m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
+ if (m_processor->IsStarted())
+ {
+ CStdString strLog;
+ strLog.Format(">> %i requests active source", (uint8_t) command.initiator);
+ m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
- vector<CCECBusDevice *> devices;
- for (int iDevicePtr = (int)GetMyDevices(devices)-1; iDevicePtr >=0; iDevicePtr--)
- devices[iDevicePtr]->TransmitActiveSource();
+ vector<CCECBusDevice *> devices;
+ for (int iDevicePtr = (int)GetMyDevices(devices)-1; iDevicePtr >=0; iDevicePtr--)
+ devices[iDevicePtr]->TransmitActiveSource();
- return true;
+ return true;
+ }
+ return false;
}
bool CCECCommandHandler::HandleRoutingChange(const cec_command &command)
bool CCECCommandHandler::HandleSetStreamPath(const cec_command &command)
{
- if (command.parameters.size >= 2)
+ if (m_processor->IsStarted() && command.parameters.size >= 2)
{
uint16_t iStreamAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
CStdString strLog;
bool CCECCommandHandler::HandleSystemAudioModeRequest(const cec_command &command)
{
- if (m_busDevice->MyLogicalAddressContains(command.destination))
+ if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination))
{
CCECBusDevice *device = GetDevice(command.destination);
if (device && device->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM)
uint16_t iNewAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
CCECBusDevice *newActiveDevice = GetDeviceByPhysicalAddress(iNewAddress);
if (newActiveDevice)
- m_processor->SetActiveSource(newActiveDevice->GetLogicalAddress());
+ m_processor->SetStreamPath(newActiveDevice->GetPhysicalAddress(false));
return ((CCECAudioSystem *) device)->TransmitSetSystemAudioMode(command.initiator);
}
else
bool CCECCommandHandler::HandleTextViewOn(const cec_command &command)
{
- m_processor->SetActiveSource(command.initiator);
+ m_processor->SetStreamPath(m_processor->m_busDevices[command.initiator]->GetPhysicalAddress(false));
return true;
}
bool CCECCommandHandler::HandleUserControlPressed(const cec_command &command)
{
- if (m_busDevice->MyLogicalAddressContains(command.destination) && command.parameters.size > 0)
+ if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination) && command.parameters.size > 0)
{
m_processor->AddKey();
bool CCECCommandHandler::HandleUserControlRelease(const cec_command &command)
{
- if (m_busDevice->MyLogicalAddressContains(command.destination))
+ if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination))
m_processor->AddKey();
return true;
command.retries = m_iTransmitRetries;
CLockObject writeLock(&m_processor->m_transmitMutex);
+ CLockObject receiveLock(&m_receiveMutex);
if (m_processor->Transmit(command))
{
if (bExpectResponse)
- return m_condition.Wait(&m_processor->m_transmitMutex, m_iTransmitWait);
+ return m_condition.Wait(&m_receiveMutex, m_iTransmitWait);
return true;
}