public void OnSensorChanged(SensorEvent e) { lock (_syncLock) { var model = VMManager.ToAccelerometerDataViewModel(e); if (CurrentSensorData != null) { if (currentInterval != DateTime.UtcNow.Second) { currentInterval = DateTime.UtcNow.Second; if (packetData.Count > 0) { packetData = new List <AccelerometerDataViewModel>(); } } else { packetData.Add(model); } } else { currentInterval = DateTime.UtcNow.Second; packetData.Add(model); } CurrentSensorData = model; AccelerometerDataChanged?.Invoke(); } }
void SaveSensorDataToDB() { AccelerometerDataChanged?.Invoke(); }