CecTray: display alerts from libCEC
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 12 Mar 2013 23:31:39 +0000 (00:31 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 12 Mar 2013 23:48:09 +0000 (00:48 +0100)
src/LibCecTray/Properties/Resources.Designer.cs
src/LibCecTray/Properties/Resources.resx
src/LibCecTray/controller/CECController.cs

index 1f62e34a18705a61edf4478322c00491d717feb0..525ed2dd6813cdedfd8681940660956e5f58565b 100644 (file)
@@ -294,6 +294,60 @@ namespace LibCECTray.Properties {
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized string similar to The connection to the adapter was lost, probably because the device got unplugged..
+        /// </summary>
+        internal static string alert_connection_lost {
+            get {
+                return ResourceManager.GetString("alert_connection_lost", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to No permission from the OS to access the adapter. Please check your permissions..
+        /// </summary>
+        internal static string alert_permission_error {
+            get {
+                return ResourceManager.GetString("alert_permission_error", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to The physical address that is assigned to the adapter is already being used. Please check your settings..
+        /// </summary>
+        internal static string alert_physical_address_error {
+            get {
+                return ResourceManager.GetString("alert_physical_address_error", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to The device is being used by another program..
+        /// </summary>
+        internal static string alert_port_busy {
+            get {
+                return ResourceManager.GetString("alert_port_busy", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   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/.
+        /// </summary>
+        internal static string alert_service_device {
+            get {
+                return ResourceManager.GetString("alert_service_device", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   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&apos;s settings or c) the HDMI cable between the TV and adapter is faulty..
+        /// </summary>
+        internal static string alert_tv_poll_failed {
+            get {
+                return ResourceManager.GetString("alert_tv_poll_failed", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized string similar to Send &apos;inactive source&apos; when shutting down the application.
         /// </summary>
@@ -402,6 +456,15 @@ namespace LibCECTray.Properties {
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized string similar to Warning from libCEC.
+        /// </summary>
+        internal static string cec_alert {
+            get {
+                return ResourceManager.GetString("cec_alert", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized string similar to cec-log.txt.
         /// </summary>
index 8cf1fae8f719dfc00c9420e8a056edebd90bc006..6da4722f62fcdb42d089e68027a6fabcee12539f 100644 (file)
   <data name="app_pause_playback_on_deactivate" xml:space="preserve">
     <value>Pause playback when switching to another source</value>
   </data>
+  <data name="alert_connection_lost" xml:space="preserve">
+    <value>The connection to the adapter was lost, probably because the device got unplugged.</value>
+  </data>
+  <data name="alert_permission_error" xml:space="preserve">
+    <value>No permission from the OS to access the adapter. Please check your permissions.</value>
+  </data>
+  <data name="alert_physical_address_error" xml:space="preserve">
+    <value>The physical address that is assigned to the adapter is already being used. Please check your settings.</value>
+  </data>
+  <data name="alert_port_busy" xml:space="preserve">
+    <value>The device is being used by another program.</value>
+  </data>
+  <data name="alert_service_device" xml:space="preserve">
+    <value>The device needs servicing. Please download and run the latest firmware upgrade from http://packages.pulse-eight.net/</value>
+  </data>
+  <data name="alert_tv_poll_failed" xml:space="preserve">
+    <value>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.</value>
+  </data>
+  <data name="cec_alert" xml:space="preserve">
+    <value>Warning from libCEC</value>
+  </data>
 </root>
\ No newline at end of file
index 94fac2e4349e0bc4c76ecb83aab13f2ac6f8232e..c394c08f336bd7e1f099fda73d76eb50df7a6263 100644 (file)
@@ -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;