cec-config-gui: added the new parameters. cleanup round.
[deb_libcec.git] / src / cec-config-gui / actions / ShowDeviceInfo.cs
CommitLineData
96fa7764
LOK
1using System;
2using System.Collections.Generic;
3using System.Text;
4using CecSharp;
5
6namespace CecConfigGui.actions
7{
8 class ShowDeviceInfo : UpdateProcess
9 {
ece1582e 10 public ShowDeviceInfo(CecConfigGUI gui, ref LibCecSharp lib, CecLogicalAddress address)
96fa7764 11 {
ece1582e 12 Gui = gui;
96fa7764
LOK
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);
ece1582e 64 SendEvent(UpdateEventType.ProcessCompleted, true);
96fa7764 65
ece1582e 66 DeviceInformation di = new DeviceInformation(Gui, Address, ref Lib, devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage);
96fa7764
LOK
67 di.ShowDialog();
68
69 SendEvent(UpdateEventType.StatusText, "Ready.");
70 SendEvent(UpdateEventType.ProgressBar, 100);
71 }
72
ece1582e 73 private CecConfigGUI Gui;
96fa7764
LOK
74 private LibCecSharp Lib;
75 private CecLogicalAddress Address;
76 }
77}