From: Lars Op den Kamp Date: Wed, 15 Feb 2012 15:01:35 +0000 (+0100) Subject: LibCecSharp: added the new parameters X-Git-Tag: upstream/2.2.0~1^2~35^2~45 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b7907707d9d2d9e6ae198ebecf6864cb30484327;p=deb_libcec.git LibCecSharp: added the new parameters --- diff --git a/src/LibCecSharp/CecSharpTypes.h b/src/LibCecSharp/CecSharpTypes.h index 2a32724..212d818 100644 --- a/src/LibCecSharp/CecSharpTypes.h +++ b/src/LibCecSharp/CecSharpTypes.h @@ -360,6 +360,11 @@ namespace CecSharp CecLogicalAddresses(void) { Addresses = gcnew array(16); + Clear(); + } + + void Clear(void) + { for (unsigned int iPtr = 0; iPtr < 16; iPtr++) Addresses[iPtr] = CecLogicalAddress::Unregistered; } @@ -369,6 +374,11 @@ namespace CecSharp return Addresses[(unsigned int)iAddress] != CecLogicalAddress::Unregistered; } + void Set(CecLogicalAddress iAddress) + { + Addresses[(unsigned int)iAddress] = iAddress; + } + property CecLogicalAddress Primary; property array ^ Addresses; }; @@ -512,11 +522,20 @@ namespace CecSharp BaseDevice = (CecLogicalAddress)CEC_DEFAULT_BASE_DEVICE; HDMIPort = CEC_DEFAULT_HDMI_PORT; ClientVersion = CecClientVersion::VersionPre1_5; + TvVendor = CecVendorId::Unknown; GetSettingsFromROM = false; UseTVMenuLanguage = CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE == 1; - PowerOnStartup = CEC_DEFAULT_SETTING_POWER_ON_STARTUP == 1; - PowerOffShutdown = CEC_DEFAULT_SETTING_POWER_OFF_SHUTDOWN == 1; + ActivateSource = CEC_DEFAULT_SETTING_ACTIVATE_SOURCE == 1; + + WakeDevices = gcnew CecLogicalAddresses(); + if (CEC_DEFAULT_SETTING_ACTIVATE_SOURCE == 1) + WakeDevices->Set(CecLogicalAddress::Tv); + + PowerOffDevices = gcnew CecLogicalAddresses(); + if (CEC_DEFAULT_SETTING_POWER_OFF_SHUTDOWN == 1) + PowerOffDevices->Set(CecLogicalAddress::Broadcast); + PowerOffScreensaver = CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER == 1; PowerOffOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY == 1; } @@ -526,22 +545,24 @@ namespace CecSharp Callbacks = callbacks; } - property System::String ^ DeviceName; - property CecDeviceTypeList ^ DeviceTypes; - property uint16_t PhysicalAddress; - property CecLogicalAddress BaseDevice; - property uint8_t HDMIPort; - property CecClientVersion ClientVersion; + property System::String ^ DeviceName; + property CecDeviceTypeList ^ DeviceTypes; + property uint16_t PhysicalAddress; + property CecLogicalAddress BaseDevice; + property uint8_t HDMIPort; + property CecClientVersion ClientVersion; + property CecVendorId TvVendor; // player specific settings - property bool GetSettingsFromROM; - property bool UseTVMenuLanguage; - property bool PowerOnStartup; - property bool PowerOffShutdown; - property bool PowerOffScreensaver; - property bool PowerOffOnStandby; - - property CecCallbackMethods ^Callbacks; + property bool GetSettingsFromROM; + property bool UseTVMenuLanguage; + property bool ActivateSource; + property CecLogicalAddresses ^WakeDevices; + property CecLogicalAddresses ^PowerOffDevices; + property bool PowerOffScreensaver; + property bool PowerOffOnStandby; + + property CecCallbackMethods ^ Callbacks; }; // the callback methods are called by unmanaged code, so we need some delegates for this @@ -718,8 +739,20 @@ namespace CecSharp netConfig->HDMIPort = config.iHDMIPort; netConfig->ClientVersion = (CecClientVersion)config.clientVersion; netConfig->GetSettingsFromROM = config.bGetSettingsFromROM == 1; - netConfig->PowerOnStartup = config.bPowerOnStartup == 1; - netConfig->PowerOffShutdown = config.bPowerOffShutdown == 1; + netConfig->ActivateSource = config.bActivateSource == 1; + + netConfig->WakeDevices->Clear(); + int iDevices(0); + for (uint8_t iPtr = 0; iPtr <= 16; iPtr++) + if (config.wakeDevices[iPtr]) + netConfig->WakeDevices->Addresses[iDevices++] = (CecLogicalAddress)iPtr; + + netConfig->PowerOffDevices->Clear(); + iDevices = 0; + for (uint8_t iPtr = 0; iPtr <= 16; iPtr++) + if (config.powerOffDevices[iPtr]) + netConfig->PowerOffDevices->Addresses[iDevices++] = (CecLogicalAddress)iPtr; + netConfig->PowerOffScreensaver = config.bPowerOffScreensaver == 1; netConfig->PowerOffOnStandby = config.bPowerOffOnStandby == 1; diff --git a/src/LibCecSharp/LibCecSharp.cpp b/src/LibCecSharp/LibCecSharp.cpp index 1c073d9..9c1c44a 100644 --- a/src/LibCecSharp/LibCecSharp.cpp +++ b/src/LibCecSharp/LibCecSharp.cpp @@ -98,8 +98,20 @@ namespace CecSharp config.iHDMIPort = netConfig->HDMIPort; config.clientVersion = (cec_client_version)netConfig->ClientVersion; config.bGetSettingsFromROM = netConfig->GetSettingsFromROM; - config.bPowerOnStartup = netConfig->PowerOnStartup; - config.bPowerOffShutdown = netConfig->PowerOffShutdown; + config.bActivateSource = netConfig->ActivateSource; + config.tvVendor = (cec_vendor_id)netConfig->TvVendor; + config.wakeDevices.Clear(); + for (int iPtr = 0; iPtr < 16; iPtr++) + { + if (netConfig->WakeDevices->IsSet((CecLogicalAddress)iPtr)) + config.wakeDevices.Set((cec_logical_address)iPtr); + } + config.powerOffDevices.Clear(); + for (int iPtr = 0; iPtr < 16; iPtr++) + { + if (netConfig->PowerOffDevices->IsSet((CecLogicalAddress)iPtr)) + config.powerOffDevices.Set((cec_logical_address)iPtr); + } config.bPowerOffScreensaver = netConfig->PowerOffScreensaver; config.bPowerOffOnStandby = netConfig->PowerOffOnStandby; config.callbacks = &g_cecCallbacks; @@ -137,6 +149,7 @@ namespace CecSharp { // delete the callbacks, since these might already have been destroyed in .NET m_libCec->EnableCallbacks(NULL, NULL); + m_libCec->StandbyDevices(); m_libCec->Close(); } @@ -422,8 +435,21 @@ namespace CecSharp configuration->PhysicalAddress = config.iPhysicalAddress; configuration->PowerOffOnStandby = config.bPowerOffOnStandby == 1; configuration->PowerOffScreensaver = config.bPowerOffScreensaver == 1; - configuration->PowerOffShutdown = config.bPowerOffShutdown == 1; - configuration->PowerOnStartup = config.bPowerOnStartup == 1; + configuration->ActivateSource = config.bActivateSource == 1; + configuration->TvVendor = (CecVendorId)config.tvVendor; + + configuration->WakeDevices->Clear(); + int iDevices(0); + for (uint8_t iPtr = 0; iPtr <= 16; iPtr++) + if (config.wakeDevices[iPtr]) + configuration->WakeDevices->Addresses[iDevices++] = (CecLogicalAddress)iPtr; + + configuration->PowerOffDevices->Clear(); + iDevices = 0; + for (uint8_t iPtr = 0; iPtr <= 16; iPtr++) + if (config.powerOffDevices[iPtr]) + configuration->PowerOffDevices->Addresses[iDevices++] = (CecLogicalAddress)iPtr; + configuration->UseTVMenuLanguage = config.bUseTVMenuLanguage == 1; for (unsigned int iPtr = 0; iPtr < 5; iPtr++) configuration->DeviceTypes->Types[iPtr] = (CecDeviceType)config.deviceTypes.types[iPtr];