예제 #1
0
        public PositionPage(Position position)
        {
            InitializeComponent();
            var serviceProvider = Startup.ServiceProvider;

            this.wifiConnector             = serviceProvider.GetService <IWifiConnector>();
            this.bluetoothConnector        = serviceProvider.GetService <IBluetoothConnector>();
            this.magneticFieldSensor       = serviceProvider.GetService <MagneticFieldSensor>();
            this.calibrationsService       = serviceProvider.GetService <ICalibrationService>();
            this.positionSignalDataService = serviceProvider.GetService <IPositionSignalDataService>();
            this.positionEstimationService = serviceProvider.GetService <IPositionEstimationService>();
            this.localeProvider            = serviceProvider.GetService <LocaleProvider>();
            this.configuration             = serviceProvider.GetService <Configuration>();
            this.Position = position;

            PositionSignalDataCollection.RefreshCommand = RefreshData_Command;
            PositionSignalDataCollection.ItemsSource    = PositionSignalData;
            Position.PositionSignalData?
            .OrderBy(data => data.SignalType)
            .ThenByDescending(data => data.Strength)
            .ToList()
            .ForEach(data => PositionSignalData.Add(new PositionSignalDataView(data)));

            BindingContext = this;
            timer          = new Timer(configuration !.DataAquisitionInterval * 1000);
            timer.Elapsed += UpdateMonitoringState;
            timer.Start();
            countLabel.Text = count.ToString();
        }
예제 #2
0
        public PositionEstimationPage(Locale locale)
        {
            InitializeComponent();
            var serviceProvider = Startup.ServiceProvider;

            this.wifiConnector             = serviceProvider.GetService <IWifiConnector>();
            this.bluetoothConnector        = serviceProvider.GetService <IBluetoothConnector>();
            this.magneticFieldSensor       = serviceProvider.GetService <MagneticFieldSensor>();
            this.positionEstimationService = serviceProvider.GetService <IPositionEstimationService>();
            this.positionsService          = serviceProvider.GetService <IPositionService>();
            this.configuration             = serviceProvider.GetService <Configuration>();
            this.Locale = locale;

            PositionSignalDataCollection.ItemsSource = PositionSignalData;

            BindingContext = this;
            timer          = new Timer(configuration.DataAquisitionInterval * 1000);
            timer.Elapsed += UpdateMonitoringState;
            timer.Start();

            var positions = new List <Position>();

            Locale.Zones?.ForEach(zone => positions.AddRange(zone.Positions));
            chart = ChartsFactory.CreatePositionSignalDataScatterChart(AppResources.Current_locale, "", "", positions, "X", "Y", showError: false, markerLabel: "Id", height: 1200 + ((int)Math.Floor(positions.Count / 2.0) * 30));
            chartStack.Children.Add(chart);
        }
예제 #3
0
        private bool connectToNetwork()
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                message.Text = "Connecting to network...";
            });
            IWifiConnector connector = DependencyService.Get <IWifiConnector>();

            return(connector.connect(_ssid, _psk));
        }
예제 #4
0
        async private void configure_Clicked(object sender, EventArgs e)
        {
            CommandsPage commandsPage = new CommandsPage();
            await Navigation.PushModalAsync(commandsPage);

            await commandsPage.modalClosed; // May be unnecessary

            configure.IsEnabled = false;
            message.Text        = "Put robot in Setup Mode and push connect";
            IWifiConnector remover = DependencyService.Get <IWifiConnector>();

            remover.remove(ssid);
        }
예제 #5
0
파일: App.xaml.cs 프로젝트: ellisnet/QRData
 public App(IWifiConnector connector)
 {
     WifiConnector = connector ?? throw new ArgumentNullException(nameof(connector));
     InitializeComponent();
     MainPage = new MainPage();
 }
예제 #6
0
 /// <summary>
 ///
 /// </summary>
 public DiscoCommunicator()
 {
     _debugId       = new Random().Next();
     _wifiConnector = Xamarin.Forms.DependencyService.Get <IWifiConnector>();
 }