cec-config-gui: no longer showing modal device info windows
[deb_libcec.git] / src / cec-config-gui / actions / ShowDeviceInfo.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using CecSharp;
5
6 namespace CecConfigGui.actions
7 {
8 class ShowDeviceInfo : UpdateProcess
9 {
10 public ShowDeviceInfo(CecConfigGUI gui, ref LibCecSharp lib, CecLogicalAddress address)
11 {
12 Gui = gui;
13 Lib = lib;
14 Address = address;
15 }
16
17 public override void Process()
18 {
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";
26
27 SendEvent(UpdateEventType.StatusText, "Checking device presense...");
28 SendEvent(UpdateEventType.ProgressBar, 10);
29
30 bool devicePresent = Lib.IsActiveDevice(Address);
31 if (devicePresent)
32 {
33 SendEvent(UpdateEventType.StatusText, "Requesting the vendor ID...");
34 SendEvent(UpdateEventType.ProgressBar, 20);
35 vendor = Lib.GetDeviceVendorId(Address);
36
37 SendEvent(UpdateEventType.StatusText, "Requesting active source state...");
38 SendEvent(UpdateEventType.ProgressBar, 30);
39 isActiveSource = Lib.IsActiveSource(Address);
40
41 SendEvent(UpdateEventType.StatusText, "Requesting physical address...");
42 SendEvent(UpdateEventType.ProgressBar, 40);
43 physicalAddress = Lib.GetDevicePhysicalAddress(Address);
44
45 SendEvent(UpdateEventType.StatusText, "Requesting CEC version...");
46 SendEvent(UpdateEventType.ProgressBar, 50);
47 version = Lib.GetDeviceCecVersion(Address);
48
49 SendEvent(UpdateEventType.StatusText, "Requesting power status...");
50 SendEvent(UpdateEventType.ProgressBar, 60);
51 power = Lib.GetDevicePowerStatus(Address);
52
53 SendEvent(UpdateEventType.StatusText, "Requesting OSD name...");
54 SendEvent(UpdateEventType.ProgressBar, 70);
55 osdName = Lib.GetDeviceOSDName(Address);
56
57 SendEvent(UpdateEventType.StatusText, "Requesting menu language...");
58 SendEvent(UpdateEventType.ProgressBar, 80);
59 menuLanguage = Lib.GetDeviceMenuLanguage(Address);
60 }
61
62 SendEvent(UpdateEventType.StatusText, "Showing device information");
63 SendEvent(UpdateEventType.ProgressBar, 90);
64 SendEvent(UpdateEventType.ProcessCompleted, true);
65
66 DeviceInformation di = new DeviceInformation(Gui, Address, ref Lib, devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage);
67 Gui.DisplayDialog(di, false);
68
69 SendEvent(UpdateEventType.StatusText, "Ready.");
70 SendEvent(UpdateEventType.ProgressBar, 100);
71 }
72
73 private CecConfigGUI Gui;
74 private LibCecSharp Lib;
75 private CecLogicalAddress Address;
76 }
77 }