NMEAParser
Documentation for NMEAParser.
NMEAParser.ACC
NMEAParser.DTM
NMEAParser.GBS
NMEAParser.GGA
NMEAParser.GLL
NMEAParser.GSA
NMEAParser.GST
NMEAParser.GSV
NMEAParser.GYR
NMEAParser.NMEAData
NMEAParser.PASHR
NMEAParser.RMC
NMEAParser.VTG
NMEAParser.WHPR
NMEAParser.WPLS
NMEAParser.WPOS
NMEAParser.WVCT
NMEAParser.WWHE
NMEAParser.ZDA
NMEAParser._dms_to_dd
NMEAParser._hms_to_secs
NMEAParser._to_float
NMEAParser._to_int
NMEAParser.get_system
NMEAParser.is_string_supported
NMEAParser.nmea_parse
NMEAParser.parse_msg!
NMEAParser.pop!
NMEAParser.pos_convert
NMEAParser.update
NMEAParser.update!
NMEAParser.vel_convert
NMEAParser.@do_parse
NMEAParser.ACC
— Typestruct ACC <: NMEAString
IMU Accelerometer (ACC)
This NMEA data type represents inertial measurement unit (IMU) accelerometer information.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).time::Float64
: Time in seconds.x::Float64
: Acceleration in the X-axis.y::Float64
: Acceleration in the Y-axis.z::Float64
: Acceleration in the Z-axis.valid::Bool
: Flag indicating the validity of the data.
Constructor
ACC(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = ACC(["ACC", "123456", "0.5", "1.0", "-0.2"])
NMEAParser.DTM
— Typestruct DTM <: NMEAString
Datum Reference (DTM)
This NMEA data type represents information about a datum reference.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).local_datum_code::String
: Local datum code.local_datum_subcode::String
: Local datum subcode.lat_offset::Float64
: Latitude offset in meters.long_offset::Float64
: Longitude offset in meters.alt_offset::Float64
: Altitude offset in meters.ref_datum::String
: Reference datum.valid::Bool
: Flag indicating the validity of the data.
Constructor
DTM(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = DTM(["DTM", "W84", "W", "0.5", "W", "1.0", "M", "W84"])
NMEAParser.GBS
— Typestruct GBS <: NMEAString
GNSS Satellite Fault Detection (GBS)
This NMEA data type represents information about satellite fault detection, including error estimates and probabilities.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).time::Float64
: Time in seconds.lat_error::Float64
: Latitude error estimate.long_error::Float64
: Longitude error estimate.alt_error::Float64
: Altitude error estimate.failed_PRN::Int
: PRN of the failed satellite.prob_of_missed::Float64
: Probability of missed detection.excluded_meas_err::Float64
: Excluded measurement error.standard_deviation::Float64
: Standard deviation of the measurements.valid::Bool
: Flag indicating the validity of the data.
Constructor
GBS(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = GBS(["GBS", "123456", "0.1", "0.2", "0.3", "5", "0.01", "0.05", "0.02"])
NMEAParser.GGA
— Typestruct GGA <: NMEAString
GPS Fix Data (GGA)
This NMEA data type represents information about the GPS fix, including latitude, longitude, altitude, number of satellites, and accuracy measures.
Fields
system::String
: GPS, GLONASS, GALILEO, or Combined.time::Float64
: Time in seconds.latitude::Float64
: Latitude in decimal degrees.longitude::Float64
: Longitude in decimal degrees.fix_quality::String
: Quality of the fix.num_sats::Int
: Number of satellites used in the fix.HDOP::Float64
: Horizontal Dilution of Precision.altitude::Float64
: Altitude above mean sea level (MSL) in meters.geoidal_separation::Float64
: Geoidal separation in meters.age_of_differential::Float64
: Age of the differential data.diff_reference_id::Int
: Differential reference station ID.valid::Bool
: Flag indicating the validity of the data.
Constructor
GGA(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = GGA(["GGA", "123456", "123.456", "N", "987.654", "W", "1", "8", "0.9", "123.4", "M", "54.3", "M", "1"])
NMEAParser.GLL
— Typestruct GLL <: NMEAString
Geographic Latitude and Longitude (GLL)
This NMEA data type represents information about geographic latitude and longitude.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).latitude::Float64
: Latitude in decimal degrees.longitude::Float64
: Longitude in decimal degrees.time::Float64
: Time in seconds.status::Bool
: Status indicator (true if valid fix, false otherwise).mode::Char
: Mode indicator ('A' for autonomous mode).valid::Bool
: Flag indicating the validity of the data.
Constructor
GLL(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = GLL(["GLL", "12.3456", "N", "98.7654", "W", "123456", "A"])
NMEAParser.GSA
— Typestruct GSA <: NMEAString
GNSS DOP and Active Satellites (GSA)
This NMEA data type represents information about the GNSS Dilution of Precision (DOP) and the active satellites used for navigation.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).mode::Char
: Mode of operation (A = Automatic, M = Manual).current_mode::Int
: Operating mode (1 = Fix not available, 2 = 2D fix, 3 = 3D fix).sat_ids::Vector{Int}
: Vector of satellite IDs used in the fix.PDOP::Float64
: Position Dilution of Precision.HDOP::Float64
: Horizontal Dilution of Precision.VDOP::Float64
: Vertical Dilution of Precision.valid::Bool
: Flag indicating the validity of the data.
Constructor
GSA(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = GSA(["GSA", "M", "3", "1", "2", "3", "1.2", "0.9", "1.5"])
NMEAParser.GST
— Typestruct GST <: NMEAString
Position error statistics.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).time::Float64
: Time in seconds.rms::Float64
: RMS value of the pseudorange residuals; includes carrier phase residuals during periods of RTK (float) and RTK (fixed) processingsemi_major_error::Float64
: Error ellipse semi-major axis 1-sigma error, in meterssemi_minor_error::Float64
: Error ellipse semi-minor axis 1-sigma error, in metersorientation_error::Float64
: Error ellipse orientation, degrees from true northlatitude_error::Float64
: Latitude 1-sigma error, in meterslongitude_error::Float64
: Longitude 1-sigma error, in metersheight_error::Float64
: Height 1-sigma error, in metersvalid::Bool
: Flag indicating the validity of the data.
Example String: GPGST,172814.0,0.006,0.023,0.020,273.6,0.023,0.020,0.031*6A
NMEAParser.GSV
— Typestruct GSV <: NMEAString
Satellites in View (GSV)
This NMEA data type represents information about the satellites in view and their signal strength.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).msg_total::Int
: Total number of GSV messages for this cycle.msg_num::Int
: Number of this GSV message.sat_total::Int
: Total number of satellites in view.SV_data::Vector{SVData}
: Vector of satellite data, each containing PRN, elevation, azimuth, and SNR.valid::Bool
: Flag indicating the validity of the data.
Constructor
GSV(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = GSV(["GSV", "3", "1", "9", "1", "01", "30", "45", "20", "02", "60", "180", "25", "03", "15", "300", "15"])
NMEAParser.GYR
— Typestruct GYR <: NMEAString
IMU Gyroscope (GYR)
This NMEA data type represents inertial measurement unit (IMU) gyroscope information.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).time::Float64
: Time in seconds.x::Float64
: Angular velocity around the X-axis.y::Float64
: Angular velocity around the Y-axis.z::Float64
: Angular velocity around the Z-axis.valid::Bool
: Flag indicating the validity of the data.
Constructor
GYR(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = GYR(["GYR", "123456", "0.1", "-0.2", "0.5"])
NMEAParser.NMEAData
— TypeNMEAData()
A mutable struct that stores the last parsed NMEA messages of different types.
Fields
last_GGA::Union{Nothing, GGA}
: the last GGA message parsed, or nothing if nonelast_RMC::Union{Nothing, RMC}
: the last RMC message parsed, or nothing if nonelast_GSA::Union{Nothing, GSA}
: the last GSA message parsed, or nothing if nonelast_GSV::Union{Nothing, GSV}
: the last GSV message parsed, or nothing if nonelast_GST::Union{Nothing, GST}
: the last GST message parsed, or nothing if nonelast_GBS::Union{Nothing, GBS}
: the last GBS message parsed, or nothing if nonelast_VTG::Union{Nothing, VTG}
: the last VTG message parsed, or nothing if nonelast_GLL::Union{Nothing, GLL}
: the last GLL message parsed, or nothing if nonelast_ZDA::Union{Nothing, ZDA}
: the last ZDA message parsed, or nothing if nonelast_DTM::Union{Nothing, DTM}
: the last DTM message parsed, or nothing if none
NMEAParser.PASHR
— Typestruct PASHR <: NMEAString
Inertial Attitude Data (PASHR)
This NMEA data type represents inertial attitude data, including heading, roll, pitch, and heave.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).time::Float64
: Time in seconds.heading::Float64
: Heading in decimal degrees.heading_type::Bool
: True heading indicator (true if heading is relative to true north).roll::Float64
: Roll in decimal degrees.pitch::Float64
: Pitch in decimal degrees.heave::Float64
: Heave in meters.roll_accuracy::Float64
: Roll accuracy (standard deviation in decimal degrees).pitch_accuracy::Float64
: Pitch accuracy (standard deviation in decimal degrees).heading_accuracy::Float64
: Heading accuracy (standard deviation in decimal degrees).aiding_code::Int
: GPS Update Quality Flag (0 = No position, 1 = Non-RTK fixed, 2 = RTK fixed).ins_code::Int
: INS Status Flag (0 = Pre-Alignment, 1 = Post-Alignment).valid::Bool
: Flag indicating the validity of the data.
Constructor
PASHR(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = PASHR(["PASHR", "123456", "45.0", "T", "15.0", "-10.0", "2.0", "0.1", "0.1", "0.2", "2", "1"])
NMEAParser.RMC
— Typestruct RMC <: NMEAString
Recommended Minimum Navigation Information (RMC)
This NMEA data type represents recommended minimum navigation information.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).time::Float64
: Time in seconds of position fix.status::Bool
: Status indicator (true if active, false otherwise/void).latitude::Float64
: Latitude in decimal degrees.longitude::Float64
: Longitude in decimal degrees.sog::Float64
: Speed over ground in knots.cog::Float64
: track angle over ground in degrees.date::Date
: Day of the month.month::String
: Month of the year.year::String
: Year.magvar::Float64
: Magnetic variation.mode::Char
: Position system mode indicator (D=differential,A=autonomous,N=not valid,E=estimated/dead reckoning, M=manual input).navstatus::Char
: Navigational status. (S = Safe, C = Caution, U = Unsafe, V = Navigational status not valid).valid::Bool
: Flag indicating the validity of the data.
Constructor
RMC(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
nmeastr = "$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A"
data = RMC(["RMC", "123519", "A", "4807.038", "N", "01131.000", "E", "022.4", "084.4", "230394", "003.1", "W"], "GPS", true)
altstr = "$GNRMC,060512.00,A,3150.788156,N,11711.922383,E,0.0,,311019,,,A,V*1B"
NMEAParser.VTG
— Typestruct VTG <: NMEAString
Track Made Good and Ground Speed (VTG)
This NMEA data type represents information about the track made good (course) and ground speed.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).CoG_true::Float64
: Course over ground in true degrees.CoG_mag::Float64
: Course over ground in magnetic degrees.SoG_knots::Float64
: Speed over ground in knots.SoG_kmhr::Float64
: Speed over ground in kilometers per hour.mode::Char
: Mode indicator ('A' for autonomous mode).valid::Bool
: Flag indicating the validity of the data.
Constructor
VTG(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = VTG(["VTG", "90.0", "T", "45.0", "M", "5.0", "K", "A"])
NMEAParser.WHPR
— Typestruct WHPR <: NMEAString
IMU Heading Pitch Roll (WHPR)
This NMEA data type represents inertial measurement unit (IMU) information, including heading, pitch, and roll.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).time::Float64
: Time in seconds.heading::Float64
: Heading in degrees.pitch::Float64
: Pitch in degrees.roll::Float64
: Roll in degrees.valid::Bool
: Flag indicating the validity of the data.
Constructor
WHPR(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = WHPR(["WHPR", "123456", "90.0", "30.0", "-45.0"])
NMEAParser.WPLS
— Typestruct WPLS <: NMEAString
Position in Pulses (WPLS)
This NMEA data type represents position information in pulses.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).time::Float64
: Time in seconds.x::Float64
: X position in pulses.y::Float64
: Y position in pulses.heading::Float64
: Heading in degrees.valid::Bool
: Flag indicating the validity of the data.
Constructor
WPLS(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = WPLS(["WPLS", "123456", "500", "P", "750", "P", "90.0", "D"])
NMEAParser.WPOS
— Typestruct WPOS <: NMEAString
Position (WPOS)
This NMEA data type represents position information.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).time::Float64
: Time in seconds.xpose::Float64
: X position in meters.ypose::Float64
: Y position in meters.zpose::Float64
: Z position in meters.distance::Float64
: Distance in meters.velocity::Float64
: Velocity in kilometers per hour.direction::Char
: Direction indicator ('F' for forward, 'B' for backward).valid::Bool
: Flag indicating the validity of the data.
Constructor
WPOS(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = WPOS(["WPOS", "123456", "45.678", "M", "123.456", "M", "789.012", "M", "456.789", "M", "5.0", "K", "F"])
NMEAParser.WVCT
— Typestruct WVCT <: NMEAString
Movement Vector (WVCT)
This NMEA data type represents movement vector information.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).time::Float64
: Time in seconds.distance_derivative::Float64
: Distance derivative in meters.heading::Float64
: Heading in radians.distance::Float64
: Distance in meters.speed::Float64
: Speed in meters per second.valid::Bool
: Flag indicating the validity of the data.
Constructor
WVCT(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = WVCT(["WVCT", "123456", "2.0", "M", "1.5708", "R", "5.0", "MPS"])
NMEAParser.WWHE
— Typestruct WWHE <: NMEAString
Wheels Information (WWHE)
This NMEA data type represents wheels information.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).time::Float64
: Time in seconds.lw_pulses::Float64
: Left wheel pulses.lw_distance::Float64
: Left wheel distance in meters.lw_direction::Char
: Left wheel direction indicator ('F' for forward, 'B' for backward).rw_pulses::Float64
: Right wheel pulses.rw_distance::Float64
: Right wheel distance in meters.rw_direction::Char
: Right wheel direction indicator ('F' for forward, 'B' for backward).heading::Float64
: Heading.valid::Bool
: Flag indicating the validity of the data.
Constructor
WWHE(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = WWHE(["WWHE", "123456", "500", "100.0", "M", "F", "750", "150.0", "M", "B", "90.0"])
NMEAParser.ZDA
— Typestruct ZDA <: NMEAString
Time and Date (ZDA)
This NMEA data type represents information about the current time and date from a GNSS receiver.
Fields
system::String
: GNSS system identifier (e.g., GPS, GLONASS, GALILEO, Combined).time::Float64
: Time in seconds.day::Int
: Day of the month.month::Int
: Month of the year.year::Int
: Year.zone_hrs::Int
: Time zone offset in hours.zone_mins::Int
: Time zone offset in minutes.valid::Bool
: Flag indicating the validity of the data.
Constructor
ZDA(items::Array{D}; system::AbstractString = "UNKNOWN", valid = true) where D <: SubString
Examples
data = ZDA(["ZDA", "123456", "15", "02", "2024", "5", "30"])
NMEAParser._dms_to_dd
— Method_dms_to_dd(dms, hemi)
Converts a string representing degrees, minutes and seconds (DMS) to decimal degrees.
Arguments
dms
: a substring representing degrees, minutes and secondshemi
: a substring representing the hemisphere
Returns
dec_degrees
: the decimal degree representation of the input DMS
Example
dms = "4807.038"
hemi = "N"
dec_degrees = _dms_to_dd(dms, hemi)
NMEAParser._hms_to_secs
— Method_hms_to_secs(hms)
Converts a string representing hours, minutes and seconds (HMS) to seconds.
Arguments
hms
: a substring representing hours, minutes and seconds
Returns
seconds
: the number of seconds represented by the input HMS
Example
hms = "123519"
seconds = _hms_to_secs(hms)
NMEAParser._to_float
— Methodtofloat(item) Converts a string representing an float to a Float64, if parse fails it defaults to 0.0.
NMEAParser._to_int
— Method_to_int(item)
Converts a string representing an integer to a Int, if parse fails it defaults to 0.
NMEAParser.get_system
— Methodget_system(mtype::SubString)
Determine the system type based on the input mtype
.
Arguments
mtype
: ASubString
representing the message type.
Returns
- A string representing the system type. Possible values are
"GPS"
,"GLONASS"
,"GALILEO"
,"COMBINED"
, and"UNKNOWN"
.
Examples
get_system("$GPGGA") # "GPS"
get_system("$GLGSV") # "GLONASS"
get_system("$GAGGA") # "GALILEO"
get_system("$GNGNS") # "COMBINED"
get_system("$PMTK") # "UNKNOWN"
TODO: update get_system
to cover all common system types AI = Alarm Indicator, (AIS?) AP = Auto Pilot (pypilot?) BD = BeiDou (China) CD = Digital Selective Calling (DSC) EC = Electronic Chart Display & Information System (ECDIS) GA = Galileo Positioning System GB = BeiDou (China) GI = NavIC, IRNSS (India) GL = GLONASS, according to IEIC 61162-1 GN = Combination of multiple satellite systems (NMEA 1083) GP = Global Positioning System receiver GQ = QZSS regional GPS augmentation system (Japan) HC = Heading/Compass HE = Gyro, north seeking II = Integrated Instrumentation IN = Integrated Navigation LC = Loran-C receiver (obsolete) Pxxx = Proprietary (Vendor specific) PQ = QZSS (Quectel Quirk) QZ = QZSS regional GPS augmentation system (Japan) SD = Depth Sounder ST = Skytraq TI = Turn Indicator YX = Transducer WI = Weather Instrument
NMEAParser.is_string_supported
— Methodis_string_supported(nmea_string::AbstractString)
Check if the input NMEA string type is supported.
Arguments
nmea_string::AbstractString
: The NMEA string to be checked.
Returns
Bool
:true
if the NMEA string is supported,false
otherwise.
Example
julia> is_string_supported("$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47")
true
NMEAParser.nmea_parse
— Methodnmea_parse(nmea_string::AbstractString; validate_checksum=true)
Parse an NMEA string and generate the corresponding NMEA type.
This function takes an NMEA sentence as input, validates the checksum if validate_checksum
is set to true
, and then parses the sentence based on the predefined headers and types in NMEA_TYPES
.
Arguments
nmea_string::AbstractString
: The NMEA sentence to parse.validate_checksum::Bool
: Flag to indicate whether to validate the checksum (default istrue
).
Returns
- An instance of the appropriate NMEA type.
Examples
result = nmea_parse("$GGA,123456,123.456,N,987.654,W,1,8,0.9,123.4,M,54.3,M,1,")
NMEAParser.parse_msg!
— Methodparse_msg!(s::NMEAData, line::AbstractString)
Parse a line of NMEA 0183 data and update the state of an NMEAData object.
Arguments
s : NMEAData An object that stores the parsed data from NMEA messages. line : AbstractString A string that contains a valid NMEA 0183 message.
Returns
DataType The type of the parsed message, or Nothing if the message is not supported.
Errors
ArgumentError If the line is not a valid NMEA 0183 message.
Example
s = NMEAData()
julia> d = [ "$GPRMC,154925.820,A,5209.732,N,00600.240,E,001.9,059.8,040123,000.0,W*7E",
"$GPGGA,154925.920,5209.732,N,00600.240,E,1,12,1.0,0.0,M,0.0,M,,*63",
"$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30",
"$GPRMC,154925.920,A,5209.732,N,00600.240,E,001.9,059.8,040123,000.0,W*7F"]
4-element Vector{String}:
"$GPRMC,154925.820,A,5209.732,N,00600.240,E,001.9,059.8,040123,000.0,W*7E"
"$GPGGA,154925.920,5209.732,N,00600.240,E,1,12,1.0,0.0,M,0.0,M,,*63"
"$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30"
"$GPRMC,154925.920,A,5209.732,N,00600.240,E,001.9,059.8,040123,000.0,W*7F"
julia> for str in d
msg_type = parse_msg!(s, str)
println(msg_type)
end
RMC
GGA
GSA
RMC
julia> s.last_RMC
RMC("GPS", 56965.92, true, 52.1622, 6.004, 1.9, 59.8, "04", "01", "23", -0.0, 'A', true)
julia> s.last_GGA
GGA("GPS", 56965.92, 52.1622, 6.004, "GPS (SPS)", 12, 1.0, 0.0, 0.0, 0.0, 0, true)
NMEAParser.pop!
— Methodpop!(nmea_data::NMEAData, ::Type{T}) where T <: NMEAString
Pop the last received message of type T from the NMEAData object nmea_data and return it. If no message of type T has been received, throw an MissingException. This function extends the Base.pop! function for NMEAData objects.
NMEAParser.pos_convert
— Methodpos_convert(flag::Char, value::Float64)::Float64
A function that converts a position value from one unit to another.
Arguments
flag::Char
: The flag that indicates the original unit of the position value. Possible values are 'F' for feet, 'N' for miles, 'K' for kilometers, and 'M' for meters.value::Float64
: The position value to be converted.
Returns
A Float64
that represents the position value in meters.
Errors
Throws an exception if the flag is not one of the supported values.
Algorithm
The function uses a simple formula to convert the position value based on the flag. For example, if the flag is 'F', it divides the value by 0.3048 to get the equivalent value in meters.
NMEAParser.update!
— Methodupdate!(s::NMEAData, msg)
Update the corresponding field of s
with the given NMEA message msg
.
Arguments
s::NMEAData
: the NMEA data struct to be updatedmsg
: an NMEA message of type GGA, RMC, GSA, GSV, GBS, VTG, GLL, ZDA, DTM
NMEAParser.update
— Methodupdate(msg::T, s::NMEAData) where T <: NMEAString
Update the last received message of type T in the NMEAData object s with the given message msg. Return the updated NMEAData object s.
NMEAParser.vel_convert
— Methodvel_convert(flag::Char, value::Float64)::Float64
A function that converts a velocity value from one unit to another.
Arguments
flag::Char
: The flag that indicates the original unit of the velocity value. Possible values are 'N' for knots, 'K' for kilometers per hour, and 'M' for meters per second.value::Float64
: The velocity value to be converted.
Returns
A Float64
that represents the velocity value in meters per second.
Errors
Throws an exception if the flag is not one of the supported values.
Algorithm
The function uses a simple formula to convert the velocity value based on the flag.
NMEAParser.@do_parse
— Macro@do_parse(headers, header_str, items, system, valid)
Macro for parsing NMEA sentences based on predefined headers.
This macro generates code to match the given header_str
against a list of regular expressions provided in the headers
tuple. For each matching header, it generates code to call the corresponding type constructor with the relevant information from the NMEA sentence.
Arguments
headers::Tuple
: A tuple containing pairs of regular expressions and corresponding NMEA types.header_str::AbstractString
: The NMEA sentence header string.items::AbstractString
: The NMEA sentence items.system::AbstractString
: The system identifier.valid::Bool
: A boolean indicating whether the NMEA sentence is valid.
Examples
@do_parse NMEA_TYPES header items system valid