2 using System.Collections.Generic;
6 namespace CecConfigGui.actions
8 class ShowDeviceInfo : UpdateProcess
10 public ShowDeviceInfo(CecConfigGUI gui, ref LibCecSharp lib, CecLogicalAddress address)
17 public override void Process()
19 CecVendorId vendor = CecVendorId.Unknown;
20 bool isActiveSource = false;
21 ushort physicalAddress = 0xFFFF;
22 CecVersion version = CecVersion.Unknown;
23 CecPowerStatus power = CecPowerStatus.Unknown;
24 string osdName = "unknown";
25 string menuLanguage = "unknown";
27 SendEvent(UpdateEventType.StatusText, "Checking device presense...");
28 SendEvent(UpdateEventType.ProgressBar, 10);
30 bool devicePresent = Lib.IsActiveDevice(Address);
33 SendEvent(UpdateEventType.StatusText, "Requesting the vendor ID...");
34 SendEvent(UpdateEventType.ProgressBar, 20);
35 vendor = Lib.GetDeviceVendorId(Address);
37 SendEvent(UpdateEventType.StatusText, "Requesting active source state...");
38 SendEvent(UpdateEventType.ProgressBar, 30);
39 isActiveSource = Lib.IsActiveSource(Address);
41 SendEvent(UpdateEventType.StatusText, "Requesting physical address...");
42 SendEvent(UpdateEventType.ProgressBar, 40);
43 physicalAddress = Lib.GetDevicePhysicalAddress(Address);
45 SendEvent(UpdateEventType.StatusText, "Requesting CEC version...");
46 SendEvent(UpdateEventType.ProgressBar, 50);
47 version = Lib.GetDeviceCecVersion(Address);
49 SendEvent(UpdateEventType.StatusText, "Requesting power status...");
50 SendEvent(UpdateEventType.ProgressBar, 60);
51 power = Lib.GetDevicePowerStatus(Address);
53 SendEvent(UpdateEventType.StatusText, "Requesting OSD name...");
54 SendEvent(UpdateEventType.ProgressBar, 70);
55 osdName = Lib.GetDeviceOSDName(Address);
57 SendEvent(UpdateEventType.StatusText, "Requesting menu language...");
58 SendEvent(UpdateEventType.ProgressBar, 80);
59 menuLanguage = Lib.GetDeviceMenuLanguage(Address);
62 SendEvent(UpdateEventType.StatusText, "Showing device information");
63 SendEvent(UpdateEventType.ProgressBar, 90);
64 SendEvent(UpdateEventType.ProcessCompleted, true);
66 DeviceInformation di = new DeviceInformation(Gui, Address, ref Lib, devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage);
69 SendEvent(UpdateEventType.StatusText, "Ready.");
70 SendEvent(UpdateEventType.ProgressBar, 100);
73 private CecConfigGUI Gui;
74 private LibCecSharp Lib;
75 private CecLogicalAddress Address;