forked from hydroffice/hyo2_soundspeed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Socket receiving NMEA messages. First basic working version of NMEA listener. Removed latitude and longitude parsing from header. Status bar turns red when no nav received. Replaced GUI name NMEA with NMEA-0183 to be more precise. Source of position information (file, listener or manual) is now clearer. Added callback methods for nmea listener.
- Loading branch information
Showing
16 changed files
with
473 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import logging | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class Nmea0183Nav: | ||
|
||
def __init__(self, data): | ||
|
||
self.data = data | ||
#print("data: {}".format(self.data)) | ||
self.msg = None | ||
|
||
self.latitude = None | ||
self.longitude = None | ||
|
||
self.parse() | ||
|
||
def parse(self) -> None: | ||
self.msg = self.data.split(',') | ||
|
||
|
||
|
||
class Nmea0183GGA(Nmea0183Nav): | ||
def __init__(self, data): | ||
super(Nmea0183GGA, self).__init__(data) | ||
|
||
self.timestamp = self.msg[1] | ||
self.lat = self.msg[2] | ||
self.lat_dir = self.msg[3] | ||
self.lon = self.msg[4] | ||
self.lon_dir = self.msg[5] | ||
self.gps_qual = self.msg[6] | ||
self.num_sats = self.msg[7] | ||
self.horizontal_dil = self.msg[8] | ||
self.altitude = self.msg[9] | ||
self.altitude_units = self.msg[10] | ||
self.geo_sep = self.msg[11] | ||
self.geo_sep_units = self.msg[12] | ||
self.age_gps_data = self.msg[13] | ||
self.ref_station_id = self.msg[14] | ||
|
||
self.latitude = int(self.lat[:2]) + float(self.lat[2:])/60. | ||
if self.lat_dir == 'S': | ||
self.latitude = -1.0 * self.latitude | ||
#logger.debug("Latitude is: {}".format(self.latitude)) | ||
|
||
# TODO: self.longitude = some calculation based on self.lon and self.lon_dir | ||
self.longitude = int(self.lon[:3]) + float(self.lon[3:])/60. | ||
if self.lon_dir == 'W': | ||
self.longitude = -1.0 * self.longitude | ||
#logger.debug("Longitude is: {}".format(self.longitude)) | ||
|
||
def __str__(self): | ||
# TODO: for the string representation | ||
pass | ||
|
||
|
||
|
||
class Nmea0183GGL(Nmea0183Nav): | ||
def __init__(self, data): | ||
super(Nmea0183GGL, self).__init__(data) | ||
|
||
self.msg = self.data.split(',') | ||
|
||
self.lat = self.msg[1] | ||
self.lat_dir = self.msg[2] | ||
self.lon = self.msg[3] | ||
self.lon_dir = self.msg[4] | ||
self.timestamp = self.msg[5] | ||
self.status = self.msg[6] | ||
|
||
# TODO: self.latitude = some calculation based on self.lat and self.lat_dir | ||
|
||
# TODO: self.longitude = some calculation based on self.lon and self.lon_dir | ||
|
||
|
||
def __str__(self): | ||
# TODO: for the string representation | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.