| 885 | } |
| 886 | |
| 887 | bool CCECClient::SetConfiguration(const libcec_configuration &configuration) |
| 888 | { |
| 889 | bool notifyUpper = false; |
| 890 | libcec_configuration defaultSettings; |
| 891 | bool bIsRunning(m_processor && m_processor->CECInitialised()); |
| 892 | CCECBusDevice *primary = bIsRunning ? GetPrimaryDevice() : NULL; |
| 893 | uint16_t iPA = primary ? primary->GetCurrentPhysicalAddress() : CEC_INVALID_PHYSICAL_ADDRESS; |
| 894 | |
| 895 | // update the callbacks |
| 896 | if (!!configuration.callbacks) |
| 897 | EnableCallbacks(configuration.callbackParam, configuration.callbacks); |
| 898 | |
| 899 | // update the client version |
| 900 | SetClientVersion(configuration.clientVersion); |
| 901 | |
| 902 | // update the OSD name |
| 903 | std::string strOSDName(configuration.strDeviceName); |
| 904 | SetOSDName(strOSDName); |
| 905 | |
| 906 | // update the TV vendor override |
| 907 | SetTVVendorOverride((cec_vendor_id)configuration.tvVendor); |
| 908 | |
| 909 | { |
| 910 | CLockObject lock(m_mutex); |
| 911 | bool activeSourceChanged = (configuration.bActivateSource != m_configuration.bActivateSource); |
| 912 | bool wakeTvChanged = (configuration.wakeDevices.IsSet(CECDEVICE_TV) != m_configuration.wakeDevices.IsSet(CECDEVICE_TV)); |
| 913 | |
| 914 | // just copy these |
| 915 | m_configuration.bActivateSource = configuration.bActivateSource; |
| 916 | m_configuration.bGetSettingsFromROM = configuration.bGetSettingsFromROM; |
| 917 | m_configuration.wakeDevices = configuration.wakeDevices; |
| 918 | m_configuration.powerOffDevices = configuration.powerOffDevices; |
| 919 | memcpy(m_configuration.strDeviceLanguage, configuration.strDeviceLanguage, 3); |
| 920 | m_configuration.bMonitorOnly = configuration.bMonitorOnly; |
| 921 | m_configuration.cecVersion = configuration.cecVersion; |
| 922 | m_configuration.adapterType = configuration.adapterType; |
| 923 | m_configuration.iDoubleTapTimeoutMs = configuration.iDoubleTapTimeoutMs; |
| 924 | m_configuration.deviceTypes = configuration.deviceTypes; |
| 925 | m_configuration.comboKey = configuration.comboKey; |
| 926 | m_configuration.iComboKeyTimeoutMs = configuration.iComboKeyTimeoutMs; |
| 927 | m_configuration.iButtonRepeatRateMs = configuration.iButtonRepeatRateMs; |
| 928 | m_configuration.iButtonReleaseDelayMs = configuration.iButtonReleaseDelayMs; |
| 929 | m_configuration.bAutoWakeAVR = configuration.bAutoWakeAVR; |
| 930 | #if CEC_LIB_VERSION_MAJOR >= 5 |
| 931 | if ((configuration.bAutoPowerOn == 0) || (configuration.bAutoPowerOn == 1)) |
| 932 | m_configuration.bAutoPowerOn = configuration.bAutoPowerOn; |
| 933 | #endif |
| 934 | |
| 935 | if (activeSourceChanged) |
| 936 | { |
| 937 | // activate source will wake up the TV too |
| 938 | if ((m_configuration.bActivateSource == 1) && !m_configuration.wakeDevices.IsSet(CECDEVICE_TV)) |
| 939 | { |
| 940 | m_configuration.wakeDevices.Set(CECDEVICE_TV); |
| 941 | LIB_CEC->AddLog(CEC_LOG_DEBUG, "enable tv wake up"); |
| 942 | notifyUpper = true; |
| 943 | } |
| 944 | } |
nothing calls this directly
no test coverage detected