Esempio n. 1
0
        private void LogDataEvent(string eventName = null, string value = null, string advisory = null, string map = null, string spat = null, double latency = -1, int heading = -1, string lane = null, DataConnection dataConnection = DataConnection.None)
        {
            if (_loggingEnabled == false)
            {
                return;
            }

            var eventLog = new GLOSAEventLog()
            {
                Latitude            = _navigationService.Latitude,
                Longitude           = _navigationService.Longitude,
                VehicleId           = Settings.UniqueVehicleDeviceAppId,
                DeviceTime          = DateTime.UtcNow,
                IntersectionId      = _navigationService.WayPointId,
                Distance            = _navigationService.DistanceToWaypoint,
                RouteId             = _navigationService.RouteId,
                RouteSession        = _navigationService.RouteSession,
                TimeOffset          = _sntpService.LocalClockOffset,
                Event               = eventName,
                Value               = value,
                Speed               = Math.Round(_navigationService.CurrentSpeed, 2),
                CalculationAdvisory = advisory,
                SPAT            = spat,
                Latency         = latency,
                AdvisoryEnabled = Settings.GLOSAAdvisoryEnabled,
                MAP             = map,
                Lane            = lane,
                Heading         = heading,
                DataConnection  = (int)dataConnection,
            };

            Logger.LogEvent(_GLOSAAnalyticsService, eventLog);
        }
Esempio n. 2
0
        public async Task SaveEventLogAsync(GLOSAEventLog item)
        {
            try
            {
                // Insert the new item into the local store.
                await _eventLogTable.InsertAsync(item);

#if OFFLINE_SYNC_ENABLED
                // Send changes to the mobile app backend.
                await SyncAsync();
#endif
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message.ToString());
            }
        }
Esempio n. 3
0
 public static void LogEvent(IDataAnalyticsService dataService, GLOSAEventLog eventLog)
 {
     Task.Run(() => dataService.SaveEventLogAsync(eventLog));
 }