+ return m_libCec != NULL;
+ }
+
+ void ConvertConfiguration(marshal_context ^context, LibCECConfiguration ^netConfig, CEC::libcec_configuration &config)
+ {
+ config.Clear();
+
+ 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];
+
+ config.bAutodetectAddress = netConfig->AutodetectAddress ? 1 : 0;
+ config.iPhysicalAddress = netConfig->PhysicalAddress;
+ config.baseDevice = (cec_logical_address)netConfig->BaseDevice;
+ config.iHDMIPort = netConfig->HDMIPort;
+ config.clientVersion = (cec_client_version)netConfig->ClientVersion;
+ config.bGetSettingsFromROM = netConfig->GetSettingsFromROM ? 1 : 0;
+ config.bActivateSource = netConfig->ActivateSource ? 1 : 0;
+ 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 ? 1 : 0;
+ config.bPowerOffOnStandby = netConfig->PowerOffOnStandby ? 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;