suppress sending some commands when the tv is not present/responding to polls
authorLars Op den Kamp <lars@opdenkamp.eu>
Fri, 13 Dec 2013 10:26:20 +0000 (11:26 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Fri, 13 Dec 2013 10:26:20 +0000 (11:26 +0100)
src/LibCecTray/controller/actions/ConnectToDevice.cs

index fa785916b1c610abd29c5916ff7418fce2f2b93f..e35906a792eaff8645e99eed54c4e4b7cc39642f 100644 (file)
@@ -74,9 +74,12 @@ namespace LibCECTray.controller.actions
       SendEvent(UpdateEventType.StatusText, Resources.action_sending_power_on);
       _lib.PowerOnDevices(CecLogicalAddress.Broadcast);
 
-      SendEvent(UpdateEventType.StatusText, Resources.action_detecting_tv_vendor);
-      SendEvent(UpdateEventType.ProgressBar, 30);
-      SendEvent(UpdateEventType.TVVendorId, (int)_lib.GetDeviceVendorId(CecLogicalAddress.Tv));
+      if (_lib.IsActiveDevice(CecLogicalAddress.Tv))
+      {
+        SendEvent(UpdateEventType.StatusText, Resources.action_detecting_tv_vendor);
+        SendEvent(UpdateEventType.ProgressBar, 30);
+        SendEvent(UpdateEventType.TVVendorId, (int)_lib.GetDeviceVendorId(CecLogicalAddress.Tv));
+      }
 
       SendEvent(UpdateEventType.ProgressBar, 50);
       SendEvent(UpdateEventType.StatusText, Resources.action_detecting_avr);
@@ -91,7 +94,7 @@ namespace LibCECTray.controller.actions
         SendEvent(UpdateEventType.AVRVendorId, (int)_lib.GetDeviceVendorId(CecLogicalAddress.AudioSystem));
       }
 
-      if (!_lib.GetDevicePowerStatus(CecLogicalAddress.Tv).Equals(CecPowerStatus.On))
+      if (_lib.IsActiveDevice(CecLogicalAddress.Tv)&& !_lib.GetDevicePowerStatus(CecLogicalAddress.Tv).Equals(CecPowerStatus.On))
       {
         SendEvent(UpdateEventType.ProgressBar, 70);
         SendEvent(UpdateEventType.StatusText, Resources.action_activating_source);