{
if (m_busDevices[address]->TryLogicalAddress())
{
- /* only set our OSD name and active source for the primary device */
- if (m_logicalAddresses.IsEmpty())
- {
- m_busDevices[address]->m_strDeviceName = m_strDeviceName;
- m_busDevices[address]->m_bActiveSource = true;
- }
m_logicalAddresses.Set(address);
return true;
}
}
else
{
+ /* only set our OSD name and active source for the primary device */
+ m_busDevices[m_logicalAddresses.primary]->m_strDeviceName = m_strDeviceName;
+ m_busDevices[m_logicalAddresses.primary]->m_bActiveSource = true;
+
SetAckMask(m_logicalAddresses.AckMask());
CLockObject lock(&m_mutex);
}
}
- bReturn = m_busDevices[addr]->TransmitActiveSource() &&
- SetStreamPath(m_busDevices[addr]->GetPhysicalAddress(false));
+ m_busDevices[addr]->SetActiveSource();
+ bReturn = m_busDevices[addr]->TransmitActiveSource();
if (bReturn && (m_busDevices[addr]->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE ||
m_busDevices[addr]->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE))
return bReturn;
}
+bool CCECProcessor::SetActiveSource(uint16_t iStreamPath)
+{
+ bool bReturn(false);
+
+ CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamPath);
+ if (device)
+ {
+ device->SetActiveSource();
+ bReturn = true;
+ }
+
+ return bReturn;
+}
+
void CCECProcessor::SetStandardLineTimeout(uint8_t iTimeout)
{
CLockObject lock(&m_mutex);
return false;
}
-bool CCECProcessor::SetStreamPath(uint16_t iStreamPath)
-{
- bool bReturn(false);
-
- CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamPath);
- if (device)
- {
- device->SetActiveDevice();
- bReturn = true;
- }
-
- return bReturn;
-}
-
bool CCECProcessor::TransmitInactiveSource(void)
{
if (!IsRunning())
uint8_t CCECProcessor::VolumeUp(void)
{
uint8_t status = 0;
- if (IsActiveDevice(CECDEVICE_AUDIOSYSTEM))
+ if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM))
status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeUp();
return status;
uint8_t CCECProcessor::VolumeDown(void)
{
uint8_t status = 0;
- if (IsActiveDevice(CECDEVICE_AUDIOSYSTEM))
+ if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM))
status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeDown();
return status;
uint8_t CCECProcessor::MuteAudio(void)
{
uint8_t status = 0;
- if (IsActiveDevice(CECDEVICE_AUDIOSYSTEM))
+ if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM))
status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->MuteAudio();
return status;
return addresses;
}
-bool CCECProcessor::IsActiveDevice(cec_logical_address address)
+bool CCECProcessor::IsPresentDevice(cec_logical_address address)
{
return m_busDevices[address]->GetStatus() == CEC_DEVICE_STATUS_PRESENT;
}
-bool CCECProcessor::IsActiveDeviceType(cec_device_type type)
+bool CCECProcessor::IsPresentDeviceType(cec_device_type type)
{
for (unsigned int iPtr = 0; iPtr < 15; iPtr++)
{
virtual cec_logical_addresses GetActiveDevices(void);
virtual uint16_t GetDevicePhysicalAddress(cec_logical_address iAddress);
virtual bool HasLogicalAddress(cec_logical_address address) const { return m_logicalAddresses.IsSet(address); }
- virtual bool IsActiveDevice(cec_logical_address address);
- virtual bool IsActiveDeviceType(cec_device_type type);
+ virtual bool IsPresentDevice(cec_logical_address address);
+ virtual bool IsPresentDeviceType(cec_device_type type);
virtual uint16_t GetPhysicalAddress(void) const;
virtual uint64_t GetLastTransmission(void) const { return m_iLastTransmission; }
virtual bool IsStarted(void) const { return m_bStarted; }
virtual bool SetLogicalAddress(cec_logical_address iLogicalAddress);
virtual bool SetMenuState(cec_menu_state state, bool bSendUpdate = true);
virtual bool SetPhysicalAddress(uint16_t iPhysicalAddress);
- virtual bool SetStreamPath(uint16_t iStreamPath);
+ virtual bool SetActiveSource(uint16_t iStreamPath);
virtual bool SwitchMonitoring(bool bEnable);
virtual bool PollDevice(cec_logical_address iAddress);
virtual uint8_t VolumeUp(void);
bool CLibCEC::IsActiveDevice(cec_logical_address iAddress)
{
if (m_cec && iAddress >= CECDEVICE_TV && iAddress < CECDEVICE_BROADCAST)
- return m_cec->IsActiveDevice(iAddress);
+ return m_cec->IsPresentDevice(iAddress);
return false;
}
bool CLibCEC::IsActiveDeviceType(cec_device_type type)
{
if (m_cec && type >= CEC_DEVICE_TYPE_TV && type <= CEC_DEVICE_TYPE_AUDIO_SYSTEM)
- return m_cec->IsActiveDeviceType(type);
+ return m_cec->IsPresentDeviceType(type);
return false;
}
m_bActiveSource = false;
}
-void CCECBusDevice::SetActiveDevice(void)
+void CCECBusDevice::SetActiveSource(void)
{
CLockObject lock(&m_writeMutex);
virtual void SetInactiveDevice(void);
- virtual void SetActiveDevice(void);
+ virtual void SetActiveSource(void);
virtual bool TryLogicalAddress(void);
virtual void SetDeviceStatus(const cec_bus_device_status newStatus);
if (command.parameters.size == 2)
{
uint16_t iAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
- return m_processor->SetStreamPath(iAddress);
+ return m_processor->SetActiveSource(iAddress);
}
return true;
bool CCECCommandHandler::HandleImageViewOn(const cec_command &command)
{
- m_processor->SetStreamPath(m_processor->m_busDevices[command.initiator]->GetPhysicalAddress(false));
+ m_processor->m_busDevices[command.initiator]->SetActiveSource();
return true;
}
if (command.parameters.size == 2)
{
uint16_t iNewAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
- m_processor->SetStreamPath(iNewAddress);
+ m_processor->SetActiveSource(iNewAddress);
}
return false;
strLog.Format(">> %i sets stream path to physical address %04x", command.initiator, iStreamAddress);
m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
- if (m_processor->SetStreamPath(iStreamAddress))
+ CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamAddress);
+ if (device)
{
- CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamAddress);
- if (device)
- {
- return device->TransmitActiveSource() &&
- device->TransmitMenuState(command.initiator);
- }
+ device->SetActiveSource();
+ return device->TransmitActiveSource() &&
+ device->TransmitMenuState(command.initiator);
}
}
return false;
uint16_t iNewAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
CCECBusDevice *newActiveDevice = GetDeviceByPhysicalAddress(iNewAddress);
if (newActiveDevice)
- m_processor->SetStreamPath(newActiveDevice->GetPhysicalAddress(false));
+ newActiveDevice->SetActiveSource();
return ((CCECAudioSystem *) device)->TransmitSetSystemAudioMode(command.initiator);
}
else
bool CCECCommandHandler::HandleTextViewOn(const cec_command &command)
{
- m_processor->SetStreamPath(m_processor->m_busDevices[command.initiator]->GetPhysicalAddress(false));
+ m_processor->m_busDevices[command.initiator]->SetActiveSource();
return true;
}
void CSLCommandHandler::HandleVendorCommandSLConnect(const cec_command &command)
{
m_bSLEnabled = true;
+ m_processor->m_busDevices[command.initiator]->SetActiveSource();
m_processor->m_busDevices[command.destination]->TransmitActiveSource();
- m_processor->SetStreamPath(m_processor->m_busDevices[command.destination]->GetPhysicalAddress(false));
TransmitVendorCommand05(command.destination, command.initiator);
TransmitDeckStatus(command.initiator);
}