added changelog and bumped version numbers for 1.6.3
[deb_libcec.git] / src / LibCecSharp / LibCecSharp.cpp
index 76dd00624e7948d3fcbf9eedfcf7d73f156f1b86..97329b3e9cd773e8dd531528c3c815dc24588261 100644 (file)
@@ -91,7 +91,8 @@ namespace CecSharp
                {
                        config.Clear();
 
-                       _snprintf_s(config.strDeviceName, 13, context->marshal_as<const char*>(netConfig->DeviceName));
+                       const char *strDeviceName = context->marshal_as<const char*>(netConfig->DeviceName);
+                       memcpy_s(config.strDeviceName, 13, strDeviceName, 13);
                        for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
                                config.deviceTypes.types[iPtr] = (cec_device_type)netConfig->DeviceTypes->Types[iPtr];
 
@@ -117,7 +118,27 @@ namespace CecSharp
                        }
                        config.bPowerOffScreensaver = netConfig->PowerOffScreensaver ? 1 : 0;
                        config.bPowerOffOnStandby   = netConfig->PowerOffOnStandby ? 1 : 0;
-      config.bSendInactiveSource  = netConfig->SendInactiveSource ? 1 : 0;
+
+                       if (netConfig->ServerVersion >= CecServerVersion::Version1_5_1)
+                               config.bSendInactiveSource  = netConfig->SendInactiveSource ? 1 : 0;
+
+                       if (netConfig->ServerVersion >= CecServerVersion::Version1_6_0)
+                       {
+                               config.bPowerOffDevicesOnStandby  = netConfig->PowerOffDevicesOnStandby ? 1 : 0;
+                               config.bShutdownOnStandby         = netConfig->ShutdownOnStandby ? 1 : 0;
+                       }
+
+                       if (netConfig->ServerVersion >= CecServerVersion::Version1_6_2)
+                       {
+                               const char *strDeviceLanguage = context->marshal_as<const char*>(netConfig->DeviceLanguage);
+                               memcpy_s(config.strDeviceLanguage, 3, strDeviceLanguage, 3);
+                       }
+
+                       if (netConfig->ServerVersion >= CecServerVersion::Version1_6_3)
+                       {
+                         config.bMonitorOnly              = netConfig->MonitorOnlyClient ? 1 : 0;
+                       }
+
                        config.callbacks            = &g_cecCallbacks;
                }
 
@@ -481,6 +502,31 @@ namespace CecSharp
                        return bReturn;
                }
 
+    bool IsLibCECActiveSource()
+    {
+      return m_libCec->IsLibCECActiveSource();
+    }
+
+    bool GetDeviceInformation(String ^ port, LibCECConfiguration ^configuration, uint32_t timeoutMs)
+    {
+      bool bReturn(false);
+      marshal_context ^ context = gcnew marshal_context();
+
+      libcec_configuration config;
+                       config.Clear();
+
+      const char* strPortC = port->Length > 0 ? context->marshal_as<const char*>(port) : NULL;
+
+      if (m_libCec->GetDeviceInformation(strPortC, &config, timeoutMs))
+                       {
+                               configuration->Update(config);
+        bReturn = true;
+                       }
+
+      delete context;
+      return bReturn;
+    }
+
                String ^ ToString(CecLogicalAddress iAddress)
                {
                        const char *retVal = m_libCec->ToString((cec_logical_address)iAddress);