node-red-contrib-ntrip 0.1.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.
@@ -0,0 +1,31 @@
1
+ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3
+
4
+ name: Node.js CI
5
+
6
+ on:
7
+ push:
8
+ branches: [ "main" ]
9
+ pull_request:
10
+ branches: [ "main" ]
11
+
12
+ jobs:
13
+ build:
14
+
15
+ runs-on: ubuntu-latest
16
+
17
+ strategy:
18
+ matrix:
19
+ node-version: [18.x, 20.x, 22.x]
20
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ - name: Use Node.js ${{ matrix.node-version }}
25
+ uses: actions/setup-node@v4
26
+ with:
27
+ node-version: ${{ matrix.node-version }}
28
+ cache: 'npm'
29
+ - run: npm ci
30
+ - run: npm run build --if-present
31
+ #- run: npm test
@@ -0,0 +1,33 @@
1
+ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
+ # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
+
4
+ name: Node.js Package
5
+
6
+ on:
7
+ release:
8
+ types: [created]
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-node@v4
16
+ with:
17
+ node-version: 20
18
+ - run: npm ci
19
+ # - run: npm test
20
+
21
+ publish-npm:
22
+ needs: build
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - uses: actions/setup-node@v4
27
+ with:
28
+ node-version: 20
29
+ registry-url: https://registry.npmjs.org/
30
+ - run: npm ci
31
+ - run: npm publish
32
+ env:
33
+ NODE_AUTH_TOKEN: ${{secrets.npm_token}}
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ ## [0.1.0]
5
+ ### Initial version
6
+
7
+ **Note:** The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Karl-Heinz Wind
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Vallox nodes for node-red
2
+ [![Platform](https://img.shields.io/badge/platform-Node--RED-red)](https://nodered.org)
3
+ ![License](https://img.shields.io/github/license/windkh/node-red-contrib-ntrip.svg)
4
+ [![NPM](https://img.shields.io/npm/v/node-red-contrib-ntrip?logo=npm)](https://www.npmjs.org/package/node-red-contrib-ntrip)
5
+ [![Known Vulnerabilities](https://snyk.io/test/npm/node-red-contrib-ntrip/badge.svg)](https://snyk.io/test/npm/node-red-contrib-ntrip)
6
+ [![Downloads](https://img.shields.io/npm/dm/node-red-contrib-ntrip.svg)](https://www.npmjs.com/package/node-red-contrib-ntrip)
7
+ [![Total Downloads](https://img.shields.io/npm/dt/node-red-contrib-ntrip.svg)](https://www.npmjs.com/package/node-red-contrib-ntrip)
8
+ [![Package Quality](http://npm.packagequality.com/shield/node-red-contrib-ntrip.png)](http://packagequality.com/#?package=node-red-contrib-ntrip)
9
+ [![Open Issues](https://img.shields.io/github/issues-raw/windkh/node-red-contrib-ntrip.svg)](https://github.com/windkh/node-red-contrib-ntrip/issues)
10
+ [![Closed Issues](https://img.shields.io/github/issues-closed-raw/windkh/node-red-contrib-ntrip.svg)](https://github.com/windkh/node-red-contrib-ntrip/issues?q=is%3Aissue+is%3Aclosed)
11
+ ...
12
+
13
+ This package contains nodes for connecting to a NTRIP server.
14
+
15
+ # Dependencies
16
+ This package depends on the following libraries
17
+ @gnss/nmea
18
+ @gnss/rtcm
19
+ ntrip-client
20
+
21
+
22
+ # Thanks for your donation
23
+ If you want to support this free project. Any help is welcome. You can donate by clicking one of the following links:
24
+
25
+ <a target="blank" href="https://blockchain.com/btc/payment_request?address=1PBi7BoZ1mBLQx4ePbwh1MVoK2RaoiDsp5"><img src="https://img.shields.io/badge/Donate-Bitcoin-green.svg"/></a>
26
+ <a target="blank" href="https://www.paypal.me/windkh"><img src="https://img.shields.io/badge/Donate-PayPal-blue.svg"/></a>
27
+
28
+ <a href="https://www.buymeacoffee.com/windka" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
29
+
30
+
31
+ # Credits
32
+
33
+
34
+ # Changelog
35
+ Changes can be followed [here](/CHANGELOG.md)
36
+
37
+
38
+ # NTRIP Client Node
39
+ ...
40
+
41
+
42
+ # RTCM Decoder Node
43
+
44
+
45
+ # NMEA Decoder Node
46
+
47
+
48
+ # License
49
+
50
+ Author: Karl-Heinz Wind
51
+
52
+ The MIT License (MIT)
53
+ Copyright (c) 2025 by Karl-Heinz Wind
54
+
55
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
56
+
57
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
58
+
59
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,178 @@
1
+ <!-- Created by Karl-Heinz Wind -->
2
+
3
+ <!-- ------------------------------------------------------------------------------------------ -->
4
+
5
+ <script type="text/javascript">
6
+ RED.nodes.registerType('NtripClient', {
7
+ category: 'NTRIP',
8
+ color: '#DDDDDD',
9
+ defaults: {
10
+ description: { value:"" },
11
+ port: { value: 2101, required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 0) && (v <= 65535))) }},
12
+ host: { value:"" },
13
+ mountpoint: { value:"" },
14
+ interval: { value: 1000, required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 0) && (v <= 100000))) }},
15
+ },
16
+ credentials: {
17
+ username: { type: "text" },
18
+ password: { type: "password" },
19
+ },
20
+ inputs: 0,
21
+ outputs: 1,
22
+ icon: "bridge.png",
23
+ paletteLabel: "NTRIP Client",
24
+ label: function () {
25
+ return this.description || "NTRIP Client";
26
+ },
27
+ labelStyle: function() {
28
+ return this.description?"node_label_italic":"";
29
+ }
30
+ });
31
+
32
+ </script>
33
+
34
+ <script type="text/x-red" data-template-name="NtripClient">
35
+
36
+ <div class="form-row">
37
+ <label for="node-input-host"><i class="fa fa-tag"></i> NTRIP Server</label>
38
+ <input type="text" id="node-input-host" placeholder="The hostname or the IP address of the NTRIP server">
39
+ </div>
40
+
41
+ <div class="form-row">
42
+ <label for="node-input-port"><i class="fa fa-phone"></i> Port</label>
43
+ <input type="text" id="node-input-port" placeholder="The network port to open e.g. 2101">
44
+ </div>
45
+
46
+ <div class="form-row">
47
+ <label for="node-input-mountpoint"><i class="fa fa-comment"></i> Mountpoint</label>
48
+ <input type="text" id="node-input-mountpoint" placeholder="The mountpoint of the stream">
49
+ </div>
50
+
51
+ <div class="form-row">
52
+ <label for="node-input-username"><i class="fa fa-user"></i> Username</label>
53
+ <input type="text" id="node-input-username" placeholder="Enter the username here">
54
+ </div>
55
+ <div class="form-row">
56
+ <label for="node-input-password"><i class="fa fa-key"></i> Password</label>
57
+ <input type="text" id="node-input-password" placeholder="Enter the password here)">
58
+ </div>
59
+
60
+ <div class="form-row">
61
+ <label for="node-input-interval"><i class="fa fa-comment"></i> Interval (ms)</label>
62
+ <input type="text" id="node-input-interval" placeholder="The interval in milliseconds or 0">
63
+ </div>
64
+
65
+ <div class="form-row">
66
+ <label for="node-input-description"><i class="fa fa-comment"></i> Description</label>
67
+ <input type="text" id="node-input-description" placeholder="The description of the node (optional)">
68
+ </div>
69
+ </script>
70
+
71
+ <script type="text/x-red" data-help-name="NtripClient">
72
+ <p>A node that connects to a NTRIP server.</p>
73
+
74
+ <h3>Configuration</h3>
75
+
76
+ <p>Description of the device.</p>
77
+
78
+ <h3>Inputs</h3>
79
+ <p>.</p>
80
+
81
+ <h3>Outputs</h3>
82
+ <p>.</p>
83
+ <p><code>msg.payload</code></p>
84
+ </script>
85
+
86
+
87
+ <!-- ------------------------------------------------------------------------------------------ -->
88
+
89
+ <script type="text/javascript">
90
+ RED.nodes.registerType('RtcmDecoder', {
91
+ category: 'NTRIP',
92
+ color: '#DDDDDD',
93
+ defaults: {
94
+ description: { value:"" },
95
+ },
96
+ inputs: 1,
97
+ outputs: 2,
98
+ icon: "function.png",
99
+ paletteLabel: "RTCM Decoder",
100
+ label: function () {
101
+ return this.description || "RTCM Decoder";
102
+ },
103
+ labelStyle: function() {
104
+ return this.description?"node_label_italic":"";
105
+ }
106
+ });
107
+
108
+ </script>
109
+
110
+ <script type="text/x-red" data-template-name="RtcmDecoder">
111
+ <div class="form-row">
112
+ <label for="node-input-description"><i class="fa fa-comment"></i> Description</label>
113
+ <input type="text" id="node-input-description" placeholder="The description of the node (optional)">
114
+ </div>
115
+ </script>
116
+
117
+ <script type="text/x-red" data-help-name="RtcmDecoder">
118
+ <p>A node that decodes RTCM messages.</p>
119
+
120
+ <h3>Configuration</h3>
121
+
122
+ <p>Description of the device.</p>
123
+
124
+ <h3>Inputs</h3>
125
+ <p>.</p>
126
+
127
+ <h3>Outputs</h3>
128
+ <p>.</p>
129
+ <p><code>msg.payload</code></p>
130
+ </script>
131
+
132
+ <!-- ------------------------------------------------------------------------------------------ -->
133
+
134
+ <script type="text/javascript">
135
+ RED.nodes.registerType('NmeaDecoder', {
136
+ category: 'NTRIP',
137
+ color: '#DDDDDD',
138
+ defaults: {
139
+ description: { value:"" },
140
+ },
141
+ inputs: 1,
142
+ outputs: 2,
143
+ icon: "function.png",
144
+ paletteLabel: "NMEA Decoder",
145
+ label: function () {
146
+ return this.description || "NMEA Decoder";
147
+ },
148
+ labelStyle: function() {
149
+ return this.description?"node_label_italic":"";
150
+ }
151
+ });
152
+
153
+ </script>
154
+
155
+ <script type="text/x-red" data-template-name="NmeaDecoder">
156
+ <div class="form-row">
157
+ <label for="node-input-description"><i class="fa fa-comment"></i> Description</label>
158
+ <input type="text" id="node-input-description" placeholder="The description of the node (optional)">
159
+ </div>
160
+ </script>
161
+
162
+ <script type="text/x-red" data-help-name="NmeaDecoder">
163
+ <p>A node that decodes NMEA messages.</p>
164
+
165
+ <h3>Configuration</h3>
166
+
167
+ <p>Description of the device.</p>
168
+
169
+ <h3>Inputs</h3>
170
+ <p>.</p>
171
+
172
+ <h3>Outputs</h3>
173
+ <p>.</p>
174
+ <p><code>msg.payload</code></p>
175
+ </script>
176
+
177
+ // TODO: ntrip server / caster
178
+ // TODO: rtcm encoder
@@ -0,0 +1,181 @@
1
+ /**
2
+ * Created by Karl-Heinz Wind
3
+ **/
4
+
5
+ module.exports = function (RED) {
6
+ "use strict";
7
+
8
+ const { RtcmTransport, RtcmMessage, RtcmMessageType } = require('@gnss/rtcm');
9
+ const { NmeaTransport, NmeaMessageUnknown } = require('@gnss/nmea');
10
+ const { NtripClient } = require('ntrip-client');
11
+
12
+ // --------------------------------------------------------------------------------------------
13
+ // NTRIP client node.
14
+ function NtripClientNode(config) {
15
+ RED.nodes.createNode(this, config);
16
+ let node = this;
17
+ node.messagesReceived = 0;
18
+
19
+ if(config.host !== undefined ) {
20
+
21
+ let options = {
22
+ host: config.host,
23
+ port: config.port || 2101,
24
+ mountpoint: config.mountpoint,
25
+ username: node.credentials.username,
26
+ password: node.credentials.password,
27
+ interval: config.interval,
28
+ // TODO: xyz, ... see https://github.com/dxhbiz/ntrip-client/blob/master/lib/client.js
29
+ };
30
+
31
+ const client = new NtripClient(options);
32
+
33
+ client.on('data', (data) => {
34
+ node.messagesReceived++;
35
+ node.status({
36
+ fill: 'green',
37
+ shape: 'ring',
38
+ text: 'Messages ' + node.messagesReceived,
39
+ });
40
+
41
+ let msg = {
42
+ payload : data
43
+ }
44
+ node.send(msg);
45
+ });
46
+
47
+ client.on('close', () => {
48
+ node.log('Closed NTRIP connection.');
49
+ });
50
+
51
+ client.on('error', (err) => {
52
+ node.log(err);
53
+ });
54
+
55
+ client.run();
56
+ node.status({
57
+ fill: 'green',
58
+ shape: 'ring',
59
+ text: 'ok',
60
+ });
61
+
62
+ this.on('close', function(done) {
63
+ client.close();
64
+ node.status({});
65
+ done();
66
+ });
67
+ }
68
+ }
69
+ RED.nodes.registerType("NtripClient", NtripClientNode, {
70
+ credentials: {
71
+ username: { type: "text" },
72
+ password: { type: "password" },
73
+ }
74
+ });
75
+
76
+
77
+ // --------------------------------------------------------------------------------------------
78
+ // RTCM decoder node.
79
+ function RtcmDecoderNode(config) {
80
+ RED.nodes.createNode(this, config);
81
+ let node = this;
82
+ node.rtcmMessagesReceived = 0;
83
+ node.invalidMessagesReceived = 0;
84
+
85
+ this.on('input', function (msg) {
86
+
87
+ let buffer = msg.payload;
88
+ try
89
+ {
90
+ let message;
91
+ let length;
92
+ [message, length] = RtcmTransport.decode(buffer);
93
+ let msg = {
94
+ payload : {
95
+ messageType : message.messageType,
96
+ message : message,
97
+ info : message.info,
98
+ },
99
+ length : length,
100
+ buffer : buffer,
101
+ };
102
+
103
+ // TODO: slice buffer and iterate.
104
+ node.send([msg, null]);
105
+ node.rtcmMessagesReceived++;
106
+ }
107
+ catch(ex)
108
+ {
109
+ let msg = {
110
+ payload : ex,
111
+ buffer : buffer,
112
+ };
113
+ node.send([null, msg]);
114
+ node.invalidMessagesReceived++;
115
+ }
116
+
117
+ node.status({
118
+ fill: 'green',
119
+ shape: 'ring',
120
+ text: 'RTCM: ' + node.rtcmMessagesReceived + ' Invalid: ' + node.invalidMessagesReceived,
121
+ });
122
+ });
123
+
124
+ this.on('close', function(done) {
125
+ node.status({});
126
+ done();
127
+ });
128
+ }
129
+ RED.nodes.registerType("RtcmDecoder", RtcmDecoderNode);
130
+
131
+ // --------------------------------------------------------------------------------------------
132
+ // NMEA decoder node.
133
+ function NmeaDecoderNode(config) {
134
+ RED.nodes.createNode(this, config);
135
+ let node = this;
136
+ node.nmeaMessagesReceived = 0;
137
+ node.invalidMessagesReceived = 0;
138
+
139
+ this.on('input', function (msg) {
140
+
141
+ let buffer = msg.payload;
142
+ try
143
+ {
144
+ let message = NmeaTransport.decode(buffer);
145
+ let messageType = message.constructor.name.replace('NmeaMessage', '').toUpperCase();
146
+
147
+ let msg = {
148
+ payload : {
149
+ messageType : messageType,
150
+ message : message,
151
+ },
152
+ buffer : buffer,
153
+ };
154
+
155
+ node.send([msg, null]);
156
+ node.nmeaMessagesReceived++;
157
+ }
158
+ catch(ex)
159
+ {
160
+ let msg = {
161
+ payload : ex,
162
+ buffer : buffer,
163
+ };
164
+ node.send([null, msg]);
165
+ node.invalidMessagesReceived++;
166
+ }
167
+
168
+ node.status({
169
+ fill: 'green',
170
+ shape: 'ring',
171
+ text: 'NMEA: ' + node.nmeaMessagesReceived + ' Invalid: ' + node.invalidMessagesReceived,
172
+ });
173
+ });
174
+
175
+ this.on('close', function(done) {
176
+ node.status({});
177
+ done();
178
+ });
179
+ }
180
+ RED.nodes.registerType("NmeaDecoder", NmeaDecoderNode);
181
+ }
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "node-red-contrib-ntrip",
3
+ "version": "0.1.0",
4
+ "description": "Node for ntrip and rtcm handling.",
5
+ "node-red": {
6
+ "version": ">=0.1.0",
7
+ "nodes": {
8
+ "ntrip": "ntrip/99-ntrip.js"
9
+ }
10
+ },
11
+ "engines": {
12
+ "node": ">=7.6.0"
13
+ },
14
+ "keywords": [
15
+ "node-red",
16
+ "rtcm",
17
+ "ntrip",
18
+ "gnss"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/windkh/node-red-contrib-ntrip"
23
+ },
24
+ "author": "Karl-Heinz Wind",
25
+ "license": "MIT",
26
+ "dependencies": {
27
+ "@gnss/nmea": "^0.1.2",
28
+ "@gnss/rtcm": "^0.1.5",
29
+ "ntrip-client": "^1.1.1"
30
+ }
31
+ }