Ejemplo n.º 1
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            var transport2 = new SerialPortTransport(
                _messageFactory,
                "/dev/ttyS1",
                isRS485: true,
                tsLogger);

            _messageBus.Subscribe <CardNotificationHandler>(transport2.Name);
            _messageBus.Subscribe <BleNotificationHandler>(transport2.Name);
            _messageBus.Subscribe <FingerNotificationHandler>(transport2.Name);
            _messageBus.Subscribe <PingAcknowledgeHandler>(transport2.Name);
            //_messageBus.TransportAdded += OnTransportAdded;
            _messageBus.AddTransport(transport2);

            //var transport = new TestTransport(_logger);
            //_transportManager.AddTransport(transport);

            //await _masstransitBc.StartAsync();
            //for (int i = 0; i < 10; i++)
            //{
            //    //await _publishEndpoint.Publish<TestEvent>(new
            //    //{
            //    //    Text = "test message"
            //    //});
            //    var endpoint = await _sendEndpoint.GetSendEndpoint(new Uri(String.Concat("queue:", Routes.HubPrefix, Program.HubId,"test_consumer")));
            //    await endpoint.Send<TestEvent>(new
            //    {
            //        Text = "test message"
            //    });
            //}
        }
Ejemplo n.º 2
0
        public APM(SerialPortTransport transport, Device device) : base(device)
        {
            this.SetAdapter(new APMAdapter());

            this._traansport = transport ?? throw new ArgumentNullException(nameof(transport));

            this._traansport.OnMessageReceived += _serialPort_OnMessageReceived;
        }
        public MainViewModel(IMissionPlanner planner, IHeartBeatManager heartBeatManager, ITelemetryService telemetryService, IConnectedUasManager connectedUasManager)
        {
            _telemetryService = telemetryService;
            _heartBeatManager = heartBeatManager;

            Connections = connectedUasManager;

            Connections.ActiveDroneChanged += Connections_ActiveDroneChanged;

            var transport = new SerialPortTransport(DispatcherServices);

            //Connections.Active = new ConnectedUas(new APM(null), transport);
            //Connections.All.Add(Connections.Active);
            //Connections.Active.Transport.OnMessageReceived += _telemeteryLink_MessageParsed;

            //TelemetryLink.MessageParsed += _telemeteryLink_MessageParsed;
            OpenSerialPortCommand     = new RelayCommand(HandleConnectClick, CanPressConnect);
            ShowMissionPlannerCommand = new RelayCommand(() => ViewModelNavigation.NavigateAsync <Missions.MissionPlannerViewModel>(this), CanDoConnectedStuff);
            StartDataStreamsCommand   = new RelayCommand(() => _telemetryService.Start(Connections.Active.Uas, Connections.Active.Transport), CanDoConnectedStuff);
            StopDataStreamsCommand    = new RelayCommand(() => _telemetryService.Stop(Connections.Active.Transport), CanDoConnectedStuff);
            BeginCalibrationCommand   = new RelayCommand(() => ViewModelNavigation.NavigateAsync <Calibration.AccCalibrationViewModel>(this), CanDoConnectedStuff);
            FlyNowCommand             = new RelayCommand(() => ViewModelNavigation.NavigateAsync <HudViewModel>(this), CanDoConnectedStuff);
            MotorTestCommand          = new RelayCommand(() => ViewModelNavigation.NavigateAsync <Testing.MotorsTestViewModel>(this), CanDoConnectedStuff);

            Title = "UAS NuvIoT Connector";

            _planner = planner;

            MenuItems = new List <MenuItem>()
            {
                new MenuItem()
                {
                    Command     = new RelayCommand(() => ViewModelNavigation.NavigateAsync <UasTypeManagerViewModel>(this)),
                    Name        = "Settings",
                    FontIconKey = "fa-users"
                },
                new MenuItem()
                {
                    Command     = new RelayCommand(() => ViewModelNavigation.NavigateAsync <UserOrgsViewModel>(this)),
                    Name        = ClientResources.MainMenu_SwitchOrgs,
                    FontIconKey = "fa-users"
                },
                new MenuItem()
                {
                    Command     = new RelayCommand(() => ViewModelNavigation.NavigateAsync <ChangePasswordViewModel>(this)),
                    Name        = ClientResources.MainMenu_ChangePassword,
                    FontIconKey = "fa-key"
                },
                new MenuItem()
                {
                    Command     = new RelayCommand(() => ViewModelNavigation.NavigateAsync <InviteUserViewModel>(this)),
                    Name        = ClientResources.MainMenu_InviteUser,
                    FontIconKey = "fa-user"
                },
                new MenuItem()
                {
                    Command     = new RelayCommand(() => ViewModelNavigation.NavigateAsync <AboutViewModel>(this)),
                    Name        = "About",
                    FontIconKey = "fa-info"
                },
                new MenuItem()
                {
                    Command     = new RelayCommand(() => Logout()),
                    Name        = ClientResources.Common_Logout,
                    FontIconKey = "fa-sign-out"
                }
            };

            this.RefreshUI();
        }