3 namespace CecConfigGui.actions
5 class UpdateConnectedDevice : UpdateProcess
7 public UpdateConnectedDevice(ref LibCecSharp lib, CecLogicalAddress address, int portNumber)
11 PortNumber = portNumber;
14 public override void Process()
16 SendEvent(UpdateEventType.StatusText, "Requesting physical address...");
17 SendEvent(UpdateEventType.ProgressBar, 0);
19 ushort iPhysicalAddress = Lib.GetDevicePhysicalAddress(Address);
20 SendEvent(UpdateEventType.BaseDevicePhysicalAddress, iPhysicalAddress);
22 SendEvent(UpdateEventType.StatusText, "Setting new configuration...");
23 SendEvent(UpdateEventType.ProgressBar, 25);
25 if (!Lib.SetHDMIPort(Address, (byte)PortNumber))
27 SendEvent(UpdateEventType.StatusText, "Could not activate the new source");
31 LibCECConfiguration config = new LibCECConfiguration();
32 Lib.GetCurrentConfiguration(config);
34 SendEvent(UpdateEventType.StatusText, "Activating source...");
35 SendEvent(UpdateEventType.ProgressBar, 50);
36 Lib.SetActiveSource(config.DeviceTypes.Types[0]);
38 SendEvent(UpdateEventType.StatusText, "Reading configuration...");
39 SendEvent(UpdateEventType.ProgressBar, 75);
40 Lib.GetCurrentConfiguration(config);
43 SendEvent(UpdateEventType.StatusText, "Ready.");
45 SendEvent(UpdateEventType.ProgressBar, 100);
48 private LibCecSharp Lib;
49 private CecLogicalAddress Address;
50 private int PortNumber;