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;
{
CCECBusDevice *device = GetDevice(command.destination);
if (device)
- return device->TransmitPhysicalAddress();
+ {
+ device->SetActiveSource();
+ return device->TransmitPhysicalAddress() &&
+ device->TransmitActiveSource();
+ }
}
return false;
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))
+ /* one of the device handled by libCEC has been made active */
+ CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamAddress);
+ if (device && m_busDevice->MyLogicalAddressContains(device->GetLogicalAddress()))
{
- CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamAddress);
- if (device)
- {
- return device->TransmitActiveSource() &&
- device->TransmitMenuState(command.initiator);
- }
+ device->SetActiveSource();
+ device->TransmitActiveSource();
}
}
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;
}
{
CCECBusDevice *device = GetDevice(command.destination);
if (device)
+ {
device->SetPowerStatus(CEC_POWER_STATUS_ON);
+ if (device->MyLogicalAddressContains(device->GetLogicalAddress()))
+ {
+ device->SetActiveSource();
+ device->TransmitActiveSource();
+
+ if (device->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE ||
+ device->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE)
+ ((CCECPlaybackDevice *)device)->TransmitDeckStatus(command.initiator);
+ }
+ }
+ }
+ else
+ {
+ m_processor->SetCurrentButton((cec_user_control_code) command.parameters[0]);
}
-
- m_processor->SetCurrentButton((cec_user_control_code) command.parameters[0]);
return true;
}
}
return Transmit(command);
}
-bool CCECCommandHandler::TransmitKeypress(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_user_control_code key)
+bool CCECCommandHandler::TransmitKeypress(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_user_control_code key, bool bWait /* = true */)
{
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_USER_CONTROL_PRESSED);
command.parameters.PushBack((uint8_t)key);
- return Transmit(command);
+ return Transmit(command, bWait);
}
-bool CCECCommandHandler::TransmitKeyRelease(const cec_logical_address iInitiator, const cec_logical_address iDestination)
+bool CCECCommandHandler::TransmitKeyRelease(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWait /* = true */)
{
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_USER_CONTROL_RELEASE);
- return Transmit(command);
+ return Transmit(command, bWait);
}
bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /* = true */)
return false;
}
+
+bool CCECCommandHandler::InitHandler(void)
+{
+ if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
+ {
+ CCECBusDevice *primary = m_processor->GetPrimaryDevice();
+ primary->SetPowerStatus(CEC_POWER_STATUS_ON);
+ primary->SetMenuState(CEC_MENU_STATE_ACTIVATED);
+
+ m_processor->SetActiveSource();
+ primary->TransmitMenuState(m_busDevice->GetLogicalAddress());
+ }
+ return true;
+}