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

Method SetPhysicalAddress

src/libcec/CECClient.cpp:226–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226bool CCECClient::SetPhysicalAddress(const libcec_configuration &configuration)
227{
228 // override the physical address from configuration.iPhysicalAddress if it's set
229 if (CLibCEC::IsValidPhysicalAddress(configuration.iPhysicalAddress) &&
230 (configuration.iPhysicalAddress != CEC_PHYSICAL_ADDRESS_TV) &&
231 SetPhysicalAddress(configuration.iPhysicalAddress))
232 {
233 if (m_configuration.bAutodetectAddress == 0)
234 LIB_CEC->AddLog(CEC_LOG_DEBUG, "using provided physical address %04X", configuration.iPhysicalAddress);
235 CLockObject lock(m_mutex);
236 m_configuration.baseDevice = CECDEVICE_UNKNOWN;
237 m_configuration.iHDMIPort = CEC_HDMI_PORTNUMBER_NONE;
238 m_configuration.iPhysicalAddress = configuration.iPhysicalAddress;
239 return true;
240 }
241
242 // try to autodetect the address
243 if (AutodetectPhysicalAddress())
244 {
245 LIB_CEC->AddLog(CEC_LOG_DEBUG, "using auto-detected physical address %04X", m_configuration.iPhysicalAddress);
246 {
247 CLockObject lock(m_mutex);
248 m_configuration.baseDevice = CECDEVICE_UNKNOWN;
249 m_configuration.iHDMIPort = CEC_HDMI_PORTNUMBER_NONE;
250 m_configuration.iPhysicalAddress = configuration.iPhysicalAddress;
251 }
252 SetDevicePhysicalAddress(m_configuration.iPhysicalAddress);
253 return true;
254 }
255
256 // use the base device + hdmi port settings
257 if ((configuration.baseDevice != CECDEVICE_UNKNOWN) &&
258 (configuration.iHDMIPort != CEC_HDMI_PORTNUMBER_NONE) &&
259 SetHDMIPort(configuration.baseDevice, configuration.iHDMIPort))
260 {
261 LIB_CEC->AddLog(CEC_LOG_DEBUG, "using device/input physical address %04X", m_configuration.iPhysicalAddress);
262 return true;
263 }
264
265 // reset to defaults if something went wrong
266 if (m_processor->CECInitialised()) {
267 ResetPhysicalAddress();
268 }
269 return false;
270}
271
272bool CCECClient::SetPhysicalAddress(const uint16_t iPhysicalAddress)
273{

Callers 1

Calls 3

SetPhysicalAddressFunction · 0.85
CECInitialisedMethod · 0.80
AddLogMethod · 0.45

Tested by

no test coverage detected