3 namespace CecConfigGui.actions
5 class ShowDeviceInfo : UpdateProcess
7 public ShowDeviceInfo(CecConfigGUI gui, ref LibCecSharp lib, CecLogicalAddress address)
14 public virtual void ShowDialog(CecConfigGUI gui, CecLogicalAddress address, ref LibCecSharp lib,
15 bool devicePresent, CecVendorId vendor, bool isActiveSource, ushort physicalAddress,
16 CecVersion version, CecPowerStatus power, string osdName, string menuLanguage)
18 DeviceInformation di = new DeviceInformation(Gui, Address, ref Lib, devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage);
19 Gui.DisplayDialog(di, false);
22 public override void Process()
24 CecVendorId vendor = CecVendorId.Unknown;
25 bool isActiveSource = false;
26 ushort physicalAddress = 0xFFFF;
27 CecVersion version = CecVersion.Unknown;
28 CecPowerStatus power = CecPowerStatus.Unknown;
29 string osdName = "unknown";
30 string menuLanguage = "unknown";
32 SendEvent(UpdateEventType.StatusText, "Checking device presense...");
33 SendEvent(UpdateEventType.ProgressBar, 10);
35 bool devicePresent = Lib.IsActiveDevice(Address);
38 SendEvent(UpdateEventType.StatusText, "Requesting the vendor ID...");
39 SendEvent(UpdateEventType.ProgressBar, 20);
40 vendor = Lib.GetDeviceVendorId(Address);
42 SendEvent(UpdateEventType.StatusText, "Requesting active source state...");
43 SendEvent(UpdateEventType.ProgressBar, 30);
44 isActiveSource = Lib.IsActiveSource(Address);
46 SendEvent(UpdateEventType.StatusText, "Requesting physical address...");
47 SendEvent(UpdateEventType.ProgressBar, 40);
48 physicalAddress = Lib.GetDevicePhysicalAddress(Address);
50 SendEvent(UpdateEventType.StatusText, "Requesting CEC version...");
51 SendEvent(UpdateEventType.ProgressBar, 50);
52 version = Lib.GetDeviceCecVersion(Address);
54 SendEvent(UpdateEventType.StatusText, "Requesting power status...");
55 SendEvent(UpdateEventType.ProgressBar, 60);
56 power = Lib.GetDevicePowerStatus(Address);
58 SendEvent(UpdateEventType.StatusText, "Requesting OSD name...");
59 SendEvent(UpdateEventType.ProgressBar, 70);
60 osdName = Lib.GetDeviceOSDName(Address);
62 SendEvent(UpdateEventType.StatusText, "Requesting menu language...");
63 SendEvent(UpdateEventType.ProgressBar, 80);
64 menuLanguage = Lib.GetDeviceMenuLanguage(Address);
67 SendEvent(UpdateEventType.StatusText, "Showing device information");
68 SendEvent(UpdateEventType.ProgressBar, 90);
69 SendEvent(UpdateEventType.ProcessCompleted, true);
71 ShowDialog(Gui, Address, ref Lib, devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage);
73 SendEvent(UpdateEventType.StatusText, "Ready.");
74 SendEvent(UpdateEventType.ProgressBar, 100);
77 private CecConfigGUI Gui;
78 private LibCecSharp Lib;
79 private CecLogicalAddress Address;