Index: src/webapp/webservice/inc/GnuBoat/TrackItem.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/TrackItem.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
+++ src/webapp/webservice/inc/GnuBoat/TrackItem.php	(revision 38a21215d39f85f45c944afe9315ae116c22becb)
@@ -24,9 +24,9 @@
 class TrackItem
 {
-	function __construct()
-	{
-		$this->_time = null;
-		$this->_latitude = null;
-		$this->_longitude = null;
+	function __construct($timestamp = null, $latitude = null, $longitude = null)
+	{
+		$this->setTimestamp($timestamp);
+		$this->setLatitude($latitude);
+		$this->setLongitude($longitude);
 		$this->_speedThroughWater = null;
 		$this->_speedOverGround = null;
@@ -35,9 +35,47 @@
 		$this->_waterTemperature = null;
 		$this->_gpsfix = null;
-	}
-
+		
+		$this->_properties = [
+			"time" => ["timestamp", "setTimestamp"],
+			"latitude" => ["latitude", "setLatitude"],
+			"longitude" => ["longitude", "setLongitude"],
+			"speedthroughwater" => ["speedThroughWater", "setSpeedThroughWater"],
+			"speedoverground" => ["speedOverGround", "setSpeedOverGround"],
+			"courseoverground" => ["courseOverGround", "setCourseOverGround"],
+			"waterdepth" => ["waterDepth", "setWaterDepth"],
+			"watertemperature" => ["waterTemperature", "setWaterTemperature"],
+			"gpsfix" => ["gpsFix", "setGpsFix"],
+		];
+	}
+
+	public function hasProperty($property)
+	{
+		return array_key_exists(strtolower($property), $this->_properties);
+	}
+	
+	public function getProperty($property)
+	{
+		$property = strtolower($property);
+		if(!$this->hasProperty($property))
+			return null;
+		return call_user_func(array($this, $this->_properties[$property][0]));
+	}
+	
+	public function setProperty($property, $value)
+	{
+		$property = strtolower($property);
+		if(!$this->hasProperty($property))
+			return false;
+		return call_user_func(array($this, $this->_properties[$property][1]), $value);
+	}
+	
 	public function setTimestamp($time)
 	{
+		if(!is_numeric($time) || is_nan($time)){
+			$this->_time = null;
+			return false;
+		}
 		$this->_time = $time;
+		return true;
 	}
 	
@@ -45,8 +83,11 @@
 	{
 		$timezone = new \DateTimeZone("UTC");
-		if($dateTime == null)
+		if($dateTime == null){
 			$this->_time = null;
+			return true;
+		}
 		$dateTime->setTimezone($timezone);
 		$this->_time = $dateTime->getTimestamp();
+		return true;
 	}
 	
@@ -56,7 +97,12 @@
 	}
 	
-		public function setLatitude($latitude)
-	{
+	public function setLatitude($latitude)
+	{
+		if(!is_numeric($latitude) || is_nan($latitude)){
+			$this->_latitude = null;
+			return false;
+		}
 		$this->_latitude = $latitude;
+		return true;
 	}
 	
@@ -66,7 +112,12 @@
 	}
 	
-		public function setLongitude($longitude)
-	{
+	public function setLongitude($longitude)
+	{
+		if(!is_numeric($longitude) || is_nan($longitude)){
+			$this->_longitude = null;
+			return false;
+		}
 		$this->_longitude = $longitude;
+		return true;
 	}
 	
@@ -76,7 +127,12 @@
 	}
 	
-		public function setSpeedThroughWater($speedThroughWater)
-	{
+	public function setSpeedThroughWater($speedThroughWater)
+	{
+		if(!is_numeric($speedThroughWater) || is_nan($speedThroughWater)){
+			$this->_speedThroughWater = null;
+			return false;
+		}
 		$this->_speedThroughWater = $speedThroughWater;
+		return true;
 	}
 	
@@ -86,7 +142,12 @@
 	}
 	
-		public function setSpeedOverGround($speedOverGround)
-	{
+	public function setSpeedOverGround($speedOverGround)
+	{
+		if(!is_numeric($speedOverGround) || is_nan($speedOverGround)){
+			$this->_speedOverGround = null;
+			return false;
+		}
 		$this->_speedOverGround = $speedOverGround;
+		return true;
 	}
 	
@@ -96,7 +157,12 @@
 	}
 	
-		public function setCourseOverGround($courseOverGround)
-	{
+	public function setCourseOverGround($courseOverGround)
+	{
+		if(!is_numeric($courseOverGround) || is_nan($courseOverGround)){
+			$this->_courseOverGround = null;
+			return false;
+		}
 		$this->_courseOverGround = $courseOverGround;
+		return true;
 	}
 	
@@ -106,7 +172,12 @@
 	}
 	
-		public function setWaterDepth($waterDepth)
-	{
+	public function setWaterDepth($waterDepth)
+	{
+		if(!is_numeric($waterDepth) || is_nan($waterDepth)){
+			$this->_waterDepth = null;
+			return false;
+		}
 		$this->_waterDepth = $waterDepth;
+		return true;
 	}
 	
@@ -116,7 +187,12 @@
 	}
 	
-		public function setWaterTemperature($waterTemperature)
-	{
+	public function setWaterTemperature($waterTemperature)
+	{
+		if(!is_numeric($waterTemperature) || is_nan($waterTemperature)){
+			$this->_waterTemperature = null;
+			return false;
+		}
 		$this->_waterTemperature = $waterTemperature;
+		return true;
 	}
 	
@@ -126,7 +202,12 @@
 	}
 	
-		public function setGpsFix($gpsFix)
-	{
+	public function setGpsFix($gpsFix)
+	{
+		if(!is_numeric($gpsFix) || is_nan($gpsFix)){
+			$this->_gpsFix = null;
+			return false;
+		}
 		$this->_gpsFix = $gpsFix;
+		return true;
 	}
 	
@@ -136,4 +217,23 @@
 	}
 	
+	public function gpsFixString()
+	{
+		switch($this->gpsFix()){
+			case 2:
+				return "2D";
+			case 3:
+				return "3D";
+			default:
+				return "-";
+		}
+	}
+	
+	public function gpsFixed()
+	{
+		if($this->gpsFix() != null && $this->gpsFix() > 1)
+			return true;
+		return false;
+	}
+	
 	public function isValid()
 	{
@@ -149,10 +249,10 @@
 	public function toArray()
 	{
-		$speedThroughWater = ($this->speedThroughWater() != null) ? $this->speedThroughWater() : 0;
-		$speedOverGround = ($this->speedOverGround() != null) ? $this->speedOverGround() : 0;
-		$courseOverGround = ($this->courseOverGround() != null) ? $this->courseOverGround() : 0;
-		$waterDepth = ($this->waterDepth() != null) ? $this->waterDepth() : 0;
-		$waterTemperature = ($this->waterTemperature() != null) ? $this->waterTemperature() : 0;
-		$gpsFix = ($this->gpsFix() != null) ? $this->gpsFix() : 0;
+		$speedThroughWater = ($this->speedThroughWater() != null) ? $this->speedThroughWater() : "-";
+		$speedOverGround = ($this->speedOverGround() != null) ? $this->speedOverGround() : "-";
+		$courseOverGround = ($this->courseOverGround() != null) ? $this->courseOverGround() : "-";
+		$waterDepth = ($this->waterDepth() != null) ? $this->waterDepth() : "-";
+		$waterTemperature = ($this->waterTemperature() != null) ? $this->waterTemperature() : "-";
+		$gpsFix = $this->gpsFixString();
 	
 		return [
