Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Electric Imp imp API GNSS example code: get NMEA sentences
// Get GSV (satellites in view) NMEA sentences from modem
// NOTE #1 See https://gpsd.gitlab.io/gpsd/NMEA.html#_nmea_standard_sentences
// for sentence details
// NOTE #2 Assumes you have an existing configured and enabled gnss-session
// instance, as per https://developer.electricimp.com/api/gnss-session/enable
// Callback to process read sentences
function processSentences(result) {
if (result.status == 0) {
// No error, so just output each received sentence,
// but could parse them here too
foreach (sentence in data.nmea) {
server.log(sentence);
}
} else {
// Error
server.error("Error getting NMEA sentence(s)");
}
}
// Reasd GSV (satellites in view) NMEA sentences from modem
gnssSession.readnmea(processSentences, "GSV");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment