@squawk/mode-s 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/message.d.ts.map +1 -1
- package/dist/message.js +10 -6
- package/dist/types/message.d.ts +4 -2
- package/dist/types/message.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -34,7 +34,8 @@ import { decodeModeSMessage } from '@squawk/mode-s';
|
|
|
34
34
|
|
|
35
35
|
const decoded = decodeModeSMessage(rawMessageBytes); // 7 or 14 raw bytes
|
|
36
36
|
if (decoded?.kind === 'extendedSquitterPosition') {
|
|
37
|
-
console.log(decoded.icaoHex, decoded.latCpr, decoded.lonCpr
|
|
37
|
+
console.log(decoded.icaoHex, decoded.latCpr, decoded.lonCpr);
|
|
38
|
+
console.log(decoded.baroAltitudeFt, decoded.geoAltitudeFt); // exactly one is populated, or neither for a type-code-0 no-fix / surface message
|
|
38
39
|
}
|
|
39
40
|
```
|
|
40
41
|
|
|
@@ -95,7 +96,8 @@ position to resolve the correct hemisphere and longitude quadrant.
|
|
|
95
96
|
|
|
96
97
|
An airborne position message with type code 0 signals that no position fix
|
|
97
98
|
is currently available - `latCpr`/`lonCpr` are undefined in that case even
|
|
98
|
-
though `
|
|
99
|
+
though `baroAltitudeFt` may still be populated (type code 0 shares its
|
|
100
|
+
altitude field layout with the barometric type codes 9-18, never GNSS-height).
|
|
99
101
|
|
|
100
102
|
### ACAS / TCAS Resolution Advisories
|
|
101
103
|
|
package/dist/message.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../src/message.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,mBAAmB,EAGpB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../src/message.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,mBAAmB,EAGpB,MAAM,kBAAkB,CAAC;AAuN1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,mBAAmB,GAAG,SAAS,CAqFrF"}
|
package/dist/message.js
CHANGED
|
@@ -84,7 +84,8 @@ function decodePositionMessage(me, icaoHex, messageSource, hasPosition, category
|
|
|
84
84
|
const cprFormat = extractBits(me, 21, 1) === 1 ? 'odd' : 'even';
|
|
85
85
|
const latCpr = hasPosition ? extractBits(me, 22, 17) : undefined;
|
|
86
86
|
const lonCpr = hasPosition ? extractBits(me, 39, 17) : undefined;
|
|
87
|
-
let
|
|
87
|
+
let baroAltitudeFt;
|
|
88
|
+
let geoAltitudeFt;
|
|
88
89
|
let groundSpeedKt;
|
|
89
90
|
let trueTrackDeg;
|
|
90
91
|
if (isSurface) {
|
|
@@ -99,10 +100,12 @@ function decodePositionMessage(me, icaoHex, messageSource, hasPosition, category
|
|
|
99
100
|
}
|
|
100
101
|
else {
|
|
101
102
|
const altitudeField = extractBits(me, 8, 12);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
if (category === 'airborneBaroPosition') {
|
|
104
|
+
baroAltitudeFt = decodeAdsbPositionAltitude(altitudeField);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
geoAltitudeFt = decodeAdsbGnssAltitude(altitudeField);
|
|
108
|
+
}
|
|
106
109
|
}
|
|
107
110
|
return {
|
|
108
111
|
kind: 'extendedSquitterPosition',
|
|
@@ -112,7 +115,8 @@ function decodePositionMessage(me, icaoHex, messageSource, hasPosition, category
|
|
|
112
115
|
cprFormat,
|
|
113
116
|
latCpr,
|
|
114
117
|
lonCpr,
|
|
115
|
-
|
|
118
|
+
baroAltitudeFt,
|
|
119
|
+
geoAltitudeFt,
|
|
116
120
|
groundSpeedKt,
|
|
117
121
|
trueTrackDeg,
|
|
118
122
|
};
|
package/dist/types/message.d.ts
CHANGED
|
@@ -47,8 +47,10 @@ export interface ExtendedSquitterPosition extends ExtendedSquitterCommon {
|
|
|
47
47
|
latCpr: number | undefined;
|
|
48
48
|
/** Raw 17-bit CPR-encoded longitude field, or undefined for a type-code-0 airborne position message (no position information available - altitude may still be valid). */
|
|
49
49
|
lonCpr: number | undefined;
|
|
50
|
-
/**
|
|
51
|
-
|
|
50
|
+
/** Barometric altitude in feet, decoded from a type-code 9-18 (or type-code-0, no-fix) airborne position message. Always undefined for a surface position and for a type-code 20-22 GNSS-height position message (see `geoAltitudeFt`). */
|
|
51
|
+
baroAltitudeFt: number | undefined;
|
|
52
|
+
/** Geometric (GNSS-height) altitude in feet, decoded from a type-code 20-22 airborne position message. Always undefined for a surface position and for any barometric (type-code 9-18 or 0) position message (see `baroAltitudeFt`). */
|
|
53
|
+
geoAltitudeFt: number | undefined;
|
|
52
54
|
/** Ground speed in knots, decoded from the movement field. Always undefined for an airborne position - airborne messages carry altitude in the same bits instead. */
|
|
53
55
|
groundSpeedKt: number | undefined;
|
|
54
56
|
/** Track over ground in degrees true. Always undefined for an airborne position, and for a surface position whose track status bit is unset (no valid track available). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/types/message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;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ACH,MAAM,WAAW,yBAAyB;IACxC,sFAAsF;IACtF,IAAI,EAAE,2BAA2B,CAAC;IAClC,yHAAyH;IACzH,gBAAgB,EAAE,MAAM,CAAC;IACzB,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC,iFAAiF;IACjF,IAAI,EAAE,oBAAoB,CAAC;IAC3B,yHAAyH;IACzH,gBAAgB,EAAE,MAAM,CAAC;IACzB,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,yIAAyI;IACzI,cAAc,EAAE,aAAa,EAAE,CAAC;CACjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,+BAAgC,SAAQ,sBAAsB;IAC7E,+GAA+G;IAC/G,IAAI,EAAE,iCAAiC,CAAC;IACxC,6CAA6C;IAC7C,cAAc,EAAE,cAAc,CAAC;IAC/B,oKAAoK;IACpK,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,+BAAgC,SAAQ,sBAAsB;IAC7E,gHAAgH;IAChH,IAAI,EAAE,iCAAiC,CAAC;IACxC,6CAA6C;IAC7C,kBAAkB,EAAE,4BAA4B,CAAC;CAClD;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAC3B,wBAAwB,GACxB,wBAAwB,GACxB,8BAA8B,GAC9B,oCAAoC,GACpC,iCAAiC,GACjC,+BAA+B,GAC/B,+BAA+B,GAC/B,YAAY,GACZ,4BAA4B,GAC5B,2BAA2B,GAC3B,yBAAyB,GACzB,kBAAkB,GAClB,yBAAyB,GACzB,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squawk/mode-s",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Decode raw Mode-S/ADS-B messages: DF/CRC parsing, CPR position, velocity, identification, and altitude",
|
|
6
6
|
"author": "Neil Cochran",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@squawk/types": "^0.8.6"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@types/node": "^
|
|
47
|
+
"@types/node": "^26.4.0"
|
|
48
48
|
},
|
|
49
49
|
"keywords": [
|
|
50
50
|
"aviation",
|