2 using System.Collections.Generic;
6 namespace CecConfigGui.actions
8 class ShowDeviceInfo : UpdateProcess
10 public ShowDeviceInfo(ref LibCecSharp lib, CecLogicalAddress address)
16 public override void Process()
18 CecVendorId vendor = CecVendorId.Unknown;
19 bool isActiveSource = false;
20 ushort physicalAddress = 0xFFFF;
21 CecVersion version = CecVersion.Unknown;
22 CecPowerStatus power = CecPowerStatus.Unknown;
23 string osdName = "unknown";
24 string menuLanguage = "unknown";
26 SendEvent(UpdateEventType.StatusText, "Checking device presense...");
27 SendEvent(UpdateEventType.ProgressBar, 10);
29 bool devicePresent = Lib.IsActiveDevice(Address);
32 SendEvent(UpdateEventType.StatusText, "Requesting the vendor ID...");
33 SendEvent(UpdateEventType.ProgressBar, 20);
34 vendor = Lib.GetDeviceVendorId(Address);
36 SendEvent(UpdateEventType.StatusText, "Requesting active source state...");
37 SendEvent(UpdateEventType.ProgressBar, 30);
38 isActiveSource = Lib.IsActiveSource(Address);
40 SendEvent(UpdateEventType.StatusText, "Requesting physical address...");
41 SendEvent(UpdateEventType.ProgressBar, 40);
42 physicalAddress = Lib.GetDevicePhysicalAddress(Address);
44 SendEvent(UpdateEventType.StatusText, "Requesting CEC version...");
45 SendEvent(UpdateEventType.ProgressBar, 50);
46 version = Lib.GetDeviceCecVersion(Address);
48 SendEvent(UpdateEventType.StatusText, "Requesting power status...");
49 SendEvent(UpdateEventType.ProgressBar, 60);
50 power = Lib.GetDevicePowerStatus(Address);
52 SendEvent(UpdateEventType.StatusText, "Requesting OSD name...");
53 SendEvent(UpdateEventType.ProgressBar, 70);
54 osdName = Lib.GetDeviceOSDName(Address);
56 SendEvent(UpdateEventType.StatusText, "Requesting menu language...");
57 SendEvent(UpdateEventType.ProgressBar, 80);
58 menuLanguage = Lib.GetDeviceMenuLanguage(Address);
61 SendEvent(UpdateEventType.StatusText, "Showing device information");
62 SendEvent(UpdateEventType.ProgressBar, 90);
64 DeviceInformation di = new DeviceInformation(Address, ref Lib, devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage);
67 SendEvent(UpdateEventType.StatusText, "Ready.");
68 SendEvent(UpdateEventType.ProgressBar, 100);
71 private LibCecSharp Lib;
72 private CecLogicalAddress Address;