Changeset 0662b2d
- Timestamp:
- Aug 30, 2017, 2:45:37 PM (9 years ago)
- Branches:
- 0.5, debian/bullseye, debian/jessie, master
- Children:
- a50c18f
- Parents:
- 89c510f
- Location:
- src/webapp
- Files:
-
- 2 added
- 9 edited
-
build.xml (modified) (1 diff)
-
phpunit.xml (added)
-
webservice/inc/GnuBoat/Service.php (modified) (1 diff)
-
webservice/inc/GnuBoat/ServiceData.php (modified) (5 diffs)
-
webservice/inc/GnuBoat/ServiceLogFiles.php (modified) (1 diff)
-
webservice/inc/GnuBoat/ServiceMap.php (modified) (1 diff)
-
webservice/inc/GnuBoat/ServiceShutdown.php (modified) (1 diff)
-
webservice/inc/GnuBoat/TrackItem.php (modified) (13 diffs)
-
webservice/inc/GnuBoat/Webservice.php (modified) (1 diff)
-
webservice/tests/ServiceTest.php (modified) (3 diffs)
-
webservice/tests/TrackItemTest.php (added)
Legend:
- Unmodified
- Added
- Removed
-
src/webapp/build.xml
r89c510f r0662b2d 73 73 74 74 <target name="test"> 75 <phpunit bootstrap="webservice/inc/autoloader.php" pharlocation="phpunit-4.8.9.phar" haltonfailure="true" haltonerror="true" printsummary="true" codecoverage="false"> 76 <formatter type="plain" usefile="false"/> 75 <exec command="php phpunit-4.8.9.phar" passthru="true" checkreturn="true"/> 76 <!--<phpunit pharlocation="phpunit-4.8.9.phar" configuration="phpunit.xml" haltonfailure="true" haltonerror="true" printsummary="true" codecoverage="false"> 77 <formatter type="plain" usefile="false"/> --> 77 78 <!--<formatter type="JUnit" usefile="true"/>--> 78 <batchtest>79 <!-- <batchtest> 79 80 <fileset dir="webservice"> 80 81 <include name="tests/*Test.php"/> 81 82 </fileset> 82 83 </batchtest> 83 </phpunit> 84 </phpunit>--> 84 85 </target> 85 86 </project> -
src/webapp/webservice/inc/GnuBoat/Service.php
r89c510f r0662b2d 45 45 } 46 46 47 public static function error ($message)47 public static function errorStatic($message, $additionalContent = array(), $debug) 48 48 { 49 Service::output(["error" => 1, "errormessage" => $message]); 49 error_log($message); 50 if($debug > 0) 51 print $message ."\n"; 52 $result = ["error" => 1, "errormessage" => $message]; 53 Service::outputStatic(array_merge($result, $additionalContent), $debug); 50 54 } 51 55 52 public static function output ($content)56 public static function outputStatic($content, $debug) 53 57 { 54 58 header('Content-Type: application/json'); 55 echo json_encode($content); 59 if($debug > 0){ 60 echo json_encode($content, JSON_PRETTY_PRINT) ."\n"; 61 } 62 else{ 63 echo json_encode($content) ."\n"; 64 } 65 } 66 67 protected function error($message, $additionalContent = array()) 68 { 69 Service::errorStatic($message, $additionalContent, $this->debug()); 70 } 71 72 protected function output($content) 73 { 74 Service::outputStatic($content, $this->debug()); 56 75 } 57 76 -
src/webapp/webservice/inc/GnuBoat/ServiceData.php
r89c510f r0662b2d 29 29 $this->_configRound = array 30 30 ( 31 "latitude" => 5,32 "longitude" => 5,31 "latitude" => 4, 32 "longitude" => 4, 33 33 "speedthroughwater" => 1, 34 34 "speedoverground" => 1, 35 "courseoverground" => 1, 35 36 "waterdepth" => 1, 36 37 "watertemperature" => 1, … … 48 49 $result["track"] = array(); 49 50 50 if(!file_exists($dbFile)){ 51 if($debug > 0) 52 echo "Database file ". $dbFile ." does not exist!"; 53 error_log("Database file ". $dbFile ." does not exist"); 54 return; 55 } 51 if(!file_exists($dbFile)) 52 return $this->error("Database file ". $dbFile ." does not exist"); 53 56 54 // Fetch entries of the last 30s with maximum (available) resolution of 2s 57 55 $this->addRrdData($dbFile, "2", "240", $result, $lastValid); 58 if($lastValid ){59 $result["lastvalid"] = $lastValid ;56 if($lastValid !== false){ 57 $result["lastvalid"] = $lastValid->toArray(); 60 58 } 61 59 // Fetch entries of the last 1h with maximum (available) resolution of 10s … … 64 62 $this->addRrdData($dbFile, "60", "86400", $result, $lastTime); 65 63 66 if($debug > 0){ 67 echo json_encode($result, JSON_PRETTY_PRINT) ."\n"; 68 } 69 else{ 70 header('Content-Type: application/json'); 71 echo json_encode($result) ."\n"; 72 } 64 return $this->output($result); 73 65 } 74 66 … … 81 73 $data = rrd_fetch($dbFile, array("AVERAGE", "--resolution", $interval, "--start", $startTime, "--end", $endTime)); 82 74 // $data = rrd_fetch($dbFile, array("AVERAGE", "--resolution", $interval, "--start", "-". $period, "--end", "start+". $period, "--align-start")); 83 if($data === false){ 84 echo json_encode($result); 85 $message = "Failure reading rrd database ". $dbFile .": ". rrd_error(); 86 if($debug > 0) 87 echo $message; 88 else 89 error_log($message); 90 return; 91 } 75 if($data === false) 76 return $this->error("Failure reading rrd database ". $dbFile .": ". rrd_error(), $result); 92 77 93 78 if($debug > 2){ 94 echo "<pre>";95 79 var_dump($data); 96 echo "</pre>";97 80 } 98 81 … … 101 84 // transform them into json format 102 85 $i = 0; 103 $lastValid = -1;86 $lastValid = false; 104 87 $keys = array_keys($data); 105 88 $keyTimeframes = $keys[0]; 106 89 $itemCount = count($keys); 107 if($itemCount < 0 ){ 108 error_log("No keys in fetched rrd data from ". $dbFile); 109 echo json_encode(""); 110 exit; 111 } 90 if($itemCount < 0 ) 91 return $this->error("No keys in fetched rrd data from ". $dbFile); 92 112 93 $timeframesCount = count($data[$keyTimeframes]); 113 if($debug > 0){114 e cho "<p>Variables: ". $itemCount ."; Timeframes: ". $timeframesCount ."</p>\n";94 if($debug > 1){ 95 error_log("Variables: ". $itemCount ."; Timeframes: ". $timeframesCount); 115 96 } 116 97 foreach($data[$keys[0]] as $timeframe => $value){ 117 $allValid = true; 118 $gpsFix = false; 119 $tmp = array(); 98 $tmp = new TrackItem($timeframe); 120 99 foreach($keys as $key){ 121 if($key == "gpsfix"){ 122 switch($data[$key][$timeframe]){ 123 case 2: 124 $tmp[$key] = "2D"; 125 $gpsFix = true; 126 break; 127 case 3: 128 $tmp[$key] = "3D"; 129 $gpsFix = true; 130 break; 131 default: 132 $tmp[$key] = "-"; 133 } 134 } 135 else{ 136 $tmp[$key] = $data[$key][$timeframe]; 137 if(!is_numeric($tmp[$key]) || is_nan($tmp[$key])){ 138 $allValid = false; 139 if($debug > 1){ 140 echo "Invalid value ". $key ." (". $tmp[$key] .") at time ". $timeframe ."<br/>"; 141 } 142 } 143 elseif(array_key_exists($key, $this->_configRound) && is_integer($this->_configRound[$key])) 144 $tmp[$key] = round($tmp[$key], $this->_configRound[$key]); 145 } 100 $value = $data[$key][$timeframe]; 101 if(array_key_exists($key, $this->_configRound) && is_integer($this->_configRound[$key])) 102 $value = round($value, $this->_configRound[$key]); 103 if(!$tmp->setProperty($key, $value) && $debug > 1) 104 error_log("Coult not set property ". $key ." to value ". $value ." at ". $timeframe); 146 105 } 147 106 // only add the timeframe to the track, if the values are valid and we had a gps fix at that time 148 if($ allValid){107 if($tmp->isValid()){ 149 108 $lastValid = $tmp; 150 if($ gpsFix){109 if($tmp->gpsFixed()){ 151 110 if(!array_key_exists($timeframe, $result["track"])){ 152 $result["track"][$timeframe] = $tmp ;111 $result["track"][$timeframe] = $tmp->toArray(); 153 112 } 154 113 } -
src/webapp/webservice/inc/GnuBoat/ServiceLogFiles.php
r89c510f r0662b2d 39 39 $files = glob($config->logDirectory() ."*.log"); 40 40 array_walk($files, 'GnuBoat\ServiceLogFiles::stripLogDirectory'); 41 return $this->output($files); 42 } 41 43 42 header('Content-Type: application/json'); 43 if($debug > 0){ 44 echo json_encode($files, JSON_PRETTY_PRINT) ."\n"; 44 // prepare a download of available log files 45 $files = $_POST["logfilesSelected"]; 46 if(count($files) < 1) 47 return $this->error("No logfile selected"); 48 elseif(count($files) == 1){ 49 $content = file_get_contents($config->logDirectory() . $files[0]); 50 if($content === false){ 51 echo "<html><head></head><body>Failed to read logfile ". $files[0] ."</body></html>"; 45 52 } 46 else{ 47 echo json_encode($files) ."\n"; 48 } 53 54 header('Content-Type: text/plain'); 55 header('Content-disposition: attachment; filename="'. $files[0] .'"'); 56 header('Content-Length: ' . filesize($config->logDirectory() . $files[0])); 57 echo $content; 49 58 } 50 59 else{ 51 // prepare a download of available log files 52 $files = $_POST["logfilesSelected"]; 53 if(count($files) < 1){ 60 $date = new \DateTime('NOW'); 61 $archiveName = "gnuboat-logs-". $date->format("Y-m-d"); 62 63 // provide files as zip file 64 $tmpArchive = tempnam(sys_get_temp_dir(), $archiveName); 65 $zip = new \ZipArchive(); 66 if($zip->open($tmpArchive, \ZipArchive::CREATE) !== TRUE){ 67 echo "<html><head></head><body>Failed to create zip file</body></html>"; 54 68 return; 55 69 } 56 elseif(count($files) == 1){ 57 $content = file_get_contents($config->logDirectory() . $files[0]); 58 if($content === false){ 59 echo "<html><head></head><body>Failed to read logfile ". $files[0] ."</body></html>"; 60 } 61 62 header('Content-Type: text/plain'); 63 header('Content-disposition: attachment; filename="'. $files[0] .'"'); 64 header('Content-Length: ' . filesize($config->logDirectory() . $files[0])); 65 echo $content; 66 } 67 else{ 68 $date = new \DateTime('NOW'); 69 $archiveName = "gnuboat-logs-". $date->format("Y-m-d"); 70 71 // provide files as zip file 72 $tmpArchive = tempnam(sys_get_temp_dir(), $archiveName); 73 $zip = new \ZipArchive(); 74 if($zip->open($tmpArchive, \ZipArchive::CREATE) !== TRUE){ 75 echo "<html><head></head><body>Failed to create zip file</body></html>"; 70 foreach($files as $file){ 71 if($zip->addFile($config->logDirectory() . $file, $archiveName ."/". $file) !== true){ 72 $zip->close(); 73 echo "<html><head></head><body>Failed to add logfile ". $file ." to the zip file</body></html>"; 76 74 return; 77 75 } 78 foreach($files as $file){79 if($zip->addFile($config->logDirectory() . $file, $archiveName ."/". $file) !== true){80 $zip->close();81 echo "<html><head></head><body>Failed to add logfile ". $file ." to the zip file</body></html>";82 return;83 }84 }85 if($zip->close() !== true){86 echo "<html><head></head><body>Failed to save zip file</body></html>";87 return;88 }89 90 echo "<html><head></head><body>Failed to add logfile ". $file ." to the zip file</body></html>";91 92 //Send zip folder93 while (ob_get_level()) {94 ob_end_clean();95 }96 ob_start();97 header('Content-Type: application/zip');98 header('Content-Transfer-Encoding: Binary');99 header('Content-disposition: attachment; filename=' . $archiveName . '.zip');100 header('Content-Length: ' . filesize($tmpArchive));101 ob_flush();102 ob_clean();103 readfile($tmpArchive);104 unlink($tmpArchive);105 return;106 76 } 77 if($zip->close() !== true){ 78 echo "<html><head></head><body>Failed to save zip file</body></html>"; 79 return; 80 } 81 82 echo "<html><head></head><body>Failed to add logfile ". $file ." to the zip file</body></html>"; 83 84 //Send zip folder 85 while (ob_get_level()) { 86 ob_end_clean(); 87 } 88 ob_start(); 89 header('Content-Type: application/zip'); 90 header('Content-Transfer-Encoding: Binary'); 91 header('Content-disposition: attachment; filename=' . $archiveName . '.zip'); 92 header('Content-Length: ' . filesize($tmpArchive)); 93 ob_flush(); 94 ob_clean(); 95 readfile($tmpArchive); 96 unlink($tmpArchive); 97 return; 107 98 } 108 99 } -
src/webapp/webservice/inc/GnuBoat/ServiceMap.php
r89c510f r0662b2d 30 30 protected function process() 31 31 { 32 header('Content-type: application/json'); 32 if(!array_key_exists("mapName", $_POST)) 33 return $this->error("Please specify map name (no value)"); 33 34 34 $result["error"] = 1;35 $result["errormessage"] = "Unknown Error";36 37 if(!array_key_exists("mapName", $_POST)){38 $result["error"] = 1;39 $result["errormessage"] = "Please specify map name (no value)";40 echo json_encode($result);41 return;42 }43 35 $mapName = $_POST["mapName"]; 44 if(empty($mapName) || $mapName == ""){ 45 $result["error"] = 1; 46 $result["errormessage"] = "Please specifiy map name (empty value)"; 47 echo json_encode($result); 48 return; 49 } 36 if(empty($mapName) || $mapName == "") 37 return $this->error("Please specifiy map name (empty value)"); 50 38 51 39 $mapDirectory = __DIR__ ."/../../maps"; 52 if(!array_key_exists("mapFile", $_FILES)){ 53 $result["error"] = 1; 54 $result["errormessage"] = "No map file recieved"; 55 echo json_encode($result); 56 return; 57 } 58 if (!isset($_FILES['mapFile']['error']) || is_array($_FILES['mapFile']['error'])){ 59 $result["error"] = 1; 60 $result["errormessage"] = "Invalid parameters"; 61 echo json_encode($result); 62 return; 63 } 40 if(!array_key_exists("mapFile", $_FILES)) 41 return $this->error("No map file recieved"); 42 43 if (!isset($_FILES['mapFile']['error']) || is_array($_FILES['mapFile']['error'])) 44 return $this->error("Invalid parameters"); 45 64 46 switch ($_FILES['mapFile']['error']) { 65 47 case UPLOAD_ERR_OK: 66 48 break; 67 49 case UPLOAD_ERR_NO_FILE: 68 $result["error"] = 1; 69 $result["errormessage"] = "No file sent"; 70 echo json_encode($result); 71 return; 50 return $this->error("No file sent"); 72 51 case UPLOAD_ERR_INI_SIZE: 73 52 case UPLOAD_ERR_FORM_SIZE: 74 $result["error"] = 1; 75 $result["errormessage"] = "Exceeded filesize limit."; 76 echo json_encode($result); 77 return; 53 return $this->error("Exceeded filesize limit."); 78 54 default: 79 $result["error"] = 1; 80 $result["errormessage"] = "Unknown PHP Error"; 81 echo json_encode($result); 82 return; 55 return $this->error("Unknown PHP Error"); 83 56 } 84 57 $mapFileName = $mapDirectory ."/". sha1_file($_FILES['mapFile']['tmp_name']) .".mbtiles"; 85 58 if(move_uploaded_file($_FILES['mapFile']['tmp_name'], $mapFileName)){ 86 if(!chmod($mapFileName, 0755)){ 87 $result["error"] = 1; 88 $result["errormessage"] = "Could not change permissions of the map file"; 89 } 90 else{ 91 // correct map metadata 92 $resultRename = $this->setMapName($mapFileName, $mapName); 93 if($resultRename[0] === true){ 94 $result["error"] = 0; 95 $result["errormessage"] = ""; 96 } 97 else{ 98 $result["error"] = 1; 99 $result["errormessage"] = $resultRename[1]; 100 } 101 } 59 if(!chmod($mapFileName, 0755)) 60 return $this->error("Could not change permissions of the map file"); 61 // correct map metadata 62 $resultRename = $this->setMapName($mapFileName, $mapName); 63 if($resultRename[0] === true) 64 return $this->output(["error" => 0, "errormessage" => ""]); 65 66 return $this->error($resultRename[1]); 102 67 } 103 else { 104 $result["error"] = 1; 105 $result["errormessage"] = "Could not move map in place"; 106 } 107 echo json_encode($result); 68 else 69 return $this->error("Could not move map in place"); 108 70 } 109 71 -
src/webapp/webservice/inc/GnuBoat/ServiceShutdown.php
r89c510f r0662b2d 36 36 if($handle === false){ 37 37 $message = "Could not create file (". $config->shutdownRequestFile() .") to indicate shutdown to the daemon."; 38 error_log($message); 39 $result["shutdownstart"] = -1; 40 $result["errormessage"] = $message; 41 } 42 else{ 43 $shutdownTime = new \DateTime('NOW'); 44 $shutdownTime->modify("+15 seconds"); 45 fwrite($handle, $shutdownTime->format(\DateTime::ATOM)); 46 $result["shutdownstart"] = $shutdownTime->format(\DateTime::ATOM); 38 return $this->error($message, ["shutdownstart" => -1]); 47 39 } 48 40 49 header('Content-Type: application/json'); 50 if($debug > 0){ 51 echo json_encode($result, JSON_PRETTY_PRINT) ."\n"; 52 } 53 else{ 54 echo json_encode($result) ."\n"; 55 } 41 $shutdownTime = new \DateTime('NOW'); 42 $shutdownTime->modify("+15 seconds"); 43 fwrite($handle, $shutdownTime->format(\DateTime::ATOM)); 44 fclose($handle); 45 $result["shutdownstart"] = $shutdownTime->format(\DateTime::ATOM); 46 $this->output($result); 56 47 } 57 48 } -
src/webapp/webservice/inc/GnuBoat/TrackItem.php
r89c510f r0662b2d 24 24 class TrackItem 25 25 { 26 function __construct( )27 { 28 $this-> _time = null;29 $this-> _latitude = null;30 $this-> _longitude = null;26 function __construct($timestamp = null, $latitude = null, $longitude = null) 27 { 28 $this->setTimestamp($timestamp); 29 $this->setLatitude($latitude); 30 $this->setLongitude($longitude); 31 31 $this->_speedThroughWater = null; 32 32 $this->_speedOverGround = null; … … 35 35 $this->_waterTemperature = null; 36 36 $this->_gpsfix = null; 37 } 38 37 38 $this->_properties = [ 39 "time" => ["timestamp", "setTimestamp"], 40 "latitude" => ["latitude", "setLatitude"], 41 "longitude" => ["longitude", "setLongitude"], 42 "speedthroughwater" => ["speedThroughWater", "setSpeedThroughWater"], 43 "speedoverground" => ["speedOverGround", "setSpeedOverGround"], 44 "courseoverground" => ["courseOverGround", "setCourseOverGround"], 45 "waterdepth" => ["waterDepth", "setWaterDepth"], 46 "watertemperature" => ["waterTemperature", "setWaterTemperature"], 47 "gpsfix" => ["gpsFix", "setGpsFix"], 48 ]; 49 } 50 51 public function hasProperty($property) 52 { 53 return array_key_exists(strtolower($property), $this->_properties); 54 } 55 56 public function getProperty($property) 57 { 58 $property = strtolower($property); 59 if(!$this->hasProperty($property)) 60 return null; 61 return call_user_func(array($this, $this->_properties[$property][0])); 62 } 63 64 public function setProperty($property, $value) 65 { 66 $property = strtolower($property); 67 if(!$this->hasProperty($property)) 68 return false; 69 return call_user_func(array($this, $this->_properties[$property][1]), $value); 70 } 71 39 72 public function setTimestamp($time) 40 73 { 74 if(!is_numeric($time) || is_nan($time)){ 75 $this->_time = null; 76 return false; 77 } 41 78 $this->_time = $time; 79 return true; 42 80 } 43 81 … … 45 83 { 46 84 $timezone = new \DateTimeZone("UTC"); 47 if($dateTime == null) 85 if($dateTime == null){ 48 86 $this->_time = null; 87 return true; 88 } 49 89 $dateTime->setTimezone($timezone); 50 90 $this->_time = $dateTime->getTimestamp(); 91 return true; 51 92 } 52 93 … … 56 97 } 57 98 58 public function setLatitude($latitude) 59 { 99 public function setLatitude($latitude) 100 { 101 if(!is_numeric($latitude) || is_nan($latitude)){ 102 $this->_latitude = null; 103 return false; 104 } 60 105 $this->_latitude = $latitude; 106 return true; 61 107 } 62 108 … … 66 112 } 67 113 68 public function setLongitude($longitude) 69 { 114 public function setLongitude($longitude) 115 { 116 if(!is_numeric($longitude) || is_nan($longitude)){ 117 $this->_longitude = null; 118 return false; 119 } 70 120 $this->_longitude = $longitude; 121 return true; 71 122 } 72 123 … … 76 127 } 77 128 78 public function setSpeedThroughWater($speedThroughWater) 79 { 129 public function setSpeedThroughWater($speedThroughWater) 130 { 131 if(!is_numeric($speedThroughWater) || is_nan($speedThroughWater)){ 132 $this->_speedThroughWater = null; 133 return false; 134 } 80 135 $this->_speedThroughWater = $speedThroughWater; 136 return true; 81 137 } 82 138 … … 86 142 } 87 143 88 public function setSpeedOverGround($speedOverGround) 89 { 144 public function setSpeedOverGround($speedOverGround) 145 { 146 if(!is_numeric($speedOverGround) || is_nan($speedOverGround)){ 147 $this->_speedOverGround = null; 148 return false; 149 } 90 150 $this->_speedOverGround = $speedOverGround; 151 return true; 91 152 } 92 153 … … 96 157 } 97 158 98 public function setCourseOverGround($courseOverGround) 99 { 159 public function setCourseOverGround($courseOverGround) 160 { 161 if(!is_numeric($courseOverGround) || is_nan($courseOverGround)){ 162 $this->_courseOverGround = null; 163 return false; 164 } 100 165 $this->_courseOverGround = $courseOverGround; 166 return true; 101 167 } 102 168 … … 106 172 } 107 173 108 public function setWaterDepth($waterDepth) 109 { 174 public function setWaterDepth($waterDepth) 175 { 176 if(!is_numeric($waterDepth) || is_nan($waterDepth)){ 177 $this->_waterDepth = null; 178 return false; 179 } 110 180 $this->_waterDepth = $waterDepth; 181 return true; 111 182 } 112 183 … … 116 187 } 117 188 118 public function setWaterTemperature($waterTemperature) 119 { 189 public function setWaterTemperature($waterTemperature) 190 { 191 if(!is_numeric($waterTemperature) || is_nan($waterTemperature)){ 192 $this->_waterTemperature = null; 193 return false; 194 } 120 195 $this->_waterTemperature = $waterTemperature; 196 return true; 121 197 } 122 198 … … 126 202 } 127 203 128 public function setGpsFix($gpsFix) 129 { 204 public function setGpsFix($gpsFix) 205 { 206 if(!is_numeric($gpsFix) || is_nan($gpsFix)){ 207 $this->_gpsFix = null; 208 return false; 209 } 130 210 $this->_gpsFix = $gpsFix; 211 return true; 131 212 } 132 213 … … 136 217 } 137 218 219 public function gpsFixString() 220 { 221 switch($this->gpsFix()){ 222 case 2: 223 return "2D"; 224 case 3: 225 return "3D"; 226 default: 227 return "-"; 228 } 229 } 230 231 public function gpsFixed() 232 { 233 if($this->gpsFix() != null && $this->gpsFix() > 1) 234 return true; 235 return false; 236 } 237 138 238 public function isValid() 139 239 { … … 149 249 public function toArray() 150 250 { 151 $speedThroughWater = ($this->speedThroughWater() != null) ? $this->speedThroughWater() : 0;152 $speedOverGround = ($this->speedOverGround() != null) ? $this->speedOverGround() : 0;153 $courseOverGround = ($this->courseOverGround() != null) ? $this->courseOverGround() : 0;154 $waterDepth = ($this->waterDepth() != null) ? $this->waterDepth() : 0;155 $waterTemperature = ($this->waterTemperature() != null) ? $this->waterTemperature() : 0;156 $gpsFix = ($this->gpsFix() != null) ? $this->gpsFix() : 0;251 $speedThroughWater = ($this->speedThroughWater() != null) ? $this->speedThroughWater() : "-"; 252 $speedOverGround = ($this->speedOverGround() != null) ? $this->speedOverGround() : "-"; 253 $courseOverGround = ($this->courseOverGround() != null) ? $this->courseOverGround() : "-"; 254 $waterDepth = ($this->waterDepth() != null) ? $this->waterDepth() : "-"; 255 $waterTemperature = ($this->waterTemperature() != null) ? $this->waterTemperature() : "-"; 256 $gpsFix = $this->gpsFixString(); 157 257 158 258 return [ -
src/webapp/webservice/inc/GnuBoat/Webservice.php
r89c510f r0662b2d 43 43 44 44 if(!array_key_exists($request, $this->_requests)){ 45 return Service::error ("Request ". $request ." not implemented");45 return Service::errorStatic("Request ". $request ." not implemented", $this->_debug); 46 46 } 47 47 -
src/webapp/webservice/tests/ServiceTest.php
r89c510f r0662b2d 50 50 $webservice->process(); 51 51 } 52 52 53 53 public function testMap() 54 54 { … … 58 58 $webservice->process(); 59 59 } 60 60 61 61 public function testReplay() 62 62 { … … 68 68 } 69 69 70 function error_log($msg)71 {72 echo "ERR GnuBoat: ". $msg ."\n";73 }70 function error_log($msg) 71 { 72 echo "ERR GnuBoat: ". $msg ."\n"; 73 } 74 74 75 75 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
