From: Lars Op den Kamp Date: Fri, 10 Feb 2012 11:33:56 +0000 (+0100) Subject: cec: added the new config persistence methods to LibCecSharp X-Git-Tag: upstream/2.2.0~1^2~35^2~115 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5085a852b60509eeabe93548385f553697d5ac12;p=deb_libcec.git cec: added the new config persistence methods to LibCecSharp --- diff --git a/src/LibCecSharp/LibCecSharp.cpp b/src/LibCecSharp/LibCecSharp.cpp index 61465e7..0f9acb1 100644 --- a/src/LibCecSharp/LibCecSharp.cpp +++ b/src/LibCecSharp/LibCecSharp.cpp @@ -388,6 +388,44 @@ namespace CecSharp return m_libCec->GetDevicePhysicalAddress((cec_logical_address)iAddress); } + bool GetCurrentConfiguration(LibCECConfiguration ^configuration) + { + libcec_configuration config; + if (m_libCec->GetCurrentConfiguration(&config)) + { + configuration->BaseDevice = (CecLogicalAddress)config.baseDevice; + configuration->DeviceName = gcnew String(config.strDeviceName); + configuration->HDMIPort = config.iHDMIPort; + 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->UseTVMenuLanguage = config.bUseTVMenuLanguage == 1; + for (unsigned int iPtr = 0; iPtr < 5; iPtr++) + m_configuration->DeviceTypes->Types[iPtr] = (CecDeviceType)config.deviceTypes.types[iPtr]; + return true; + } + return false; + } + + bool CanPersistConfiguration(void) + { + return m_libCec->CanPersistConfiguration(); + } + + bool PersistConfiguration(LibCECConfiguration ^configuration) + { + marshal_context ^ context = gcnew marshal_context(); + libcec_configuration config; + GetConfiguration(context, config); + + bool bReturn = m_libCec->PersistConfiguration(&config); + + delete context; + return bReturn; + } + String ^ ToString(CecLogicalAddress iAddress) { const char *retVal = m_libCec->ToString((cec_logical_address)iAddress);