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

Method SetPhysicalAddress

src/libcec/implementations/CECCommandHandler.cpp:889–916  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

887}
888
889void CCECCommandHandler::SetPhysicalAddress(cec_logical_address iAddress, uint16_t iNewAddress)
890{
891 if (!m_processor->IsHandledByLibCEC(iAddress))
892 {
893 CCECBusDevice *otherDevice = m_processor->GetDeviceByPhysicalAddress(iNewAddress);
894 CECClientPtr client = otherDevice ? otherDevice->GetClient() : CECClientPtr();
895
896 CCECBusDevice *device = m_processor->GetDevice(iAddress);
897 if (device)
898 device->SetPhysicalAddress(iNewAddress);
899 else
900 LIB_CEC->AddLog(CEC_LOG_DEBUG, "device with logical address %X not found", iAddress);
901
902 /* another device reported the same physical address as ours */
903 if (client)
904 {
905 libcec_parameter param;
906 param.paramType = CEC_PARAMETER_TYPE_STRING;
907 param.paramData = (void*)"Physical address in use by another device. Please verify your settings";
908 client->Alert(CEC_ALERT_PHYSICAL_ADDRESS_ERROR, param);
909 client->ResetPhysicalAddress();
910 }
911 }
912 else
913 {
914 LIB_CEC->AddLog(CEC_LOG_DEBUG, "ignore physical address report for device %s (%X) because it's marked as handled by libCEC", ToString(iAddress), iAddress);
915 }
916}
917
918bool CCECCommandHandler::PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination)
919{

Callers 1

HandleActiveSourceMethod · 0.45

Calls 8

ToStringFunction · 0.85
ResetPhysicalAddressMethod · 0.80
IsHandledByLibCECMethod · 0.45
GetClientMethod · 0.45
GetDeviceMethod · 0.45
AddLogMethod · 0.45
AlertMethod · 0.45

Tested by

no test coverage detected