aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/model')
-rw-r--r--src/org/traccar/model/Data.java63
-rw-r--r--src/org/traccar/model/Device.java34
-rw-r--r--src/org/traccar/model/Message.java57
-rw-r--r--src/org/traccar/model/Position.java162
4 files changed, 68 insertions, 248 deletions
diff --git a/src/org/traccar/model/Data.java b/src/org/traccar/model/Data.java
index 82a9630d5..ce23154c2 100644
--- a/src/org/traccar/model/Data.java
+++ b/src/org/traccar/model/Data.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2013 - 2015 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,61 +17,26 @@ package org.traccar.model;
import java.util.Date;
-/**
- * Data without location
- */
public class Data {
- /**
- * Id
- */
- private Long id;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- /**
- * Device
- */
- private Long deviceId;
+ private long id;
+ public long getId() { return id; }
+ public void setId(long id) { this.id = id; }
- public Long getDeviceId() {
- return deviceId;
- }
+ private long deviceId;
+ public long getDeviceId() { return deviceId; }
+ public void setDeviceId(long deviceId) { this.deviceId = deviceId; }
- public void setDeviceId(Long deviceId) {
- this.deviceId = deviceId;
- }
-
- /**
- * Server time (UTC)
- */
private Date serverTime;
+ public Date getServerTime() { return serverTime; }
+ public void setServerTime(Date serverTime) { this.serverTime = serverTime; }
- public Date getServerTime() {
- return serverTime;
- }
-
- public void setServerTime(Date serverTime) {
- this.serverTime = serverTime;
- }
+ private Date deviceTime;
+ public Date getDeviceTime() { return deviceTime; }
+ public void setDeviceTime(Date deviceTime) { this.deviceTime = deviceTime; }
- /**
- * Extended information in XML format
- */
private String extendedInfo;
-
- public String getExtendedInfo() {
- return extendedInfo;
- }
-
- public void setExtendedInfo(String extendedInfo) {
- this.extendedInfo = extendedInfo;
- }
+ public String getExtendedInfo() { return extendedInfo; }
+ public void setExtendedInfo(String extendedInfo) { this.extendedInfo = extendedInfo; }
}
diff --git a/src/org/traccar/model/Device.java b/src/org/traccar/model/Device.java
index cd1985e37..273faebcf 100644
--- a/src/org/traccar/model/Device.java
+++ b/src/org/traccar/model/Device.java
@@ -20,37 +20,23 @@ import java.util.Date;
public class Device {
private long id;
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
+ public long getId() { return id; }
+ public void setId(long id) { this.id = id; }
private String name;
-
- public String getName() {
- return uniqueId;
- }
-
- public void setName(String name) {
- this.name = name;
- }
+ public String getName() { return uniqueId; }
+ public void setName(String name) { this.name = name; }
private String uniqueId;
-
- public String getUniqueId() {
- return uniqueId;
- }
-
- public void setUniqueId(String uniqueId) {
- this.uniqueId = uniqueId;
- }
+ public String getUniqueId() { return uniqueId; }
+ public void setUniqueId(String uniqueId) { this.uniqueId = uniqueId; }
private String status;
private Date lastUpdate;
+
+ private long positionId;
+
+ private long dataId;
}
diff --git a/src/org/traccar/model/Message.java b/src/org/traccar/model/Message.java
deleted file mode 100644
index c699393d8..000000000
--- a/src/org/traccar/model/Message.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class Message {
-
- private final Map data = new HashMap();
-
- public void putString(String key, String value) {
- data.put(key, value);
- }
-
- public String getString(String key) {
- return (String) data.get(key);
- }
-
- public void putInteger(String key, int value) {
- data.put(key, value);
- }
-
- public int getInteger(String key) {
- return (Integer) data.get(key);
- }
-
- public void putDouble(String key, double value) {
- data.put(key, value);
- }
-
- public double getDouble(String key) {
- return (Double) data.get(key);
- }
-
- public void putBoolean(String key, boolean value) {
- data.put(key, value);
- }
-
- public boolean getBoolean(String key) {
- return (Boolean) data.get(key);
- }
-
-}
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
index 898b0d144..14f758b4a 100644
--- a/src/org/traccar/model/Position.java
+++ b/src/org/traccar/model/Position.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2013 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2012 - 2015 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,137 +17,63 @@ package org.traccar.model;
import java.util.Date;
-/**
- * Position information
- */
-public class Position extends Data {
-
- public Position() {
- }
+public class Position {
+
+ private long id;
+ public long getId() { return id; }
+ public void setId(long id) { this.id = id; }
- public Position(
- long deviceId,
- Date time,
- boolean valid,
- double latitude,
- double longitude,
- double altitude,
- double speed,
- double course) {
-
- setDeviceId(deviceId);
- setTime(time);
- setValid(valid);
- setLatitude(latitude);
- setLongitude(longitude);
- setAltitude(altitude);
- setSpeed(speed);
- setCourse(course);
- }
+ private long deviceId;
+ public long getDeviceId() { return deviceId; }
+ public void setDeviceId(long deviceId) { this.deviceId = deviceId; }
+ private Date serverTime;
+ public Date getServerTime() { return serverTime; }
+ public void setServerTime(Date serverTime) { this.serverTime = serverTime; }
- /**
- * Time (UTC)
- */
- private Date time;
-
- public Date getTime() {
- return time;
- }
+ private Date deviceTime;
+ public Date getDeviceTime() { return deviceTime; }
+ public void setDeviceTime(Date deviceTime) { this.deviceTime = deviceTime; }
+ private Date fixTime;
+ public Date getFixTime() { return fixTime; }
+ public void setFixTime(Date fixTime) { this.fixTime = fixTime; }
+
public void setTime(Date time) {
- this.time = time;
- }
-
- /**
- * Validity flag
- */
- private Boolean valid;
-
- public Boolean getValid() {
- return valid;
- }
-
- public void setValid(Boolean valid) {
- this.valid = valid;
- }
-
- /**
- * Latitude
- */
- private Double latitude;
-
- public Double getLatitude() {
- return latitude;
- }
-
- public void setLatitude(Double latitude) {
- this.latitude = latitude;
+ deviceTime = time;
+ fixTime = time;
}
- /**
- * Longitude
- */
- private Double longitude;
+ private boolean valid;
+ public boolean getValid() { return valid; }
+ public void setValid(boolean valid) { this.valid = valid; }
- public Double getLongitude() {
- return longitude;
- }
+ private double latitude;
+ public double getLatitude() { return latitude; }
+ public void setLatitude(double latitude) { this.latitude = latitude; }
- public void setLongitude(Double longitude) {
- this.longitude = longitude;
- }
+ private double longitude;
+ public double getLongitude() { return longitude; }
+ public void setLongitude(double longitude) { this.longitude = longitude; }
- /**
- * Altitude
- */
- private Double altitude;
+ private double altitude;
+ public double getAltitude() { return altitude; }
+ public void setAltitude(double altitude) { this.altitude = altitude; }
- public Double getAltitude() {
- return altitude;
- }
-
- public void setAltitude(Double altitude) {
- this.altitude = altitude;
- }
+ private double speed; // value in knots
+ public double getSpeed() { return speed; }
+ public void setSpeed(double speed) { this.speed = speed; }
- /**
- * Speed (knots)
- */
- private Double speed;
-
- public Double getSpeed() {
- return speed;
- }
-
- public void setSpeed(Double speed) {
- this.speed = speed;
- }
+ private double course;
+ public double getCourse() { return course; }
+ public void setCourse(double course) { this.course = course; }
- /**
- * Course
- */
- private Double course;
-
- public Double getCourse() {
- return course;
- }
-
- public void setCourse(Double course) {
- this.course = course;
- }
-
- /**
- * Address
- */
private String address;
+ public String getAddress() { return address; }
+ public void setAddress(String address) { this.address = address; }
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
+ private String extendedInfo;
+ public String getExtendedInfo() { return extendedInfo; }
+ public void setExtendedInfo(String extendedInfo) { this.extendedInfo = extendedInfo; }
}