NMEAGPS Class
Item Index
Methods
Methods
NMEAGPS
-
uart
-
baudrate
-
enable_pin
NMEAGPS object constructor for a UART
Parameters:
-
uart
NumberSpecify which mraa uart index to use.
-
baudrate
NumberSpecify the baudrate to use. The device defaults to 9600 baud.
-
enable_pin
NumberSpecify the GPIO pin to use for the enable pin, -1 to not use an enable pin.
Returns:
NMEAGPS
-
uart
-
baudrate
NMEAGPS object constructor for a UART
Parameters:
-
uart
Const std::string *Specify which uart to use (fs device path)
-
baudrate
NumberSpecify the baudrate to use. The device defaults to 9600 baud.
Returns:
NMEAGPS
-
bus
-
addr
NMEAGPS object constructor for a UBLOX I2C interface
Parameters:
-
bus
NumberSpecify which the I2C bus to use.
-
addr
NumberSpecify the I2C address to use. For UBLOX devices, this typically defaults to 0x42.
Returns:
readStr
-
size
Read character data from the device.
Parameters:
-
size
NumberThe maximum number of characters to read.
Returns:
string containing the data read.
writeStr
-
buffer
Write character data to the device. This is only valid for a UART device.
Parameters:
-
buffer
Const std::string *The string containing the data to write.
Returns:
The number of bytes written.
enable
-
enable
Enable or disable the device. When disabled, the device enters a low power mode and does not emit NMEA data. It will still maintain location data however.
Parameters:
-
enable
Booleantrue to enable the device, false otherwise.
setBaudrate
-
baudrate
Set the baudrate of the device. By default, the constructor will set the baudrate to 9600. This is only valid for UART devices.
Parameters:
-
baudrate
NumberThe baud rate to set for the device.
dataAvailable
-
millis
Determine whether there is data available to be read. In the case of a UART, this function will wait up to "millis" milliseconds for data to become available. In the case of an I2C device, the millis argument is ignored and the function will return immediately, indicating whether data is available.
Parameters:
-
millis
NumberThe number of milliseconds to wait for data to become available.
Returns:
true if data is available to be read, false otherwise.
getMaxQueueDepth
()
Number
Return the current maximum queue depth.
Returns:
Maximum queue depth
setMaxQueueDepth
-
depth
Set the current maximum queue depth.
Parameters:
-
depth
NumberNew target queue depth 1 <= depth <= 1000
Returns:
Actual maximum queue depth
parseStart
()
Start a NMEA parsing thread for reading/parsing NMEA sentences. The thread calls the readStr method, parsing NMEA sentences as they are encountered. Each sentence type is pushed into a corresponding queue of size
parseStop
()
Stop a running NMEA parsing thread
isRunning
()
Boolean
Is the parsing thread currently running?
Returns:
True if parsing
getFix
()
Gps_fix
Pop and return a GPS fix structure from the GPS fix queue. A GPS fix should only be used if valid is true.
Returns:
GPS fix structure
getRawSentence
()
String
Pop and return a raw NMEA sentence from the NMEA sentence queue. If the queue contains no elements, an empty string is returned
Returns:
NMEA raw sentence
getTxtMessage
()
Nmeatxt
Pop and return a message from the message queue (GPTXT sentences) If the queue contains no elements, an empty string is returned
Returns:
NMEA text message
fixQueueSize
()
Number
Get the number of elements in the GPS fix queue.
Returns:
Number of fixes in the GPS fix queue
rawSentenceQueueSize
()
Number
Get the number of elements in the NMEA raw sentence queue.
Returns:
Number of sentences in the raw NMEA sentence queue
txtMessageQueueSize
()
Number
Get the number of messages in the NMEA message queue.
Returns:
Number of messages in the message queue
parseNMEASentence
-
sentence
Parse NMEA sentences. Raw sentence is placed into sentence queue. Additional structures are parsed depending on sentence type
Parameters:
-
sentence
Const std::string *NMEA raw sentence ($...
) inclusive
satellites
()
Std::vector satellite
Return a vector of the current satellites
Returns:
Current satellites
sentencesPerSecond
()
Number
Get the number of sentences parsed per second
Returns:
Sentences parsed per second
bytesPerSecond
()
Number
Get the throughput of the device. This number shows a rough data-rate as well as provides a bit of debug since it will show bps even if sentences are not getting parsed correctly.
Returns:
Total bytes read from the device/second (bps)
__str__
()
String
Provide a string representation of this class
Returns:
String representing this instance