AdapterLib.HueLightingServiceHandler.ApplyPulseEffectAsync C# (CSharp) Method

ApplyPulseEffectAsync() private method

Change the state of the lamp at the specified time, between the specified OnOff, Brightness, Hue, Saturation, and ColorTemp values. Pulse for the specified number of times, at the specified duration
private ApplyPulseEffectAsync ( BridgeRT FromState, BridgeRT ToState, uint Period, uint Duration, uint NumPulses, ulong Timestamp ) : void
FromState BridgeRT Current state of the lamp to transition from
ToState BridgeRT New state of the lamp to transition to
Period uint Time period(in ms) to transition over to new state
Duration uint Time period(in ms) to remain in new state
NumPulses uint Number of pulses
Timestamp ulong Timestamp (in ms) of when to start the pulses
return void
        private async void ApplyPulseEffectAsync(BridgeRT.State FromState, BridgeRT.State ToState, uint Period, uint Duration, uint NumPulses, ulong Timestamp)
        {
            uint response;
            await System.Threading.Tasks.Task.Delay((int)Timestamp).ConfigureAwait(false);
            TransitionLampState(0, FromState, 0, out response);
            for (int i = 0; i < NumPulses; i++)
            {
                TransitionLampState(0, ToState, Period, out response);
                await System.Threading.Tasks.Task.Delay((int)(Period + Duration)).ConfigureAwait(false);
                TransitionLampState(0, FromState, Period, out response);
                await System.Threading.Tasks.Task.Delay((int)(Period + Duration)).ConfigureAwait(false);
            }
        }