From caa97b09d05e298788be1d0d8d50608a70c9757b Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Wed, 13 Mar 2013 00:31:39 +0100 Subject: [PATCH] CecTray: display alerts from libCEC --- .../Properties/Resources.Designer.cs | 63 +++++++++++++++++++ src/LibCecTray/Properties/Resources.resx | 21 +++++++ src/LibCecTray/controller/CECController.cs | 26 ++++++++ 3 files changed, 110 insertions(+) diff --git a/src/LibCecTray/Properties/Resources.Designer.cs b/src/LibCecTray/Properties/Resources.Designer.cs index 1f62e34..525ed2d 100644 --- a/src/LibCecTray/Properties/Resources.Designer.cs +++ b/src/LibCecTray/Properties/Resources.Designer.cs @@ -294,6 +294,60 @@ namespace LibCECTray.Properties { } } + /// + /// Looks up a localized string similar to The connection to the adapter was lost, probably because the device got unplugged.. + /// + internal static string alert_connection_lost { + get { + return ResourceManager.GetString("alert_connection_lost", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No permission from the OS to access the adapter. Please check your permissions.. + /// + internal static string alert_permission_error { + get { + return ResourceManager.GetString("alert_permission_error", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The physical address that is assigned to the adapter is already being used. Please check your settings.. + /// + internal static string alert_physical_address_error { + get { + return ResourceManager.GetString("alert_physical_address_error", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The device is being used by another program.. + /// + internal static string alert_port_busy { + get { + return ResourceManager.GetString("alert_port_busy", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The device needs servicing. Please download and run the latest firmware upgrade from http://packages.pulse-eight.net/. + /// + internal static string alert_service_device { + get { + return ResourceManager.GetString("alert_service_device", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The TV does not respond to polls. This is caused by one of the following: a) the TV does not support CEC, or b) CEC has been disabled in the TV's settings or c) the HDMI cable between the TV and adapter is faulty.. + /// + internal static string alert_tv_poll_failed { + get { + return ResourceManager.GetString("alert_tv_poll_failed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Send 'inactive source' when shutting down the application. /// @@ -402,6 +456,15 @@ namespace LibCECTray.Properties { } } + /// + /// Looks up a localized string similar to Warning from libCEC. + /// + internal static string cec_alert { + get { + return ResourceManager.GetString("cec_alert", resourceCulture); + } + } + /// /// Looks up a localized string similar to cec-log.txt. /// diff --git a/src/LibCecTray/Properties/Resources.resx b/src/LibCecTray/Properties/Resources.resx index 8cf1fae..6da4722 100644 --- a/src/LibCecTray/Properties/Resources.resx +++ b/src/LibCecTray/Properties/Resources.resx @@ -594,4 +594,25 @@ Pause playback when switching to another source + + The connection to the adapter was lost, probably because the device got unplugged. + + + No permission from the OS to access the adapter. Please check your permissions. + + + The physical address that is assigned to the adapter is already being used. Please check your settings. + + + The device is being used by another program. + + + The device needs servicing. Please download and run the latest firmware upgrade from http://packages.pulse-eight.net/ + + + The TV does not respond to polls. This is caused by one of the following: a) the TV does not support CEC, or b) CEC has been disabled in the TV's settings or c) the HDMI cable between the TV and adapter is faulty. + + + Warning from libCEC + \ No newline at end of file diff --git a/src/LibCecTray/controller/CECController.cs b/src/LibCecTray/controller/CECController.cs index 94fac2e..c394c08 100644 --- a/src/LibCecTray/controller/CECController.cs +++ b/src/LibCecTray/controller/CECController.cs @@ -367,6 +367,32 @@ namespace LibCECTray.controller return 1; } + public override int ReceiveAlert(CecAlert alert, CecParameter data) + { + switch (alert) + { + case CecAlert.ServiceDevice: + MessageBox.Show(Resources.alert_service_device, Resources.cec_alert, MessageBoxButtons.OK); + break; + case CecAlert.ConnectionLost: + MessageBox.Show(Resources.alert_connection_lost, Resources.cec_alert, MessageBoxButtons.OK); + break; + case CecAlert.PermissionError: + MessageBox.Show(Resources.alert_permission_error, Resources.cec_alert, MessageBoxButtons.OK); + break; + case CecAlert.PortBusy: + MessageBox.Show(Resources.alert_port_busy, Resources.cec_alert, MessageBoxButtons.OK); + break; + case CecAlert.PhysicalAddressError: + MessageBox.Show(Resources.alert_physical_address_error, Resources.cec_alert, MessageBoxButtons.OK); + break; + case CecAlert.TVPollFailed: + MessageBox.Show(Resources.alert_tv_poll_failed, Resources.cec_alert, MessageBoxButtons.OK); + break; + } + return 1; + } + public override int ConfigurationChanged(LibCECConfiguration config) { Settings.PhysicalAddress.Value = Config.PhysicalAddress; -- 2.34.1