@airframes/acars-decoder 1.4.7 → 1.6.1
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 +40 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.js +2869 -19
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2832 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +15 -18
- package/.github/FUNDING.yml +0 -12
- package/.github/workflows/yarn-test.yml +0 -21
- package/SECURITY.md +0 -18
- package/babel.config.js +0 -6
- package/coverage/clover.xml +0 -1799
- package/coverage/coverage-final.json +0 -24
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -131
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -2278
- package/dist/DateTimeUtils.d.ts +0 -8
- package/dist/DateTimeUtils.js +0 -27
- package/dist/DecoderPlugin.d.ts +0 -18
- package/dist/DecoderPlugin.js +0 -71
- package/dist/DecoderPluginInterface.d.ts +0 -7
- package/dist/DecoderPluginInterface.js +0 -3
- package/dist/IcaoDecoder.d.ts +0 -10
- package/dist/IcaoDecoder.js +0 -111
- package/dist/MessageDecoder.d.ts +0 -14
- package/dist/MessageDecoder.js +0 -129
- package/dist/bin/acars-decoder-test.d.ts +0 -2
- package/dist/bin/acars-decoder-test.js +0 -53
- package/dist/bin/acars-decoder.d.ts +0 -2
- package/dist/bin/acars-decoder.js +0 -20
- package/dist/plugins/Label_15.d.ts +0 -11
- package/dist/plugins/Label_15.js +0 -40
- package/dist/plugins/Label_16_N_Space.d.ts +0 -11
- package/dist/plugins/Label_16_N_Space.js +0 -80
- package/dist/plugins/Label_16_N_Space.test.d.ts +0 -1
- package/dist/plugins/Label_16_N_Space.test.js +0 -84
- package/dist/plugins/Label_1M_Slash.d.ts +0 -11
- package/dist/plugins/Label_1M_Slash.js +0 -61
- package/dist/plugins/Label_1M_Slash.test.d.ts +0 -1
- package/dist/plugins/Label_1M_Slash.test.js +0 -43
- package/dist/plugins/Label_20_CFB.01.d.ts +0 -11
- package/dist/plugins/Label_20_CFB.01.js +0 -69
- package/dist/plugins/Label_20_POS.d.ts +0 -11
- package/dist/plugins/Label_20_POS.js +0 -62
- package/dist/plugins/Label_30_Slash_EA.d.ts +0 -11
- package/dist/plugins/Label_30_Slash_EA.js +0 -54
- package/dist/plugins/Label_30_Slash_EA.test.d.ts +0 -1
- package/dist/plugins/Label_30_Slash_EA.test.js +0 -35
- package/dist/plugins/Label_44_ETA.d.ts +0 -11
- package/dist/plugins/Label_44_ETA.js +0 -69
- package/dist/plugins/Label_44_IN.d.ts +0 -11
- package/dist/plugins/Label_44_IN.js +0 -69
- package/dist/plugins/Label_44_OFF.d.ts +0 -11
- package/dist/plugins/Label_44_OFF.js +0 -74
- package/dist/plugins/Label_44_ON.d.ts +0 -11
- package/dist/plugins/Label_44_ON.js +0 -69
- package/dist/plugins/Label_44_POS.d.ts +0 -11
- package/dist/plugins/Label_44_POS.js +0 -81
- package/dist/plugins/Label_5Z.d.ts +0 -11
- package/dist/plugins/Label_5Z.js +0 -120
- package/dist/plugins/Label_80.d.ts +0 -12
- package/dist/plugins/Label_80.js +0 -203
- package/dist/plugins/Label_8E.d.ts +0 -10
- package/dist/plugins/Label_8E.js +0 -48
- package/dist/plugins/Label_8E.test.d.ts +0 -1
- package/dist/plugins/Label_8E.test.js +0 -32
- package/dist/plugins/Label_B6.d.ts +0 -11
- package/dist/plugins/Label_B6.js +0 -26
- package/dist/plugins/Label_ColonComma.d.ts +0 -10
- package/dist/plugins/Label_ColonComma.js +0 -28
- package/dist/plugins/Label_H1.d.ts +0 -9
- package/dist/plugins/Label_H1.js +0 -18
- package/dist/plugins/Label_H1_M1BPOS.d.ts +0 -11
- package/dist/plugins/Label_H1_M1BPOS.js +0 -54
- package/dist/plugins/Label_H1_M1BPRG.d.ts +0 -11
- package/dist/plugins/Label_H1_M1BPRG.js +0 -36
- package/dist/plugins/Label_QP.d.ts +0 -10
- package/dist/plugins/Label_QP.js +0 -49
- package/dist/plugins/Label_QQ.d.ts +0 -10
- package/dist/plugins/Label_QQ.js +0 -49
- package/dist/plugins/Label_QR.d.ts +0 -10
- package/dist/plugins/Label_QR.js +0 -49
- package/dist/plugins/Label_QS.d.ts +0 -10
- package/dist/plugins/Label_QS.js +0 -49
- package/dist/plugins/Label_SQ.d.ts +0 -10
- package/dist/plugins/Label_SQ.js +0 -104
- package/dist/plugins/official.d.ts +0 -22
- package/dist/plugins/official.js +0 -38
- package/jest.config.ts +0 -195
- package/src/DateTimeUtils.ts +0 -26
- package/src/DecoderPlugin.ts +0 -83
- package/src/DecoderPluginInterface.ts +0 -9
- package/src/IcaoDecoder.ts +0 -137
- package/src/MessageDecoder.ts +0 -117
- package/src/bin/acars-decoder-test.ts +0 -67
- package/src/bin/acars-decoder.ts +0 -23
- package/src/index.d.ts +0 -15
- package/src/index.ts +0 -4
- package/src/plugins/Label_15.ts +0 -45
- package/src/plugins/Label_16_N_Space.test.ts +0 -94
- package/src/plugins/Label_16_N_Space.ts +0 -91
- package/src/plugins/Label_1M_Slash.test.ts +0 -45
- package/src/plugins/Label_1M_Slash.ts +0 -69
- package/src/plugins/Label_20_CFB.01.ts +0 -81
- package/src/plugins/Label_20_POS.ts +0 -68
- package/src/plugins/Label_30_Slash_EA.test.ts +0 -37
- package/src/plugins/Label_30_Slash_EA.ts +0 -60
- package/src/plugins/Label_44_ETA.ts +0 -81
- package/src/plugins/Label_44_IN.ts +0 -81
- package/src/plugins/Label_44_OFF.ts +0 -88
- package/src/plugins/Label_44_ON.ts +0 -81
- package/src/plugins/Label_44_POS.ts +0 -96
- package/src/plugins/Label_5Z.ts +0 -125
- package/src/plugins/Label_80.ts +0 -215
- package/src/plugins/Label_8E.test.ts +0 -34
- package/src/plugins/Label_8E.ts +0 -55
- package/src/plugins/Label_B6.ts +0 -28
- package/src/plugins/Label_ColonComma.ts +0 -32
- package/src/plugins/Label_H1.ts +0 -18
- package/src/plugins/Label_H1_M1BPOS.ts +0 -60
- package/src/plugins/Label_H1_M1BPRG.ts +0 -40
- package/src/plugins/Label_QP.ts +0 -54
- package/src/plugins/Label_QQ.ts +0 -54
- package/src/plugins/Label_QR.ts +0 -54
- package/src/plugins/Label_QS.ts +0 -54
- package/src/plugins/Label_SQ.ts +0 -111
- package/src/plugins/official.ts +0 -22
- package/tsconfig.json +0 -16
package/dist/plugins/official.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Label_5Z"), exports);
|
|
18
|
-
__exportStar(require("./Label_15"), exports);
|
|
19
|
-
__exportStar(require("./Label_16_N_Space"), exports);
|
|
20
|
-
__exportStar(require("./Label_20_POS"), exports);
|
|
21
|
-
__exportStar(require("./Label_30_Slash_EA"), exports);
|
|
22
|
-
__exportStar(require("./Label_44_ETA"), exports);
|
|
23
|
-
__exportStar(require("./Label_44_IN"), exports);
|
|
24
|
-
__exportStar(require("./Label_44_OFF"), exports);
|
|
25
|
-
__exportStar(require("./Label_44_ON"), exports);
|
|
26
|
-
__exportStar(require("./Label_44_POS"), exports);
|
|
27
|
-
__exportStar(require("./Label_80"), exports);
|
|
28
|
-
__exportStar(require("./Label_8E"), exports);
|
|
29
|
-
__exportStar(require("./Label_B6"), exports);
|
|
30
|
-
__exportStar(require("./Label_ColonComma"), exports);
|
|
31
|
-
__exportStar(require("./Label_H1_M1BPOS"), exports);
|
|
32
|
-
__exportStar(require("./Label_H1_M1BPRG"), exports);
|
|
33
|
-
__exportStar(require("./Label_1M_Slash"), exports);
|
|
34
|
-
__exportStar(require("./Label_SQ"), exports);
|
|
35
|
-
__exportStar(require("./Label_QR"), exports);
|
|
36
|
-
__exportStar(require("./Label_QP"), exports);
|
|
37
|
-
__exportStar(require("./Label_QS"), exports);
|
|
38
|
-
__exportStar(require("./Label_QQ"), exports);
|
package/jest.config.ts
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* For a detailed explanation regarding each configuration property and type check, visit:
|
|
3
|
-
* https://jestjs.io/docs/configuration
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
// All imported modules in your tests should be mocked automatically
|
|
8
|
-
// automock: false,
|
|
9
|
-
|
|
10
|
-
// Stop running tests after `n` failures
|
|
11
|
-
// bail: 0,
|
|
12
|
-
|
|
13
|
-
// The directory where Jest should store its cached dependency information
|
|
14
|
-
// cacheDirectory: "/private/var/folders/nc/91_s3ff56bd2l2zh6tznggcm0000gn/T/jest_dx",
|
|
15
|
-
|
|
16
|
-
// Automatically clear mock calls, instances, contexts and results before every test
|
|
17
|
-
clearMocks: true,
|
|
18
|
-
|
|
19
|
-
// Indicates whether the coverage information should be collected while executing the test
|
|
20
|
-
collectCoverage: true,
|
|
21
|
-
|
|
22
|
-
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
|
23
|
-
// collectCoverageFrom: undefined,
|
|
24
|
-
|
|
25
|
-
// The directory where Jest should output its coverage files
|
|
26
|
-
coverageDirectory: "coverage",
|
|
27
|
-
|
|
28
|
-
// An array of regexp pattern strings used to skip coverage collection
|
|
29
|
-
// coveragePathIgnorePatterns: [
|
|
30
|
-
// "/node_modules/"
|
|
31
|
-
// ],
|
|
32
|
-
|
|
33
|
-
// Indicates which provider should be used to instrument code for coverage
|
|
34
|
-
coverageProvider: "v8",
|
|
35
|
-
|
|
36
|
-
// A list of reporter names that Jest uses when writing coverage reports
|
|
37
|
-
// coverageReporters: [
|
|
38
|
-
// "json",
|
|
39
|
-
// "text",
|
|
40
|
-
// "lcov",
|
|
41
|
-
// "clover"
|
|
42
|
-
// ],
|
|
43
|
-
|
|
44
|
-
// An object that configures minimum threshold enforcement for coverage results
|
|
45
|
-
// coverageThreshold: undefined,
|
|
46
|
-
|
|
47
|
-
// A path to a custom dependency extractor
|
|
48
|
-
// dependencyExtractor: undefined,
|
|
49
|
-
|
|
50
|
-
// Make calling deprecated APIs throw helpful error messages
|
|
51
|
-
// errorOnDeprecated: false,
|
|
52
|
-
|
|
53
|
-
// The default configuration for fake timers
|
|
54
|
-
// fakeTimers: {
|
|
55
|
-
// "enableGlobally": false
|
|
56
|
-
// },
|
|
57
|
-
|
|
58
|
-
// Force coverage collection from ignored files using an array of glob patterns
|
|
59
|
-
// forceCoverageMatch: [],
|
|
60
|
-
|
|
61
|
-
// A path to a module which exports an async function that is triggered once before all test suites
|
|
62
|
-
// globalSetup: undefined,
|
|
63
|
-
|
|
64
|
-
// A path to a module which exports an async function that is triggered once after all test suites
|
|
65
|
-
// globalTeardown: undefined,
|
|
66
|
-
|
|
67
|
-
// A set of global variables that need to be available in all test environments
|
|
68
|
-
// globals: {},
|
|
69
|
-
|
|
70
|
-
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
|
71
|
-
// maxWorkers: "50%",
|
|
72
|
-
|
|
73
|
-
// An array of directory names to be searched recursively up from the requiring module's location
|
|
74
|
-
// moduleDirectories: [
|
|
75
|
-
// "node_modules"
|
|
76
|
-
// ],
|
|
77
|
-
|
|
78
|
-
// An array of file extensions your modules use
|
|
79
|
-
// moduleFileExtensions: [
|
|
80
|
-
// "js",
|
|
81
|
-
// "mjs",
|
|
82
|
-
// "cjs",
|
|
83
|
-
// "jsx",
|
|
84
|
-
// "ts",
|
|
85
|
-
// "tsx",
|
|
86
|
-
// "json",
|
|
87
|
-
// "node"
|
|
88
|
-
// ],
|
|
89
|
-
|
|
90
|
-
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
|
91
|
-
// moduleNameMapper: {},
|
|
92
|
-
|
|
93
|
-
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
|
94
|
-
// modulePathIgnorePatterns: [],
|
|
95
|
-
|
|
96
|
-
// Activates notifications for test results
|
|
97
|
-
// notify: false,
|
|
98
|
-
|
|
99
|
-
// An enum that specifies notification mode. Requires { notify: true }
|
|
100
|
-
// notifyMode: "failure-change",
|
|
101
|
-
|
|
102
|
-
// A preset that is used as a base for Jest's configuration
|
|
103
|
-
// preset: undefined,
|
|
104
|
-
|
|
105
|
-
// Run tests from one or more projects
|
|
106
|
-
// projects: undefined,
|
|
107
|
-
|
|
108
|
-
// Use this configuration option to add custom reporters to Jest
|
|
109
|
-
// reporters: undefined,
|
|
110
|
-
|
|
111
|
-
// Automatically reset mock state before every test
|
|
112
|
-
// resetMocks: false,
|
|
113
|
-
|
|
114
|
-
// Reset the module registry before running each individual test
|
|
115
|
-
// resetModules: false,
|
|
116
|
-
|
|
117
|
-
// A path to a custom resolver
|
|
118
|
-
// resolver: undefined,
|
|
119
|
-
|
|
120
|
-
// Automatically restore mock state and implementation before every test
|
|
121
|
-
// restoreMocks: false,
|
|
122
|
-
|
|
123
|
-
// The root directory that Jest should scan for tests and modules within
|
|
124
|
-
// rootDir: undefined,
|
|
125
|
-
|
|
126
|
-
// A list of paths to directories that Jest should use to search for files in
|
|
127
|
-
// roots: [
|
|
128
|
-
// "<rootDir>"
|
|
129
|
-
// ],
|
|
130
|
-
|
|
131
|
-
// Allows you to use a custom runner instead of Jest's default test runner
|
|
132
|
-
// runner: "jest-runner",
|
|
133
|
-
|
|
134
|
-
// The paths to modules that run some code to configure or set up the testing environment before each test
|
|
135
|
-
// setupFiles: [],
|
|
136
|
-
|
|
137
|
-
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
|
138
|
-
// setupFilesAfterEnv: [],
|
|
139
|
-
|
|
140
|
-
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
|
141
|
-
// slowTestThreshold: 5,
|
|
142
|
-
|
|
143
|
-
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
|
144
|
-
// snapshotSerializers: [],
|
|
145
|
-
|
|
146
|
-
// The test environment that will be used for testing
|
|
147
|
-
// testEnvironment: "jest-environment-node",
|
|
148
|
-
|
|
149
|
-
// Options that will be passed to the testEnvironment
|
|
150
|
-
// testEnvironmentOptions: {},
|
|
151
|
-
|
|
152
|
-
// Adds a location field to test results
|
|
153
|
-
// testLocationInResults: false,
|
|
154
|
-
|
|
155
|
-
// The glob patterns Jest uses to detect test files
|
|
156
|
-
// testMatch: [
|
|
157
|
-
// "**/__tests__/**/*.[jt]s?(x)",
|
|
158
|
-
// "**/?(*.)+(spec|test).[tj]s?(x)"
|
|
159
|
-
// ],
|
|
160
|
-
|
|
161
|
-
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
|
162
|
-
// testPathIgnorePatterns: [
|
|
163
|
-
// "/node_modules/"
|
|
164
|
-
// ],
|
|
165
|
-
|
|
166
|
-
// The regexp pattern or array of patterns that Jest uses to detect test files
|
|
167
|
-
// testRegex: [],
|
|
168
|
-
|
|
169
|
-
// This option allows the use of a custom results processor
|
|
170
|
-
// testResultsProcessor: undefined,
|
|
171
|
-
|
|
172
|
-
// This option allows use of a custom test runner
|
|
173
|
-
// testRunner: "jest-circus/runner",
|
|
174
|
-
|
|
175
|
-
// A map from regular expressions to paths to transformers
|
|
176
|
-
// transform: undefined,
|
|
177
|
-
|
|
178
|
-
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
|
179
|
-
// transformIgnorePatterns: [
|
|
180
|
-
// "/node_modules/",
|
|
181
|
-
// "\\.pnp\\.[^\\/]+$"
|
|
182
|
-
// ],
|
|
183
|
-
|
|
184
|
-
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
|
185
|
-
// unmockedModulePathPatterns: undefined,
|
|
186
|
-
|
|
187
|
-
// Indicates whether each individual test should be reported during the run
|
|
188
|
-
// verbose: undefined,
|
|
189
|
-
|
|
190
|
-
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
|
191
|
-
// watchPathIgnorePatterns: [],
|
|
192
|
-
|
|
193
|
-
// Whether to use watchman for file crawling
|
|
194
|
-
// watchman: true,
|
|
195
|
-
};
|
package/src/DateTimeUtils.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export class DateTimeUtils {
|
|
2
|
-
|
|
3
|
-
// Expects a four digit UTC time string (HHMM)
|
|
4
|
-
public static UTCToString(UTCString: string) {
|
|
5
|
-
let utcDate = new Date();
|
|
6
|
-
utcDate.setUTCHours(+UTCString.substr(0, 2), +UTCString.substr(2, 2), 0);
|
|
7
|
-
return utcDate.toTimeString();
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// Expects a six digit date string and a four digit UTC time string
|
|
11
|
-
// (DDMMYY) (HHMM)
|
|
12
|
-
public static UTCDateTimeToString(dateString: string, timeString: string) {
|
|
13
|
-
let utcDate = new Date();
|
|
14
|
-
utcDate.setUTCDate(+dateString.substr(0, 2));
|
|
15
|
-
utcDate.setUTCMonth(+dateString.substr(2, 2));
|
|
16
|
-
if (dateString.length === 6) {
|
|
17
|
-
utcDate.setUTCFullYear(2000 + +dateString.substr(4, 2));
|
|
18
|
-
}
|
|
19
|
-
utcDate.setUTCHours(+timeString.substr(0, 2), +timeString.substr(2, 2), 0);
|
|
20
|
-
return utcDate.toUTCString();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default {
|
|
25
|
-
DateTimeUtils,
|
|
26
|
-
};
|
package/src/DecoderPlugin.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { DecoderPluginInterface } from './DecoderPluginInterface';
|
|
2
|
-
|
|
3
|
-
export abstract class DecoderPlugin implements DecoderPluginInterface {
|
|
4
|
-
decoder!: any;
|
|
5
|
-
|
|
6
|
-
name: string = 'unknown';
|
|
7
|
-
|
|
8
|
-
defaultResult: any = {
|
|
9
|
-
decoded: false,
|
|
10
|
-
decoder: <any>{
|
|
11
|
-
name: 'unknown',
|
|
12
|
-
type: 'pattern-match',
|
|
13
|
-
decodeLevel: 'none',
|
|
14
|
-
},
|
|
15
|
-
formatted: <any>{
|
|
16
|
-
description: 'Unknown',
|
|
17
|
-
items: <any>[],
|
|
18
|
-
},
|
|
19
|
-
raw: <any>{},
|
|
20
|
-
remaining: <any>{},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
options: Object;
|
|
24
|
-
|
|
25
|
-
constructor(decoder : any, options : any = {}) {
|
|
26
|
-
this.decoder = decoder;
|
|
27
|
-
this.options = options;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
id() : string { // eslint-disable-line class-methods-use-this
|
|
31
|
-
console.log('DecoderPlugin subclass has not overriden id() to provide a unique ID for this plugin!');
|
|
32
|
-
return 'abstract_decoder_plugin';
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
meetsStateRequirements() : boolean { // eslint-disable-line class-methods-use-this
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// onRegister(store: Store<any>) {
|
|
40
|
-
// this.store = store;
|
|
41
|
-
// }
|
|
42
|
-
|
|
43
|
-
qualifiers() : any { // eslint-disable-line class-methods-use-this
|
|
44
|
-
const labels : Array<string> = [];
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
labels,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
decode(message: any) : any { // eslint-disable-line class-methods-use-this
|
|
52
|
-
const decodeResult: any = this.defaultResult;
|
|
53
|
-
decodeResult.remaining.text = message.text;
|
|
54
|
-
return decodeResult;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Utilities
|
|
58
|
-
// TODO: Move these to a utilities class and instanciate here for use in subclasses
|
|
59
|
-
|
|
60
|
-
decodeStringCoordinates(stringCoords: String) : any { // eslint-disable-line class-methods-use-this
|
|
61
|
-
var results : any = {};
|
|
62
|
-
const firstChar = stringCoords.substring(0, 1);
|
|
63
|
-
if (firstChar == 'N' || firstChar == 'S') {
|
|
64
|
-
// format: N12345W123456
|
|
65
|
-
results.latitudeDirection = stringCoords.substring(0, 1);
|
|
66
|
-
results.latitude = (Number(stringCoords.substring(1, 6)) / 1000) * (results.latitudeDirection === 'S' ? -1 : 1);
|
|
67
|
-
results.longitudeDirection = stringCoords.substring(6, 7);
|
|
68
|
-
results.longitude = (Number(stringCoords.substring(7, 13)) / 1000) * (results.longitudeDirection === 'W' ? -1 : 1);
|
|
69
|
-
} else {
|
|
70
|
-
console.log(`DEBUG: decodeStringCoordinates: Failure to decode String-based coordinates: ${stringCoords}`);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return results;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
coordinateString(coords: any) : String {
|
|
77
|
-
return `${Math.abs(coords.latitude)} ${coords.latitudeDirection}, ${Math.abs(coords.longitude)} ${coords.longitudeDirection}`
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default {
|
|
82
|
-
DecoderPlugin,
|
|
83
|
-
};
|
package/src/IcaoDecoder.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
export class IcaoDecoder {
|
|
2
|
-
name : string;
|
|
3
|
-
icao : string;
|
|
4
|
-
|
|
5
|
-
constructor(icao: string) {
|
|
6
|
-
this.name = 'icao-decoder-typescript';
|
|
7
|
-
this.icao = icao;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
isMilitary() {
|
|
11
|
-
let i = this.icao;
|
|
12
|
-
return (
|
|
13
|
-
false
|
|
14
|
-
// us military
|
|
15
|
-
//adf7c8-adf7cf = united states mil_5(uf)
|
|
16
|
-
//adf7d0-adf7df = united states mil_4(uf)
|
|
17
|
-
//adf7e0-adf7ff = united states mil_3(uf)
|
|
18
|
-
//adf800-adffff = united states mil_2(uf)
|
|
19
|
-
|| i.match(/^adf[7-9]/)
|
|
20
|
-
|| i.match(/^adf[a-f]/)
|
|
21
|
-
//ae0000-afffff = united states mil_1(uf)
|
|
22
|
-
|| i.match(/^a(e|f)/)
|
|
23
|
-
|
|
24
|
-
//010070-01008f = egypt_mil
|
|
25
|
-
|| i.match(/^0100(7|8)/)
|
|
26
|
-
|
|
27
|
-
//0a4000-0a4fff = algeria mil(ap)
|
|
28
|
-
|| i.match(/^0a4/)
|
|
29
|
-
|
|
30
|
-
//33ff00-33ffff = italy mil(iy)
|
|
31
|
-
|| i.match(/^33ff/)
|
|
32
|
-
|
|
33
|
-
//350000-37ffff = spain mil(sp)
|
|
34
|
-
|| (i >= '350000' && i <= '37ffff')
|
|
35
|
-
|
|
36
|
-
//3a8000-3affff = france mil_1(fs)
|
|
37
|
-
|| i.match(/^3a(8|9|[a-f])/)
|
|
38
|
-
//3b0000-3bffff = france mil_2(fs)
|
|
39
|
-
|| i.match(/^3b/)
|
|
40
|
-
|
|
41
|
-
//3e8000-3ebfff = germany mil_1(df)
|
|
42
|
-
// remove 8 and 9 from mil arnge
|
|
43
|
-
|| i.match(/^3e(a|b)/)
|
|
44
|
-
//3f4000-3f7fff = germany mil_2(df)
|
|
45
|
-
//3f8000-3fbfff = germany mil_3(df)
|
|
46
|
-
|| i.match(/^3f([4-9]|[a-b])/)
|
|
47
|
-
|
|
48
|
-
//400000-40003f = united kingdom mil_1(ra)
|
|
49
|
-
|| i.match(/^4000[0-3]/)
|
|
50
|
-
//43c000-43cfff = united kingdom mil(ra)
|
|
51
|
-
|| i.match(/^43c/)
|
|
52
|
-
|
|
53
|
-
//444000-447fff = austria mil(aq)
|
|
54
|
-
|| (i.match(/^44[4-7]/) && i != '447ac7')
|
|
55
|
-
|
|
56
|
-
//44f000-44ffff = belgium mil(bc)
|
|
57
|
-
|| i.match(/^44f/)
|
|
58
|
-
|
|
59
|
-
//457000-457fff = bulgaria mil(bu)
|
|
60
|
-
|| i.match(/^457/)
|
|
61
|
-
|
|
62
|
-
//45f400-45f4ff = denmark mil(dg)
|
|
63
|
-
|| i.match(/^45f4/)
|
|
64
|
-
|
|
65
|
-
//468000-4683ff = greece mil(gc)
|
|
66
|
-
|| i.match(/^468[0-3]/)
|
|
67
|
-
|
|
68
|
-
//473c00-473c0f = hungary mil(hm)
|
|
69
|
-
|| i.match(/^473c0/)
|
|
70
|
-
|
|
71
|
-
//478100-4781ff = norway mil(nn)
|
|
72
|
-
|| i.match(/^4781/)
|
|
73
|
-
//480000-480fff = netherlands mil(nm)
|
|
74
|
-
|| i.match(/^480/)
|
|
75
|
-
//48d800-48d87f = poland mil(po)
|
|
76
|
-
|| i.match(/^48d8[0-7]/)
|
|
77
|
-
//497c00-497cff = portugal mil(pu)
|
|
78
|
-
|| i.match(/^497c/)
|
|
79
|
-
//498420-49842f = czech republic mil(ct)
|
|
80
|
-
|| i.match(/^49842/)
|
|
81
|
-
|
|
82
|
-
//4b7000-4b7fff = switzerland mil(su)
|
|
83
|
-
|| i.match(/^4b7/)
|
|
84
|
-
//4b8200-4b82ff = turkey mil(tq)
|
|
85
|
-
|| i.match(/^4b82/)
|
|
86
|
-
|
|
87
|
-
//506f00-506fff = slovenia mil(sj)
|
|
88
|
-
|| i.match(/^506f/)
|
|
89
|
-
|
|
90
|
-
//70c070-70c07f = oman mil(on)
|
|
91
|
-
|| i.match(/^70c07/)
|
|
92
|
-
|
|
93
|
-
//710258-71025f = saudi arabia mil_1(sx)
|
|
94
|
-
//710260-71027f = saudi arabia mil_2(sx)
|
|
95
|
-
//710280-71028f = saudi arabia mil_3(sx)
|
|
96
|
-
//710380-71039f = saudi arabia mil_4(sx)
|
|
97
|
-
|| i.match(/^7102[5-8]/)
|
|
98
|
-
|| i.match(/^7103[8-9]/)
|
|
99
|
-
|
|
100
|
-
//738a00-738aff = israel mil(iz)
|
|
101
|
-
|| i.match(/^738a/)
|
|
102
|
-
|
|
103
|
-
//7c822e-7c822f = australia mil_1(av)
|
|
104
|
-
//7c8230-7c823f = australia mil_2(av)
|
|
105
|
-
//7c8240-7c827f = australia mil_3(av)
|
|
106
|
-
//7c8280-7c82ff = australia mil_4(av)
|
|
107
|
-
//7c8300-7c83ff = australia mil_5(av)
|
|
108
|
-
//7c8400-7c87ff = australia mil_6(av)
|
|
109
|
-
//7c8800-7c8fff = australia mil_7(av)
|
|
110
|
-
|| i.match(/^7c8([2-4]|8)/)
|
|
111
|
-
//7c9000-7c9fff = australia mil_8(av)
|
|
112
|
-
//7ca000-7cbfff = australia mil_9(av)
|
|
113
|
-
|| (i >= '7c9000' && i <= '7cbfff')
|
|
114
|
-
//7cc000-7cffff = australia mil_10(av) 7cc409 not mil, remove this range
|
|
115
|
-
//7d0000-7dffff = australia mil_11(av)
|
|
116
|
-
//7e0000-7fffff = australia mil_12(av)
|
|
117
|
-
|| i.match(/^7[d-f]/)
|
|
118
|
-
|
|
119
|
-
//800200-8002ff = india mil(im)
|
|
120
|
-
|| i.match(/^8002/)
|
|
121
|
-
|
|
122
|
-
//c20000-c3ffff = canada mil(cb)
|
|
123
|
-
|| i.match(/^c[2-3]/)
|
|
124
|
-
|
|
125
|
-
//e40000-e41fff = brazil mil(bq)
|
|
126
|
-
|| i.match(/^e4[0-1]/)
|
|
127
|
-
|
|
128
|
-
//e80600-e806ff = chile mil(cq)
|
|
129
|
-
|| i.match(/^e806/)
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export default {
|
|
136
|
-
IcaoDecoder
|
|
137
|
-
};
|
package/src/MessageDecoder.ts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { DecoderPluginInterface } from './DecoderPluginInterface'; // eslint-disable-line import/no-cycle
|
|
2
|
-
|
|
3
|
-
import * as Plugins from './plugins/official';
|
|
4
|
-
|
|
5
|
-
export class MessageDecoder {
|
|
6
|
-
name : string;
|
|
7
|
-
plugins : Array<DecoderPluginInterface>;
|
|
8
|
-
debug : boolean;
|
|
9
|
-
|
|
10
|
-
constructor() {
|
|
11
|
-
this.name = 'acars-decoder-typescript';
|
|
12
|
-
this.plugins = [];
|
|
13
|
-
this.debug = false;
|
|
14
|
-
|
|
15
|
-
this.registerPlugin(new Plugins.Label_ColonComma(this));
|
|
16
|
-
this.registerPlugin(new Plugins.Label_5Z(this));
|
|
17
|
-
this.registerPlugin(new Plugins.Label_15(this));
|
|
18
|
-
this.registerPlugin(new Plugins.Label_16_N_Space(this));
|
|
19
|
-
this.registerPlugin(new Plugins.Label_20_POS(this));
|
|
20
|
-
this.registerPlugin(new Plugins.Label_30_Slash_EA(this));
|
|
21
|
-
this.registerPlugin(new Plugins.Label_44_ETA(this));
|
|
22
|
-
this.registerPlugin(new Plugins.Label_44_IN(this));
|
|
23
|
-
this.registerPlugin(new Plugins.Label_44_OFF(this));
|
|
24
|
-
this.registerPlugin(new Plugins.Label_44_ON(this));
|
|
25
|
-
this.registerPlugin(new Plugins.Label_44_POS(this));
|
|
26
|
-
this.registerPlugin(new Plugins.Label_B6_Forwardslash(this));
|
|
27
|
-
this.registerPlugin(new Plugins.Label_H1_M1BPOS(this));
|
|
28
|
-
this.registerPlugin(new Plugins.Label_80(this));
|
|
29
|
-
this.registerPlugin(new Plugins.Label_8E(this));
|
|
30
|
-
this.registerPlugin(new Plugins.Label_1M_Slash(this));
|
|
31
|
-
this.registerPlugin(new Plugins.Label_SQ(this));
|
|
32
|
-
this.registerPlugin(new Plugins.Label_QP(this));
|
|
33
|
-
this.registerPlugin(new Plugins.Label_QQ(this));
|
|
34
|
-
this.registerPlugin(new Plugins.Label_QR(this));
|
|
35
|
-
this.registerPlugin(new Plugins.Label_QS(this));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
registerPlugin(plugin: DecoderPluginInterface) : boolean {
|
|
39
|
-
const pluginInstance = plugin;
|
|
40
|
-
// plugin.onRegister(this.store);
|
|
41
|
-
this.plugins.push(plugin);
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
decode(message: any, options: any = {}) {
|
|
46
|
-
// console.log('All plugins');
|
|
47
|
-
// console.log(this.plugins);
|
|
48
|
-
const usablePlugins = this.plugins.filter((plugin) => {
|
|
49
|
-
const qualifiers : any = plugin.qualifiers();
|
|
50
|
-
|
|
51
|
-
if (qualifiers.labels.includes(message.label)) {
|
|
52
|
-
if (qualifiers.preambles && qualifiers.preambles.length > 0) {
|
|
53
|
-
const matching = qualifiers.preambles.filter((preamble: string) => { // eslint-disable-line arrow-body-style,max-len
|
|
54
|
-
// console.log(message.text.substring(0, preamble.length));
|
|
55
|
-
// console.log(preamble);
|
|
56
|
-
return message.text.substring(0, preamble.length) === preamble;
|
|
57
|
-
});
|
|
58
|
-
// console.log(matching);
|
|
59
|
-
return matching.length >= 1;
|
|
60
|
-
} else { // eslint-disable-line no-else-return
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return false;
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
if (options.debug) {
|
|
69
|
-
console.log('Usable plugins');
|
|
70
|
-
console.log(usablePlugins);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
let result;
|
|
74
|
-
if (usablePlugins.length > 0) {
|
|
75
|
-
const plugin: DecoderPluginInterface = usablePlugins[0];
|
|
76
|
-
result = plugin.decode(message);
|
|
77
|
-
} else {
|
|
78
|
-
result = {
|
|
79
|
-
decoded: false,
|
|
80
|
-
decodeLevel: 'none',
|
|
81
|
-
error: 'No known decoder plugin for this message',
|
|
82
|
-
message: message,
|
|
83
|
-
remaining: {
|
|
84
|
-
text: message.text,
|
|
85
|
-
},
|
|
86
|
-
raw: {},
|
|
87
|
-
formatted: {},
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (options.debug) {
|
|
92
|
-
let performDebug = true;
|
|
93
|
-
if (options.debug.only_decoded) {
|
|
94
|
-
performDebug = result.decoded;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (performDebug) {
|
|
98
|
-
console.log('Result');
|
|
99
|
-
console.log(result);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return result;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
lookupAirportByIata(iata: string) : any {
|
|
107
|
-
const airportsArray : Array<any> = []; // = this.store.state.acarsData.airports;
|
|
108
|
-
// console.log(airportsArray);
|
|
109
|
-
const airport = airportsArray.filter((e: any) => e.iata === iata);
|
|
110
|
-
|
|
111
|
-
return airport;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export default {
|
|
116
|
-
MessageDecoder,
|
|
117
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { MessageDecoder } from '../MessageDecoder';
|
|
4
|
-
|
|
5
|
-
function debugMessage(message: any, decoding: any) {
|
|
6
|
-
console.log("ORIGINAL MESSAGE");
|
|
7
|
-
console.log("Label:", message.label);
|
|
8
|
-
console.log("Text:", message.text);
|
|
9
|
-
console.log();
|
|
10
|
-
console.log("Decoded Message:");
|
|
11
|
-
console.log(decoding.formatted.description);
|
|
12
|
-
if (decoding.formatted.items && decoding.formatted.items.length > 0) {
|
|
13
|
-
decoding.formatted.items.forEach((item: any) => {
|
|
14
|
-
console.log(`${item.label} - ${item.value}`);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
console.log();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function decode(label: string, text: string) {
|
|
21
|
-
const message = {
|
|
22
|
-
label: label,
|
|
23
|
-
text: text
|
|
24
|
-
};
|
|
25
|
-
const decoder = new MessageDecoder();
|
|
26
|
-
const decoding = decoder.decode(message);
|
|
27
|
-
debugMessage(message, decoding);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Label 16 with N space
|
|
31
|
-
decode('16', 'N 44.203,W 86.546,31965,6, 290');
|
|
32
|
-
decode('16', 'N 42.777,W 85.477,35004,6, 132');
|
|
33
|
-
decode('16', 'N 28.177/W 96.055');
|
|
34
|
-
decode('16', 'N 44.640/W119.729');
|
|
35
|
-
|
|
36
|
-
// Label 30 with slash EA
|
|
37
|
-
decode('30', '/EA1830/DSKSFO/SK24');
|
|
38
|
-
decode('30', '/EA1611/DSMMSD/SK24');
|
|
39
|
-
decode('30', '/EA1719/DSKSFO/SK23');
|
|
40
|
-
|
|
41
|
-
// Label 5Z
|
|
42
|
-
decode('5Z', '/R3 SNAORD 2205-14 SNA');
|
|
43
|
-
|
|
44
|
-
// Label 80 + 3N01 POSRPT
|
|
45
|
-
decode(
|
|
46
|
-
'80',
|
|
47
|
-
"3N01 POSRPT 0570/13 MSLP/KJFK .N603AV/04F 00:59\n\
|
|
48
|
-
/NWYP ORF /HDG 074/MCH 779\n\
|
|
49
|
-
/POS N3630.7W07701.8/FL 350/TAS 453/SAT -054\n\
|
|
50
|
-
/SWND 079/DWND 216/FOB N006857/ETA 01:40.3"
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
// Label H1 + M1BPOS
|
|
54
|
-
decode(
|
|
55
|
-
'H1',
|
|
56
|
-
'#M1BPOSN32492W117178,N33492W118335,195835,350,N32463W117143,195907,N32359W117014,M51,25872,249/TS195835,1214195C27'
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
// Label 8E
|
|
60
|
-
decode("8E", "EGSS,1618");
|
|
61
|
-
|
|
62
|
-
// Label 1M with slash
|
|
63
|
-
decode("1M", `/BA0843/ETA01/230822/LDSP/EGLL/EGSS/2JK0
|
|
64
|
-
1940/EGLL27L/10 `);
|
|
65
|
-
decode("1M", `/AY1416/ETA02/230822/EDDF/EFHK/EETN/2JK0
|
|
66
|
-
1956/EFHK04L/50
|
|
67
|
-
/ / / / / /`);
|