X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FLibCecTray%2Fcontroller%2Fapplications%2Finternal%2FXBMCController.cs;h=c2697885973735bc992989e25cc40cea5a8c09f5;hb=95587b956c69ead0b46d301f5ca70e977890c3fd;hp=fe15fd25edc18d3b62c2442ab9d3ce17b2433d4d;hpb=f4729954da8ed049a6bc5ea6bbd72e30f158ddc9;p=deb_libcec.git diff --git a/src/LibCecTray/controller/applications/internal/XBMCController.cs b/src/LibCecTray/controller/applications/internal/XBMCController.cs index fe15fd2..c269788 100644 --- a/src/LibCecTray/controller/applications/internal/XBMCController.cs +++ b/src/LibCecTray/controller/applications/internal/XBMCController.cs @@ -123,9 +123,9 @@ namespace LibCECTray.controller.applications.@internal break; case "connected_device": { - ushort iDevice; - if (ushort.TryParse(value, out iDevice)) - Settings.ConnectedDevice.Value = (CecLogicalAddress)iDevice; + int iDevice; + if (int.TryParse(value, out iDevice)) + Settings.ConnectedDevice.Value = iDevice == 36038 ? CecLogicalAddress.AudioSystem : CecLogicalAddress.Tv; } break; case "cec_power_on_startup": @@ -170,7 +170,29 @@ namespace LibCECTray.controller.applications.@internal Settings.TVVendor.Value = (CecVendorId)iVendor; } break; - case "wake_devices": + case "wake_device": + { + int iWakeDevices; + if (int.TryParse(value, out iWakeDevices)) + { + Settings.WakeDevices.Value.Clear(); + switch (iWakeDevices) + { + case 36037: + Settings.WakeDevices.Value.Set(CecLogicalAddress.Tv); + break; + case 36038: + Settings.WakeDevices.Value.Set(CecLogicalAddress.AudioSystem); + break; + case 36039: + Settings.WakeDevices.Value.Set(CecLogicalAddress.Tv); + Settings.WakeDevices.Value.Set(CecLogicalAddress.AudioSystem); + break; + } + } + } + break; + case "wake_devices_advanced": { Settings.WakeDevices.Value.Clear(); string[] split = value.Split(new[] { ' ' }); @@ -183,6 +205,28 @@ namespace LibCECTray.controller.applications.@internal } break; case "standby_devices": + { + int iStandbyDevices; + if (int.TryParse(value, out iStandbyDevices)) + { + Settings.PowerOffDevices.Value.Clear(); + switch (iStandbyDevices) + { + case 36037: + Settings.PowerOffDevices.Value.Set(CecLogicalAddress.Tv); + break; + case 36038: + Settings.PowerOffDevices.Value.Set(CecLogicalAddress.AudioSystem); + break; + case 36039: + Settings.PowerOffDevices.Value.Set(CecLogicalAddress.Tv); + Settings.PowerOffDevices.Value.Set(CecLogicalAddress.AudioSystem); + break; + } + } + } + break; + case "standby_devices_advanced": { Settings.PowerOffDevices.Value.Clear(); string[] split = value.Split(new[] { ' ' }); @@ -203,6 +247,10 @@ namespace LibCECTray.controller.applications.@internal case "send_inactive_source": SendInactiveSource.Value = value.Equals("1") || value.ToLower().Equals("true") || value.ToLower().Equals("yes"); break; + // 1.9.0+ settings + case "pause_playback_on_deactivate": + PausePlaybackOnDeactivate.Value = value.Equals("1") || value.ToLower().Equals("true") || value.ToLower().Equals("yes"); + break; } } break; @@ -212,6 +260,14 @@ namespace LibCECTray.controller.applications.@internal return gotConfig; } + static bool HasAdvancedDeviceIdSet(CecLogicalAddresses addresses) + { + foreach (var val in addresses.Addresses) + if (val != CecLogicalAddress.Tv && val != CecLogicalAddress.AudioSystem) + return true; + return false; + } + public void SaveXMLConfiguration() { Settings.Persist(); @@ -258,7 +314,7 @@ namespace LibCECTray.controller.applications.@internal StringBuilder output = new StringBuilder(); output.AppendLine(""); output.AppendLine(""); - output.AppendLine(""); + output.AppendLine(""); output.AppendLine(""); output.AppendLine(""); output.AppendLine(""); @@ -274,26 +330,55 @@ namespace LibCECTray.controller.applications.@internal output.AppendLine(""); output.AppendLine(""); - output.Append(""); + if (HasAdvancedDeviceIdSet(Settings.WakeDevices.Value)) + { + output.Append(""); + } + + if (Settings.WakeDevices.Value.IsSet(CecLogicalAddress.Tv) && + Settings.WakeDevices.Value.IsSet(CecLogicalAddress.AudioSystem)) + output.Append(""); + else if (Settings.WakeDevices.Value.IsSet(CecLogicalAddress.Tv)) + output.Append(""); + else if (Settings.WakeDevices.Value.IsSet(CecLogicalAddress.AudioSystem)) + output.Append(""); + else + output.Append(""); + + if (HasAdvancedDeviceIdSet(Settings.PowerOffDevices.Value)) + { + output.Append(""); + } - output.Append(""); + if (Settings.PowerOffDevices.Value.IsSet(CecLogicalAddress.Tv) && + Settings.PowerOffDevices.Value.IsSet(CecLogicalAddress.AudioSystem)) + output.Append(""); + else if (Settings.PowerOffDevices.Value.IsSet(CecLogicalAddress.Tv)) + output.Append(""); + else if (Settings.PowerOffDevices.Value.IsSet(CecLogicalAddress.AudioSystem)) + output.Append(""); + else + output.Append(""); // only supported by 1.5.1+ clients output.AppendLine(""); output.AppendLine(""); + // only supported by 1.9.0+ clients + output.AppendLine(""); + output.AppendLine(""); writer.Write(output.ToString()); writer.Close(); @@ -372,5 +457,19 @@ namespace LibCECTray.controller.applications.@internal return Settings[ProcessName + "_send_inactive_source"].AsSettingBool; } } + + public CECSettingBool PausePlaybackOnDeactivate + { + get + { + if (!Settings.ContainsKey(ProcessName + "_pause_playback_on_deactivate")) + { + CECSettingBool setting = new CECSettingBool(ProcessName + "_pause_playback_on_deactivate", Resources.app_pause_playback_on_deactivate, true, null); + Settings.Load(setting); + Settings[ProcessName + "_pause_playback_on_deactivate"] = setting; + } + return Settings[ProcessName + "_pause_playback_on_deactivate"].AsSettingBool; + } + } } }