MCPcopy Create free account
hub / github.com/Pulse-Eight/libcec / SendSetActiveSource

Method SendSetActiveSource

src/libcec/CECClient.cpp:540–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

538}
539
540bool CCECClient::SendSetActiveSource(const cec_device_type type /* = CEC_DEVICE_TYPE_RESERVED */)
541{
542 // get the devices that are controlled by us
543 CECDEVICEVEC devices;
544 m_processor->GetDevices()->GetByLogicalAddresses(devices, m_configuration.logicalAddresses);
545
546 // filter out the device that matches the given type
547 if (type != CEC_DEVICE_TYPE_RESERVED)
548 CCECDeviceMap::FilterType(type, devices);
549
550 // no devices left, re-fetch the list of devices that are controlled by us
551 if (devices.empty())
552 m_processor->GetDevices()->GetByLogicalAddresses(devices, m_configuration.logicalAddresses);
553
554 if (!devices.empty())
555 {
556 // get the first device from the list
557 CCECBusDevice *device = *devices.begin();
558
559 // and activate it
560 if (!m_processor->CECInitialised())
561 device->MarkAsActiveSource();
562 else if (device->HasValidPhysicalAddress())
563 return device->ActivateSource();
564 }
565
566 return false;
567}
568
569CCECPlaybackDevice *CCECClient::GetPlaybackDevice(void)
570{

Callers 1

SetActiveSourceMethod · 0.80

Calls 6

GetByLogicalAddressesMethod · 0.80
GetDevicesMethod · 0.80
CECInitialisedMethod · 0.80
MarkAsActiveSourceMethod · 0.80
ActivateSourceMethod · 0.45

Tested by

no test coverage detected