Skip to content

Commit

Permalink
Fixed rawify#25
Browse files Browse the repository at this point in the history
  • Loading branch information
infusion committed Jun 25, 2019
1 parent 7ece2e9 commit eba47ce
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 21 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gps",
"main": "gps.js",
"version": "0.5.2",
"version": "0.5.3",
"homepage": "https://github.com/infusion/GPS.js",
"description": "A GPS NMEA parser library",
"keywords": [
Expand Down
8 changes: 4 additions & 4 deletions gps.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license GPS.js v0.5.2 26/01/2016
* @license GPS.js v0.5.3 26/01/2016
*
* Copyright (c) 2016, Robert Eisele ([email protected])
* Dual licensed under the MIT or GPL Version 2 licenses.
Expand Down Expand Up @@ -310,7 +310,7 @@
// Global Positioning System Fix Data
'GGA': function(str, gga) {

if (gga.length !== 16) {
if (gga.length !== 16 && gga.length !== 14) {
throw new Error('Invalid GGA length: ' + str);
}

Expand Down Expand Up @@ -349,8 +349,8 @@
'satellites': parseNumber(gga[7]),
'hdop': parseNumber(gga[8]), // dilution
'geoidal': parseDist(gga[11], gga[12]), // aboveGeoid
'age': parseNumber(gga[13]), // dgps time since update
'stationID': parseNumber(gga[14]) // dgpsReference??
'age': gga[13] === undefined ? null : parseNumber(gga[13]), // dgps time since update
'stationID': gga[14] === undefined ? null : parseNumber(gga[14]) // dgpsReference??
};
},
// GPS DOP and active satellites
Expand Down
31 changes: 16 additions & 15 deletions gps.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gps",
"title": "gps.js",
"version": "0.5.2",
"version": "0.5.3",
"homepage": "https://www.xarg.org/2016/07/using-gps-with-node-js-and-javascript/",
"bugs": "https://github.com/infusion/GPS.js/issues",
"description": "A GPS NMEA parser library",
Expand Down
45 changes: 45 additions & 0 deletions tests/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,51 @@ var tests = {
"type": "GLL",
"valid": true,
"time": new Date(today + 'T09:00:37.059Z'),
},
'$GPGGA,033016,1227.2470,S,13050.8514,E,2,6,0.9,11.8,M,,M*4A': {
"age": 4,
"alt": 11.8,
"geoidal": null,
"hdop": 0.9,
"lat": -12.454116666666666,
"lon": 130.84752333333333,
"quality": "dgps-fix",
"raw": "$GPGGA,033016,1227.2470,S,13050.8514,E,2,6,0.9,11.8,M,,M*4A",
"satellites": 6,
"stationID": null,
"time": new Date(today + 'T03:30:16.000Z'),
"type": "GGA",
"valid": true
},
'$GPGGA,033631,1227.2473,S,13050.8504,E,2,6,0.9,7.4,M,,M*70': {
"age": 70,
"alt": 7.4,
"geoidal": null,
"hdop": 0.9,
"lat": -12.454121666666667,
"lon": 130.84750666666667,
"quality": "dgps-fix",
"raw": "$GPGGA,033631,1227.2473,S,13050.8504,E,2,6,0.9,7.4,M,,M*70",
"satellites": 6,
"stationID": null,
"time": new Date(today + 'T03:36:31.000Z'),
"type": "GGA",
"valid": true
},
'$GPGGA,034030,1227.2475,S,13050.8528,E,2,6,0.9,8.1,M,,M*72': {
"age": 72,
"alt": 8.1,
"geoidal": null,
"hdop": 0.9,
"lat": -12.454125,
"lon": 130.84754666666666,
"quality": "dgps-fix",
"raw": "$GPGGA,034030,1227.2475,S,13050.8528,E,2,6,0.9,8.1,M,,M*72",
"satellites": 6,
"stationID": null,
"time": new Date(today + 'T03:40:30.000Z'),
"type": "GGA",
"valid": true
}
};
var collect = {};
Expand Down

0 comments on commit eba47ce

Please sign in to comment.