Beispiel #1
0
        private void ErrorCommand()
        {
            Device.RxUart -= DataRecieved;
            TimeoutTimer.Stop();
            TimeoutTimer.Dispose();

            TCS.SetException(new CommandFailedException(Data.ToArray()));
        }
        public async Task Execute()
        {
            Device.RxUart += DataRecieved;

            try
            {
                await SendStartCommand();
            }
            catch (Exception e)
            {
                TCS.SetException(new CommandFailedException(e));
            }

            await TCS.Task;
        }
Beispiel #3
0
        private void CompleteCommand()
        {
            Device.RxUart -= DataRecieved;
            TimeoutTimer.Stop();
            TimeoutTimer.Dispose();

            try
            {
                var result = ProcessResult();
                TCS.SetResult(result);
            }
            catch (Exception e)
            {
                TCS.SetException(new CommandFailedException(Data.ToArray(), e));
            }
        }