Changeset 008bce9 for src/webapp/webservice/inc/GnuBoat/Nmea
- Timestamp:
- Aug 29, 2017, 6:19:00 PM (9 years ago)
- Branches:
- 0.5, debian/bullseye, debian/jessie, master
- Children:
- 89c510f
- Parents:
- fc63b30
- Location:
- src/webapp/webservice/inc/GnuBoat/Nmea
- Files:
-
- 5 edited
-
Nmea0183/Nmea0183Dpt.php (modified) (1 diff)
-
Nmea0183/Nmea0183Mtw.php (modified) (1 diff)
-
Nmea0183/Nmea0183Rmc.php (modified) (5 diffs)
-
Nmea0183/Parser.php (modified) (6 diffs)
-
NmeaSentence.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Dpt.php
rfc63b30 r008bce9 33 33 return; 34 34 35 $this->_depth = $content[1];35 $this->_depth = (float)$content[1]; 36 36 $tmp = explode("*", $content[2]); 37 37 $this->_offset = $tmp[0]; -
src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Mtw.php
rfc63b30 r008bce9 33 33 return; 34 34 35 $this->_temperature = $content[1];35 $this->_temperature = (float)$content[1]; 36 36 $tmp = explode("*", $content[2]); 37 37 $this->_unit = $tmp[0]; -
src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Rmc.php
rfc63b30 r008bce9 19 19 namespace GnuBoat\Nmea\Nmea0183; 20 20 21 /** 22 * @brief NMEA0183 RMC Naviation sentence 23 * 24 * Keep in mind, that the latitude() and longitude() is converted to +/- values 25 */ 21 26 class Nmea0183Rmc extends Nmea0183Sentence 22 27 { … … 49 54 if($content[2] == 'A') 50 55 $this->_status = Nmea0183RmcStatus::A; 51 52 $this->_latitude = $content[3];53 $this->_latitudeDirection = Nmea0183Rmc::directionToEnum($content[4]);54 56 55 $this->_longitude = $content[5]; 56 $this->_longitudeDirection = Nmea0183Rmc::directionToEnum($content[6]); 57 $this->_latitude = (float)$content[3]; 58 if(Nmea0183Rmc::directionToEnum($content[4]) == Nmea0183Direction::South) 59 $this->_latitude = $this->_latitude * -1; 57 60 58 $this->_speedOverGround = $content[7]; 61 $this->_longitude = (float)$content[5]; 62 if(Nmea0183Rmc::directionToEnum($content[6]) == Nmea0183Direction::West) 63 $this->_longitude = $this->_longitude * -1; 59 64 60 $this->_ courseOverGround = $content[8];65 $this->_speedOverGround = (float)$content[7]; 61 66 62 $this->_magneticDeclination = $content[10]; 67 $this->_courseOverGround = (float)$content[8]; 68 69 $this->_magneticDeclination = (float)$content[10]; 63 70 $this->_magneticDeclinationDirection = Nmea0183Rmc::directionToEnum($content[11]); 64 71 … … 82 89 } 83 90 91 /** 92 * @brief Latitude with North (+) and South (-) 93 */ 84 94 public function latitude() 85 95 { … … 87 97 } 88 98 89 public function latitudeDirection() 90 { 91 return $this->_latitudeDirection; 92 } 93 99 /** 100 * @brief Longitude with East (+) and West (-) 101 */ 94 102 public function longitude() 95 103 { 96 104 return $this->_longitude; 97 }98 99 public function longitudeDirection()100 {101 return $this->_longitudeDirection;102 105 } 103 106 … … 162 165 private $_status; 163 166 private $_latitude; 164 private $_latitudeDirection;165 167 private $_longitude; 166 private $_longitudeDirection;167 168 private $_speedOverGround; 168 169 private $_courseOverGround; -
src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Parser.php
rfc63b30 r008bce9 35 35 $result = array(); 36 36 if(!file_exists($file)){ 37 $message = "NMEA file to parse does not exists: ". $file ."\n";37 $message = "NMEA file to parse does not exists: ". $file; 38 38 error_log($message); 39 39 if($debug > 0) 40 print $message ;40 print $message ."\n"; 41 41 return $result; 42 42 } … … 44 44 $fileHandler = fopen($file, 'r'); 45 45 if(!$fileHandler){ 46 $message = "NMEA file to parse could not be opend for reading: ". $file ."\n";46 $message = "NMEA file to parse could not be opend for reading: ". $file; 47 47 error_log($message); 48 48 if($debug > 0) 49 print $message ;49 print $message ."\n"; 50 50 return $result; 51 51 } … … 61 61 $result[] = $parsedSentence; 62 62 else{ 63 $message = "Skipped sentence on line ". $line .": ". $sentence ."\n";63 $message = "Skipped sentence on line ". $line .": ". $sentence; 64 64 error_log($message); 65 65 if($debug > 0) 66 print $message ;66 print $message ."\n"; 67 67 } 68 68 } … … 75 75 $sentence = trim($sentence); 76 76 if(empty($sentence)){ 77 $message = "Empty sentence \n";77 $message = "Empty sentence"; 78 78 error_log($message); 79 79 if($debug > 0) 80 print $message ;80 print $message ."\n"; 81 81 return null; 82 82 } … … 85 85 $result = preg_match('/^[\$!]{1}([\w]{2})([\w]{3})([^\*]+)\*([\da-zA-Z]+)$/', $sentence, $matches); 86 86 if($result === false || $result != 1 || count($matches) != 5){ 87 $message = "Could not detect talker, type and checksum from ". $sentence ."\n";87 $message = "Could not detect talker, type and checksum from ". $sentence; 88 88 error_log($message); 89 89 if($debug > 0) 90 print $message ;90 print $message ."\n"; 91 91 return null; 92 92 } … … 97 97 98 98 if(!array_key_exists(strtolower($type), $this->_types)){ 99 $message = "Skipping unknown NMEA0183 sentence of type ". $type .": ". $sentence ."\n";99 $message = "Skipping unknown NMEA0183 sentence of type ". $type .": ". $sentence; 100 100 error_log($message); 101 101 if($debug > 0) 102 print $message ;102 print $message ."\n"; 103 103 return null; 104 104 } -
src/webapp/webservice/inc/GnuBoat/Nmea/NmeaSentence.php
rfc63b30 r008bce9 48 48 public function type() 49 49 { 50 return $this->_type;50 return strtolower($this->_type); 51 51 } 52 52
Note:
See TracChangeset
for help on using the changeset viewer.
