Exemplo n.º 1
0
        public async Task OnReading(IGpsReading reading)
        {
            var e = new GpsEvent
            {
                Id          = Guid.NewGuid().ToString(),
                DateCreated = DateTimeOffset.UtcNow,

                Latitude         = reading.Position.Latitude,
                Longitude        = reading.Position.Longitude,
                Heading          = reading.Heading,
                HeadingAccuracy  = reading.HeadingAccuracy,
                Speed            = reading.Speed,
                PositionAccuracy = reading.PositionAccuracy
            };

            await this.repository.Set(e.Id, e);

            this.BatchSize++;

            var job = await this.jobManager.GetJob(Constants.GpsJobIdentifier);

            var config = job.GetSyncConfig();

            if (this.BatchSize >= config.BatchSize)
            {
                this.BatchSize = 0;
                Console.WriteLine("GPS Location Sync batch size reached, will attempt to sync");
                if (this.jobManager.IsRunning)
                {
                    await this.jobManager.RunJobAsTask(Constants.GpsJobIdentifier);
                }
            }
        }
        public Task OnReading(IGpsReading reading)
        {
            if (reading?.Position != null)
            {
                _locationObserver.OnLocationChanged(reading);
            }

            return(Task.CompletedTask);
        }
Exemplo n.º 3
0
        void SetValues(IGpsReading reading)
        {
            using (this.DelayChangeNotifications())
            {
                this.Latitude         = reading.Position.Latitude;
                this.Longitude        = reading.Position.Longitude;
                this.Altitutde        = reading.Altitude;
                this.PositionAccuracy = reading.PositionAccuracy;

                this.Heading         = reading.Heading;
                this.HeadingAccuracy = reading.HeadingAccuracy;
                this.Speed           = reading.Speed;
            }
        }
Exemplo n.º 4
0
 public async void OnReading(IGpsReading reading)
 {
     await this.conn.InsertAsync(new GpsEvent
     {
         Latitude         = reading.Position.Latitude,
         Longitude        = reading.Position.Longitude,
         Altitude         = reading.Altitude,
         PositionAccuracy = reading.PositionAccuracy,
         Heading          = reading.Heading,
         HeadingAccuracy  = reading.HeadingAccuracy,
         Speed            = reading.Speed,
         Date             = reading.Timestamp.ToLocalTime()
     });
 }
Exemplo n.º 5
0
        public async Task OnReading(IGpsReading reading)
        {
            // TODO: need previous state
            var geofences = await this.geofenceManager.GetMonitorRegions();

            foreach (var geofence in geofences)
            {
                var state = geofence.IsPositionInside(reading.Position)
                    ? GeofenceState.Entered
                    : GeofenceState.Exited;

                await this.geofenceDelegate.OnStatusChanged(state, geofence);
            }
        }
Exemplo n.º 6
0
        public async Task OnReading(IGpsReading reading)
        {
            var geofences = await this.geofenceManager.GetMonitorRegions();

            foreach (var geofence in geofences)
            {
                var state = geofence.IsPositionInside(reading.Position)
                    ? GeofenceState.Entered
                    : GeofenceState.Exited;

                var current = this.GetState(geofence.Identifier);
                if (state != current)
                {
                    this.SetState(geofence.Identifier, state);
                    await this.geofenceDelegate.OnStatusChanged(state, geofence);
                }
            }
        }
 public async Task OnReading(IGpsReading reading)
 {
 }
Exemplo n.º 8
0
 public Task OnReading(IGpsReading reading)
 {
     return(Task.CompletedTask);
 }
Exemplo n.º 9
0
 public Task OnReading(IGpsReading reading)
 {
     (_gpsListener as GpsListener)?.UpdateReading(reading);
     return(Task.CompletedTask);
 }
Exemplo n.º 10
0
 void UpdateReading(IGpsReading reading)
 {
     OnReadingReceived?.Invoke(this, new GpsReadingEventArgs(reading));
 }
 public Task OnReading(IGpsReading reading)
 {
     throw new NotImplementedException();
 }
 public GpsReadingEventArgs(IGpsReading reading)
 {
     Reading = reading;
 }
Exemplo n.º 13
0
 public Task OnReading(IGpsReading reading)
 {
     //Aqui voce Pode Implementar um Delagate para o GPS
     return(null);
 }
Exemplo n.º 14
0
        public Task OnReading(IGpsReading reading)
        {
            MessagingCenter.Send <GpsDelegate, IGpsReading>(this, Constants.Message.LOCATION_UPDATED, reading);

            return(Task.CompletedTask);
        }
Exemplo n.º 15
0
 public async Task OnReading(IGpsReading reading)
 {
     // if you like your users - don't do notifications here ;)
     // store to a db
 }
 public void OnLocationChanged(IGpsReading reading)
 {
     Parallel.ForEach(_observers, (o) => o.OnNext($"Latitude: {reading.Position.Latitude} | Longitude: {reading.Position.Longitude}"));
 }
Exemplo n.º 17
0
 public async Task OnReading(IGpsReading reading)
 {
     eventAggregator.GetEvent <GpsDataReceivedEvent>().Publish(reading);
 }