InitializeAsync() private method

private InitializeAsync ( ) : Task
return Task
Exemplo n.º 1
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            _deferral = taskInstance.GetDeferral();

            _display = new SparkFunSerial16X2Lcd();
            _xboxController = new XboxController(_display);
            _ntripClient = new NtripClient("172.16.0.237", 8000, "", "", "", _display); //172.16.0.227
            _ioTClient = new IoTClient(_display);
            _gps = new Gps.Gps( _display, _ntripClient);
            _inverseKinematics = new InverseKinematics(_display);
            _ikController = new IkController(_inverseKinematics, _display, _ioTClient, _gps); //Range and yaw/pitch/roll data from Arduino and SparkFun Razor IMU
            _navigator = new Navigator(_ikController, _display, _gps);
            _hexapi = new Hexapi(_ikController, _xboxController, _navigator, _display, _gps, _ioTClient);

            _initializeTasks.Add(_display.InitializeAsync());
            _initializeTasks.Add(_xboxController.InitializeAsync());
            _initializeTasks.Add(_ikController.InitializeAsync());
            _initializeTasks.Add(_ntripClient.InitializeAsync());
            _initializeTasks.Add(_gps.InitializeAsync());
            _initializeTasks.Add(_inverseKinematics.InitializeAsync());
            _initializeTasks.Add(_ioTClient.InitializeAsync());

            _startTasks.Add(_ntripClient.StartAsync());
            _startTasks.Add(_ikController.StartAsync());
            _startTasks.Add(_gps.StartAsync());
            _startTasks.Add(_inverseKinematics.StartAsync());
            //_startTasks.Add(_ioTClient.StartAsync());//only needed if expecting messages from the server

            //foreach (var d in await SerialDeviceHelper.ListAvailablePorts())
            //{
            //    await _ioTClient.SendEvent(d);
            //}

            await Task.WhenAll(_initializeTasks.ToArray());

            await Task.WhenAll(_startTasks.ToArray());
        }
Exemplo n.º 2
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            _deferral = taskInstance.GetDeferral();

            _display           = new SparkFunSerial16X2Lcd();
            _xboxController    = new XboxController(_display);
            _ntripClient       = new NtripClient("172.16.0.237", 8000, "", "", "", _display); //172.16.0.227
            _ioTClient         = new IoTClient(_display);
            _gps               = new Gps.Gps(_display, _ntripClient);
            _inverseKinematics = new InverseKinematics(_display);
            _ikController      = new IkController(_inverseKinematics, _display, _ioTClient, _gps); //Range and yaw/pitch/roll data from Arduino and SparkFun Razor IMU
            _navigator         = new Navigator(_ikController, _display, _gps);
            _hexapi            = new Hexapi(_ikController, _xboxController, _navigator, _display, _gps, _ioTClient);

            _initializeTasks.Add(_display.InitializeAsync());
            _initializeTasks.Add(_xboxController.InitializeAsync());
            _initializeTasks.Add(_ikController.InitializeAsync());
            _initializeTasks.Add(_ntripClient.InitializeAsync());
            _initializeTasks.Add(_gps.InitializeAsync());
            _initializeTasks.Add(_inverseKinematics.InitializeAsync());
            _initializeTasks.Add(_ioTClient.InitializeAsync());

            _startTasks.Add(_ntripClient.StartAsync());
            _startTasks.Add(_ikController.StartAsync());
            _startTasks.Add(_gps.StartAsync());
            _startTasks.Add(_inverseKinematics.StartAsync());
            //_startTasks.Add(_ioTClient.StartAsync());//only needed if expecting messages from the server

            //foreach (var d in await SerialDeviceHelper.ListAvailablePorts())
            //{
            //    await _ioTClient.SendEvent(d);
            //}

            await Task.WhenAll(_initializeTasks.ToArray());

            await Task.WhenAll(_startTasks.ToArray());
        }