Ignore:
Timestamp:
Aug 29, 2017, 6:19:00 PM (9 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
0.5, debian/bullseye, debian/jessie, master
Children:
89c510f
Parents:
fc63b30
Message:

First more or less working version of visualising logfiles on the map

Location:
src/webapp/webservice/inc/GnuBoat/Nmea
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Dpt.php

    rfc63b30 r008bce9  
    3333                        return;
    3434               
    35                 $this->_depth = $content[1];
     35                $this->_depth = (float)$content[1];
    3636                $tmp = explode("*", $content[2]);
    3737                $this->_offset = $tmp[0];
  • src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Mtw.php

    rfc63b30 r008bce9  
    3333                        return;
    3434               
    35                 $this->_temperature = $content[1];
     35                $this->_temperature = (float)$content[1];
    3636                $tmp = explode("*", $content[2]);
    3737                $this->_unit = $tmp[0];
  • src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Rmc.php

    rfc63b30 r008bce9  
    1919namespace GnuBoat\Nmea\Nmea0183;
    2020
     21/**
     22 * @brief NMEA0183 RMC Naviation sentence
     23 *
     24 * Keep in mind, that the latitude() and longitude() is converted to +/- values
     25 */
    2126class Nmea0183Rmc extends Nmea0183Sentence
    2227{
    … …  
    4954                if($content[2] == 'A')
    5055                        $this->_status = Nmea0183RmcStatus::A;
    51                        
    52                 $this->_latitude = $content[3];
    53                 $this->_latitudeDirection = Nmea0183Rmc::directionToEnum($content[4]);
    5456               
    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;
    5760               
    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;
    5964               
    60                 $this->_courseOverGround = $content[8];
     65                $this->_speedOverGround = (float)$content[7];
    6166               
    62                 $this->_magneticDeclination = $content[10];
     67                $this->_courseOverGround = (float)$content[8];
     68               
     69                $this->_magneticDeclination = (float)$content[10];
    6370                $this->_magneticDeclinationDirection = Nmea0183Rmc::directionToEnum($content[11]);
    6471               
    … …  
    8289        }
    8390       
     91        /**
     92         * @brief Latitude with North (+) and South (-)
     93         */
    8494        public function latitude()
    8595        {
    … …  
    8797        }
    8898       
    89         public function latitudeDirection()
    90         {
    91                 return $this->_latitudeDirection;
    92         }
    93        
     99        /**
     100         * @brief Longitude with East (+) and West (-)
     101         */
    94102        public function longitude()
    95103        {
    96104                return $this->_longitude;
    97         }
    98 
    99         public function longitudeDirection()
    100         {
    101                 return $this->_longitudeDirection;
    102105        }
    103106       
    … …  
    162165        private $_status;
    163166        private $_latitude;
    164         private $_latitudeDirection;
    165167        private $_longitude;
    166         private $_longitudeDirection;
    167168        private $_speedOverGround;
    168169        private $_courseOverGround;
  • src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Parser.php

    rfc63b30 r008bce9  
    3535                $result = array();
    3636                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;
    3838                        error_log($message);
    3939                        if($debug > 0)
    40                                 print $message;
     40                                print $message ."\n";
    4141                        return $result;
    4242                }
    … …  
    4444                $fileHandler = fopen($file, 'r');
    4545                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;
    4747                        error_log($message);
    4848                        if($debug > 0)
    49                                 print $message;
     49                                print $message ."\n";
    5050                        return $result;
    5151                }
    … …  
    6161                                $result[] = $parsedSentence;
    6262                        else{
    63                                 $message = "Skipped sentence on line ". $line .": ". $sentence ."\n";
     63                                $message = "Skipped sentence on line ". $line .": ". $sentence;
    6464                                error_log($message);
    6565                                if($debug > 0)
    66                                         print $message;
     66                                        print $message ."\n";
    6767                        }
    6868                }
    … …  
    7575                $sentence = trim($sentence);
    7676                if(empty($sentence)){
    77                         $message = "Empty sentence\n";
     77                        $message = "Empty sentence";
    7878                        error_log($message);
    7979                        if($debug > 0)
    80                                 print $message;
     80                                print $message ."\n";
    8181                        return null;
    8282                }
    … …  
    8585                $result = preg_match('/^[\$!]{1}([\w]{2})([\w]{3})([^\*]+)\*([\da-zA-Z]+)$/', $sentence, $matches);
    8686                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;
    8888                        error_log($message);
    8989                        if($debug > 0)
    90                                 print $message;
     90                                print $message ."\n";
    9191                        return null;
    9292                }
    … …  
    9797               
    9898                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;
    100100                        error_log($message);
    101101                        if($debug > 0)
    102                                 print $message;
     102                                print $message ."\n";
    103103                        return null;
    104104                }
  • src/webapp/webservice/inc/GnuBoat/Nmea/NmeaSentence.php

    rfc63b30 r008bce9  
    4848        public function type()
    4949        {
    50                 return $this->_type;
     50                return strtolower($this->_type);
    5151        }
    5252       
Note: See TracChangeset for help on using the changeset viewer.