void CSLCommandHandler::HandleVendorCommand01(const cec_command &command)
{
  m_processor->GetPrimaryDevice()->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
  TransmitVendorCommand0205(command.destination, command.initiator);

  CCECBusDevice* dev = m_processor->GetDevice(command.destination);
  if (dev && dev->IsHandledByLibCEC() && dev->IsActiveSource())
    dev->TransmitActiveSource(false);
}
Beispiel #2
0
void CCECBusDevice::SetActiveRoute(uint16_t iRoute)
{
  SetPowerStatus(CEC_POWER_STATUS_ON);

  CCECDeviceMap* map = m_processor->GetDevices();
  if (!map)
    return;

  CCECBusDevice* newRoute = m_processor->GetDeviceByPhysicalAddress(iRoute, true);
  if (newRoute && newRoute->IsHandledByLibCEC() && !newRoute->IsActiveSource())
  {
    // we were made the active source, send notification
    newRoute->ActivateSource();
  }
}
Beispiel #3
0
bool CCECProcessor::IsActiveSource(cec_logical_address iAddress)
{
  CCECBusDevice *device = m_busDevices->At(iAddress);
  return device && device->IsActiveSource();
}
Beispiel #4
0
bool CCECClient::SetConfiguration(const libcec_configuration &configuration)
{
  bool bIsRunning(m_processor && m_processor->CECInitialised());
  CCECBusDevice *primary = bIsRunning ? GetPrimaryDevice() : NULL;
  uint16_t iPA = primary ? primary->GetCurrentPhysicalAddress() : CEC_INVALID_PHYSICAL_ADDRESS;

  // update the callbacks
  if (configuration.callbacks)
    EnableCallbacks(configuration.callbackParam, configuration.callbacks);

  // update the client version
  SetClientVersion((cec_client_version)configuration.clientVersion);

  // update the OSD name
  CStdString strOSDName(configuration.strDeviceName);
  SetOSDName(strOSDName);

  // update the TV vendor override
  SetTVVendorOverride((cec_vendor_id)configuration.tvVendor);

  // just copy these
  {
    CLockObject lock(m_mutex);
    m_configuration.bUseTVMenuLanguage   = configuration.bUseTVMenuLanguage;
    m_configuration.bActivateSource      = configuration.bActivateSource;
    m_configuration.bGetSettingsFromROM  = configuration.bGetSettingsFromROM;
    m_configuration.wakeDevices          = configuration.wakeDevices;
    m_configuration.powerOffDevices      = configuration.powerOffDevices;
    m_configuration.bPowerOffScreensaver = configuration.bPowerOffScreensaver;
    m_configuration.bPowerOffOnStandby   = configuration.bPowerOffOnStandby;

    // client version 1.5.1
    if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_5_1)
      m_configuration.bSendInactiveSource = configuration.bSendInactiveSource;

    // client version 1.6.0
    if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_0)
    {
      m_configuration.bPowerOffDevicesOnStandby = configuration.bPowerOffDevicesOnStandby;
      m_configuration.bShutdownOnStandby        = configuration.bShutdownOnStandby;
    }

    // client version 1.6.2
    if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_2)
    {
      memcpy(m_configuration.strDeviceLanguage, configuration.strDeviceLanguage, 3);
    }

    // client version 1.6.3
    if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_3)
    {
      m_configuration.bMonitorOnly = configuration.bMonitorOnly;
    }

    // client version 1.8.0
    if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_8_0)
      m_configuration.cecVersion   = configuration.cecVersion;

    // client version 1.8.2
    if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_8_2)
      m_configuration.adapterType  = configuration.adapterType;

    // ensure that there is at least 1 device type set
    if (m_configuration.deviceTypes.IsEmpty())
      m_configuration.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE);
  }

  bool bNeedReinit(false);

  // device types
  if (SetDeviceTypes(configuration.deviceTypes))
  {
    // the device type changed. just copy the rest, and re-register
    {
      CLockObject lock(m_mutex);
      m_configuration.iPhysicalAddress = configuration.iPhysicalAddress;
      m_configuration.baseDevice       = configuration.baseDevice;
      m_configuration.iHDMIPort        = configuration.iHDMIPort;
      bNeedReinit = true;
    }
  }
  else
  {
    // set the physical address
    SetPhysicalAddress(configuration);
  }

  // persist the new configuration
  PersistConfiguration(m_configuration);

  if (!primary)
    primary = GetPrimaryDevice();

  if (bNeedReinit || !primary || primary->GetCurrentPhysicalAddress() != iPA)
  {
    // PA or device type changed
    m_processor->RegisterClient(this);
  }
  else if (primary && configuration.bActivateSource == 1 && bIsRunning && !primary->IsActiveSource())
  {
    // activate the source if we're not already the active source
    primary->ActivateSource();
  }

  return true;
}