示例#1
0
        static Program()
        {
            _simulator = new DroneSimulator();
            var transceiver   = new SimTransceiver(_simulator.MessageHandler);
            var stateReceiver = new SimReceiver(_simulator.StateTransmitter);
            var videoReceiver = new SimReceiver(_simulator.VideoTransmitter);

            var repository = new SqliteRepository((null, "tello.sim.sqlite"));

            _flightTest = new FlightTest(
                repository,
                transceiver,
                stateReceiver,
                videoReceiver);
        }
        private MainViewModel CreateMainViewModel(IUIDispatcher dispatcher, IUINotifier notifier)
        {
#if EMULATOR_ON
            _simulator = new DroneSimulator();
            var transceiver   = new SimTransceiver(_simulator.MessageHandler);
            var stateReceiver = new SimReceiver(_simulator.StateTransmitter);
            var videoReceiver = new SimReceiver(_simulator.VideoTransmitter);
#else
            var transceiver   = new UdpTransceiver(IPAddress.Parse("192.168.10.1"), 8889);
            var stateReceiver = new UdpReceiver(8890);
            var videoReceiver = new UdpReceiver(11111);
#endif
            return(new MainViewModel(
                       this.dispatcher,
                       this.notifier,
                       new SqliteRepository((null, "tello.sqlite")),
                       transceiver,
                       stateReceiver,
                       videoReceiver));
        }
示例#3
0
        private static async Task Main(string[] args)
        {
            using (var transceiver = new SimTransceiver(Simulator.MessageHandler))
                using (var stateReceiver = new SimReceiver(Simulator.StateTransmitter))
                    using (var videoReceiver = new SimReceiver(Simulator.VideoTransmitter))
                        using (var repository = new SqliteRepository((null, "tello.sim.sqlite")))
                        {
                            var testType = args.Length == 1 && args[0] == "joy"
                    ? TestType.JoyStick
                    : TestType.WayPoint;

                            switch (testType)
                            {
                            case TestType.JoyStick:
                                FlightTest = new JoyStickFlightTest(
                                    repository,
                                    transceiver,
                                    stateReceiver,
                                    videoReceiver);
                                break;

                            case TestType.WayPoint:
                                FlightTest = new CommandFlightTest(
                                    repository,
                                    transceiver,
                                    stateReceiver,
                                    videoReceiver);
                                break;

                            default:
                                break;
                            }

                            await FlightTest.Invoke();
                        }
        }