cec: sleep 5 ms in CUSBCECAdapterCommunication::Process() or other threads won't...
[deb_libcec.git] / src / cec-config-gui / actions / UpdatePhysicalAddress.cs
CommitLineData
a42ad439 1using CecSharp;
006b76b9
LOK
2
3namespace CecConfigGui.actions
4{
5 class UpdatePhysicalAddress : UpdateProcess
6 {
7 public UpdatePhysicalAddress(ref LibCecSharp lib, ushort physicalAddress)
8 {
9 Lib = lib;
10 PhysicalAddress = physicalAddress;
11 }
12
13 public override void Process()
14 {
15 SendEvent(UpdateEventType.BaseDevicePhysicalAddress, 0);
16 SendEvent(UpdateEventType.StatusText, "Setting new configuration...");
17 SendEvent(UpdateEventType.ProgressBar, 25);
18
19 if (!Lib.SetPhysicalAddress(PhysicalAddress))
20 {
21 SendEvent(UpdateEventType.StatusText, "Could not activate the new source");
22 }
23 else
24 {
25 LibCECConfiguration config = new LibCECConfiguration();
26 Lib.GetCurrentConfiguration(config);
27
28 SendEvent(UpdateEventType.StatusText, "Activating source...");
29 SendEvent(UpdateEventType.ProgressBar, 50);
30 Lib.SetActiveSource(config.DeviceTypes.Types[0]);
31
32 SendEvent(UpdateEventType.StatusText, "Reading configuration...");
33 SendEvent(UpdateEventType.ProgressBar, 75);
34 Lib.GetCurrentConfiguration(config);
35
36 SendEvent(config);
37 SendEvent(UpdateEventType.StatusText, "Ready.");
38 }
39 SendEvent(UpdateEventType.ProgressBar, 100);
40 }
41
42 protected LibCecSharp Lib;
43 protected ushort PhysicalAddress;
44 }
45}