Comparing version 0.4.8 to 0.4.9
{ | ||
"name": "gps", | ||
"main": "gps.js", | ||
"version": "0.4.8", | ||
"version": "0.4.9", | ||
"homepage": "https://github.com/infusion/GPS.js", | ||
@@ -6,0 +6,0 @@ "description": "A GPS NMEA parser library", |
39
gps.js
/** | ||
* @license GPS.js v0.4.8 26/01/2016 | ||
* @license GPS.js v0.4.9 26/01/2016 | ||
* | ||
@@ -182,6 +182,7 @@ * Copyright (c) 2016, Robert Eisele (robert@xarg.org) | ||
function parseGGAFix(fix) { | ||
var int = parseInt(fix, 10); | ||
switch (int || fix) { | ||
case '': | ||
if (fix === '') | ||
return null; | ||
switch (parseInt(fix, 10)) { | ||
case 0: | ||
@@ -321,3 +322,3 @@ return null; | ||
$--GGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh | ||
1) Time (UTC) | ||
@@ -366,4 +367,4 @@ 2) Latitude | ||
eg2. $GPGSA,A,3,19,28,14,18,27,22,31,39,,,,,1.7,1.0,1.3*35 | ||
1 = Mode: | ||
@@ -409,3 +410,3 @@ M=Manual, forced to operate in 2D or 3D | ||
$GPRMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,ddmmyy,x.x,a*hh | ||
RMC = Recommended Minimum Specific GPS/TRANSIT Data | ||
@@ -451,3 +452,3 @@ 1 = UTC of position fix | ||
------------------------------------------------------------------------------ | ||
1 = Track made good (degrees true) | ||
@@ -499,3 +500,3 @@ 2 = Fixed text 'T' indicates that track made good is relative to true north | ||
$GPGSV,1,1,13,02,02,213,,03,-3,000,,11,00,121,,14,13,172,05*67 | ||
1 = Total number of messages of this type in this cycle | ||
@@ -524,6 +525,6 @@ 2 = Message number | ||
by linear map elevation from 0° to 90° into r to 0 | ||
centerX + cos(azimuth - 90) * (1 - elevation / 90) * radius | ||
centerY + sin(azimuth - 90) * (1 - elevation / 90) * radius | ||
*/ | ||
*/ | ||
sats.push({ | ||
@@ -558,3 +559,3 @@ 'prn': prn, | ||
------------------------------------------------------------------------------ | ||
1. Latitude | ||
@@ -627,3 +628,3 @@ 2. N or S (North or South) | ||
// add HDT | ||
'HDT': function (str, hdt) { | ||
'HDT': function(str, hdt) { | ||
@@ -636,12 +637,12 @@ if (hdt.length !== 4) { | ||
------------------------------------------------------------------------------ | ||
1 2 3 | ||
| | | | ||
1 2 3 | ||
| | | | ||
$--HDT,hhh.hhh,T*XX<CR><LF> | ||
------------------------------------------------------------------------------ | ||
1. Heading in degrees | ||
2. T: indicates heading relative to True North | ||
3. Checksum | ||
*/ | ||
*/ | ||
return { | ||
@@ -648,0 +649,0 @@ 'heading': parseFloat(hdt[1]), |
/* | ||
GPS.js v0.4.8 26/01/2016 | ||
GPS.js v0.4.9 26/01/2016 | ||
@@ -8,3 +8,3 @@ Copyright (c) 2016, Robert Eisele (robert@xarg.org) | ||
(function(t){function l(b,a){if(""===b)return null;var d=new Date;if(a){var c=a.slice(4),g=a.slice(2,4)-1,e=a.slice(0,2);4===c.length?d.setUTCFullYear(Number(c),Number(g),Number(e)):d.setUTCFullYear(Number("20"+c),Number(g),Number(e))}d.setUTCHours(Number(b.slice(0,2)));d.setUTCMinutes(Number(b.slice(2,4)));d.setUTCSeconds(Number(b.slice(4,6)));c=b.slice(7);g=c.length;e=0;0!==g&&(e=parseFloat(c)*Math.pow(10,3-g));d.setUTCMilliseconds(Number(e));return d}function k(b,a){if(""===b)return null;var d= | ||
1;switch(a){case "S":d=-1;case "N":var c=2;break;case "W":d=-1;case "E":c=3}return d*(parseFloat(b.slice(0,c))+parseFloat(b.slice(c))/60)}function e(b){return""===b?null:parseFloat(b)}function n(b){return""===b?null:1.852*parseFloat(b)}function u(b){switch(parseInt(b,10)||b){case "":case 0:return null;case 1:return"fix";case 2:return"dgps-fix";case 3:return"pps-fix";case 4:return"rtk";case 5:return"rtk-float";case 6:return"estimated";case 7:return"manual";case 8:return"simulated"}throw Error("INVALID GGA FIX: "+ | ||
1;switch(a){case "S":d=-1;case "N":var c=2;break;case "W":d=-1;case "E":c=3}return d*(parseFloat(b.slice(0,c))+parseFloat(b.slice(c))/60)}function e(b){return""===b?null:parseFloat(b)}function n(b){return""===b?null:1.852*parseFloat(b)}function u(b){if(""===b)return null;switch(parseInt(b,10)){case 0:return null;case 1:return"fix";case 2:return"dgps-fix";case 3:return"pps-fix";case 4:return"rtk";case 5:return"rtk-float";case 6:return"estimated";case 7:return"manual";case 8:return"simulated"}throw Error("INVALID GGA FIX: "+ | ||
b);}function p(b){switch(b){case "A":return"active";case "V":return"void";case "":return null}throw Error("INVALID RMC/GLL STATUS: "+b);}function q(b){switch(b){case "A":return"autonomous";case "D":return"differential";case "E":return"estimated";case "M":return"manual input";case "S":return"simulated";case "N":return"not valid";case "P":return"precise"}throw Error("INVALID FAA MODE: "+b);}function r(b,a){if("M"===a||""===a)return e(b);throw Error("Unknown unit: "+a);}function f(){if(!(this instanceof | ||
@@ -11,0 +11,0 @@ f))return new f;this.events={};this.state={}}var h=Math.PI/180,m=[];f.prototype.events=null;f.prototype.state=null;f.mod={GGA:function(b,a){if(16!==a.length)throw Error("Invalid GGA length: "+b);return{time:l(a[1]),lat:k(a[2],a[3]),lon:k(a[4],a[5]),alt:r(a[9],a[10]),quality:u(a[6]),satellites:e(a[7]),hdop:e(a[8]),geoidal:r(a[11],a[12]),age:e(a[13]),stationID:e(a[14])}},GSA:function(b,a){if(19!==a.length)throw Error("Invalid GSA length: "+b);for(var d=[],c=3;15>c;c++)""!==a[c]&&d.push(parseInt(a[c], |
{ | ||
"name": "gps", | ||
"title": "gps.js", | ||
"version": "0.4.8", | ||
"version": "0.4.9", | ||
"homepage": "https://github.com/infusion/GPS.js", | ||
@@ -27,3 +27,4 @@ "bugs": "https://github.com/infusion/GPS.js/issues", | ||
"author": "Robert Eisele <robert@xarg.org> (http://www.xarg.org/)", | ||
"main": "gps", | ||
"main": "gps.js", | ||
"types": "gps.d.ts", | ||
"private": false, | ||
@@ -30,0 +31,0 @@ "readmeFilename": "README.md", |
@@ -261,2 +261,12 @@ | ||
HDT - Heading | ||
--- | ||
The parsed object will have the following attributes: | ||
- type: "HDT" | ||
- heading: Heading in degrees | ||
- trueNorth: Indicates heading relative to True North | ||
- valid: Indicates if the checksum is okay | ||
GST - Position error statistics | ||
@@ -263,0 +273,0 @@ --- |
@@ -449,3 +449,3 @@ | ||
'lon': -8.8295375, | ||
'time': new Date(today+'T17:48:15.400Z'), | ||
'time': new Date(today + 'T17:48:15.400Z'), | ||
'raw': '$GPGGA,174815.40,4141.46474,N,00849.77225,W,1,08,1.24,11.8,M,50.5,M,,*76', | ||
@@ -466,3 +466,3 @@ 'type': 'GGA', | ||
'lon': -8.8295375, | ||
'time': new Date(today+'T17:48:15.400Z'), | ||
'time': new Date(today + 'T17:48:15.400Z'), | ||
'raw': '$GPGGA,174815.40,4141.46474,N,00849.77225,W,05,08,1.24,11.8,M,50.5,M,,*42', | ||
@@ -473,3 +473,3 @@ 'type': 'GGA', | ||
'$GPGST,172814.0,0.006,0.023,0.020,273.6,0.023,0.020,0.031*6A': { | ||
'time': new Date(today+'T17:28:14.000Z'), | ||
'time': new Date(today + 'T17:28:14.000Z'), | ||
'rms': 0.006, | ||
@@ -487,3 +487,3 @@ 'ellipseMajor': 0.023, | ||
'$GLGST,172814.0,0.006,0.023,0.020,273.6,0.023,0.020,0.031*76': { | ||
'time': new Date(today+'T17:28:14.000Z'), | ||
'time': new Date(today + 'T17:28:14.000Z'), | ||
'rms': 0.006, | ||
@@ -501,3 +501,3 @@ 'ellipseMajor': 0.023, | ||
'$GNGST,172814.0,0.006,0.023,0.020,273.6,0.023,0.020,0.031*74': { | ||
'time': new Date(today+'T17:28:14.000Z'), | ||
'time': new Date(today + 'T17:28:14.000Z'), | ||
'rms': 0.006, | ||
@@ -521,2 +521,17 @@ 'ellipseMajor': 0.023, | ||
'valid': true | ||
}, | ||
'$GPGGA,023920.476,5230.942,N,01323.025,E,0,12,1.0,0.0,M,0.0,M,,*6E': { | ||
"age": null, | ||
"alt": 0, | ||
"geoidal": 0, | ||
"hdop": 1, | ||
"lat": 52.5157, | ||
"lon": 13.38375, | ||
"quality": null, | ||
"raw": "$GPGGA,023920.476,5230.942,N,01323.025,E,0,12,1.0,0.0,M,0.0,M,,*6E", | ||
"satellites": 12, | ||
"stationID": null, | ||
"time": new Date('2019-01-20T02:39:20.476Z'), | ||
"type": "GGA", | ||
"valid": false // false because we manually changed fix to 0 | ||
} | ||
@@ -523,0 +538,0 @@ }; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
370899
26
1800
358