HamBook – Diff between revs 3 and 7
?pathlinks?
Rev 3 | Rev 7 | |||
---|---|---|---|---|
Line 19... | Line 19... | |||
19 | |
19 | |
|
20 | public PS(SerialPort serialPort) : base(serialPort) |
20 | public PS(SerialPort serialPort) : base(serialPort) |
|
21 | { |
21 | { |
|
Line 22... | Line 22... | |||
22 | } |
22 | } |
|
23 | |
23 | |
|
24 | public override async Task Set(PowerState state) |
24 | public override async Task<bool> Set(PowerState state) |
|
25 | { |
25 | { |
|
26 | var taskCompletionSource = new TaskCompletionSource<bool>(); |
26 | var taskCompletionSource = new TaskCompletionSource<bool>(); |
|
27 | #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed |
27 | #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed |
|
Line 44... | Line 44... | |||
44 | }); |
44 | }); |
|
45 | #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed |
45 | #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed |
|
Line 46... | Line 46... | |||
46 | |
46 | |
|
47 | SerialPort.Write($"POWER"); |
47 | SerialPort.Write($"POWER"); |
|
- | 48 | await taskCompletionSource.Task; |
||
48 | await taskCompletionSource.Task; |
49 | return await Read() == state; |
|
Line 49... | Line 50... | |||
49 | } |
50 | } |
|
50 | |
51 | |
|
51 | public override async Task<PowerState> Read() |
52 | public override async Task<PowerState> Read() |