Этот коммит содержится в:
Anton Tananaev
2017-08-31 11:42:15 +12:00
родитель 5428530dbd
Коммит e87c3c7783
5 изменённых файлов: 22 добавлений и 7 удалений
+4 -1
Просмотреть файл
@@ -27,7 +27,7 @@ import java.util.Date;
public class DatabaseHelper extends SQLiteOpenHelper {
public static final int DATABASE_VERSION = 1;
public static final int DATABASE_VERSION = 2;
public static final String DATABASE_NAME = "traccar.db";
public interface DatabaseHandler<T> {
@@ -79,6 +79,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
"altitude REAL," +
"speed REAL," +
"course REAL," +
"accuracy REAL," +
"battery REAL)");
}
@@ -97,6 +98,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
values.put("altitude", position.getAltitude());
values.put("speed", position.getSpeed());
values.put("course", position.getCourse());
values.put("accuracy", position.getCourse());
values.put("battery", position.getBattery());
db.insertOrThrow("position", null, values);
@@ -129,6 +131,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
position.setAltitude(cursor.getDouble(cursor.getColumnIndex("altitude")));
position.setSpeed(cursor.getDouble(cursor.getColumnIndex("speed")));
position.setCourse(cursor.getDouble(cursor.getColumnIndex("course")));
position.setAccuracy(cursor.getDouble(cursor.getColumnIndex("accuracy")));
position.setBattery(cursor.getDouble(cursor.getColumnIndex("battery")));
} else {
+14
Просмотреть файл
@@ -16,6 +16,7 @@
package org.traccar.client;
import android.location.Location;
import android.location.LocationManager;
import java.util.Date;
@@ -32,6 +33,9 @@ public class Position {
altitude = location.getAltitude();
speed = location.getSpeed() * 1.943844; // speed in knots
course = location.getBearing();
if (location.getProvider() != null && !location.getProvider().equals(LocationManager.GPS_PROVIDER)) {
accuracy = location.getAccuracy();
}
this.battery = battery;
}
@@ -115,6 +119,16 @@ public class Position {
this.course = course;
}
private double accuracy;
public double getAccuracy() {
return accuracy;
}
public void setAccuracy(double accuracy) {
this.accuracy = accuracy;
}
private double battery;
public double getBattery() {
+1
Просмотреть файл
@@ -33,6 +33,7 @@ public class ProtocolFormatter {
.appendQueryParameter("speed", String.valueOf(position.getSpeed()))
.appendQueryParameter("bearing", String.valueOf(position.getCourse()))
.appendQueryParameter("altitude", String.valueOf(position.getAltitude()))
.appendQueryParameter("accuracy", String.valueOf(position.getAccuracy()))
.appendQueryParameter("batt", String.valueOf(position.getBattery()));
if (alarm != null) {