public Task <int> SaveItemAsync(GpsPodatek item) { if (item.Timestamp == null) { return(database.UpdateAsync(item)); } else { return(database.InsertAsync(item)); } }
public void OnLocationChanged(Location location) { //_locationManager.RemoveUpdates(this); stars.StartTrack(); if (Sensors.OstaliSenzorji.coarse_switch) { GpsPodatek gp = new GpsPodatek(); gp.NutshellSet(location.Time, location.Latitude, location.Longitude, location.Speed, 0, location.Accuracy, location.Altitude, DateTimeOffset.Now, GpsPodatek.SwitchType.Podatek); stars.Database.SaveItemAsync(gp); CommunicationImplementation.forServiceAccessCM1(); } }
public Task <int> DeleteItemAsync(GpsPodatek item) { return(database.DeleteAsync(item)); }
public override void OnCreate() { mBinder = new LocalBinder(this); base.OnCreate(); Log.Debug(TAG, "OnCreate"); //Toast.MakeText(this, "Pride do Servisa", ToastLength.Long).Show(); /*if (MainActivity.InstanceCount < 1) * { * StartActivity(new Intent(this,typeof(MainActivity))); * }*/ //handler = new Handler(); handlermain = new Handler(Looper.MainLooper); //var test = ((FileHelper)new FileHelper()).GetLocalFilePath("BazaGpsPodatkov.db3"); lowController = new Wifi_coarse(this); lowController.Start(); //StartTrack(); //ta ali pa lowcontroller.start() je lahko naenkrat przgan drugac bo exception unhandled tz = new Sensors.TipZemljevida(); // za hendlanje izpisa na mapspageu tz.attach(tz); tdp = new TriDimPodatek(); gp = new GpsPodatek(); gp.resetAccelerationData(); gp.resetLinearAccelerationData(); //LastPosition = null; try { //LoadSave<string> ls = new LoadSave<string>(); //username = ls.LoadJson("username.json"); Json js = new Json(); username = js.LoadJson("username.json"); }catch (Exception e) { username = Guid.NewGuid().ToString(); } lai = new LinearAccelerationImplementation(); lai.SensorValueChanged += (s, a) => { //TODO - dodej še 12 polj za podatke linearnega senzorja v gpspodatek DB switch (a.SensorType) { case SensorType.Accelerometer: gp.CheckAccelerationData(((MotionVector)a.Value).X, ((MotionVector)a.Value).Y, ((MotionVector)a.Value).Z, DateTimeOffset.Now); tdp.Set(TriDimPodatek.Tip.Accelerometer, ((MotionVector)a.Value).X, ((MotionVector)a.Value).Y, ((MotionVector)a.Value).Z, DateTimeOffset.Now); break; case SensorType.LinearAcceleration: gp.CheckLinearAccelerationData(((MotionVector)a.Value).X, ((MotionVector)a.Value).Y, ((MotionVector)a.Value).Z, DateTimeOffset.Now); tdp.Set(TriDimPodatek.Tip.LinearAcceleration, ((MotionVector)a.Value).X, ((MotionVector)a.Value).Y, ((MotionVector)a.Value).Z, DateTimeOffset.Now); break; default: Console.WriteLine("noben senzor ne ustreza temu"); return; } Database3D.SaveItemAsync(tdp); }; try { sendToServer(); }catch (Exception e) { } }