Example #1
0
        public static async Task StopAll()
        {
            var stopTask = Task.Run(async() =>
            {
                ShutdownMotorsServos();

                _httpServerController.Stop();
                await _camera.Stop();
                await _gamepadController.Stop();
                await _speechRecognation.Stop();
                await _automaticDrive.Stop();
                _servoController.Stop();
                _motorController.Stop();
                await _automaticSpeakController.Stop();
                await _accelerometerSensor.Stop();
                AudioPlayerController.Stop();
                SpeedSensor.Stop();

                ShutdownMotorsServos();
            });

            var timeout = TimeSpan.FromSeconds(5);
            await TaskHelper.WithTimeoutAfterStart(ct => stopTask.WithCancellation(ct), timeout);
        }