node-red-contrib-ntrip 0.1.0 → 0.1.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/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.1.1]
5
+ ### MInor tweaks
6
+
4
7
  ## [0.1.0]
5
8
  ### Initial version
6
9
 
File without changes
@@ -0,0 +1 @@
1
+ [{"id":"91bc83d1480be9ce","type":"RtcmDecoder","z":"95fe791a9c2e02fb","description":"","x":780,"y":100,"wires":[["86db72067d6de6eb"],["bcb4f78f38f73614"]]},{"id":"86db72067d6de6eb","type":"debug","z":"95fe791a9c2e02fb","name":"debug 42","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1000,"y":80,"wires":[]},{"id":"bcb4f78f38f73614","type":"debug","z":"95fe791a9c2e02fb","name":"debug 44","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1000,"y":120,"wires":[]},{"id":"fa8ecd8584cd2497","type":"NmeaDecoder","z":"95fe791a9c2e02fb","description":"","x":780,"y":220,"wires":[["ce248cbbb81fedc7"],["1e5f02ac026876e5"]]},{"id":"ce248cbbb81fedc7","type":"debug","z":"95fe791a9c2e02fb","name":"debug 45","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1000,"y":200,"wires":[]},{"id":"1e5f02ac026876e5","type":"debug","z":"95fe791a9c2e02fb","name":"debug 46","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1000,"y":240,"wires":[]},{"id":"381976b4de0e6794","type":"tcp in","z":"95fe791a9c2e02fb","name":"","server":"client","host":"rtkbase.fritz.box","port":"5016","datamode":"stream","datatype":"buffer","newline":"","topic":"","trim":false,"base64":false,"tls":"","x":530,"y":160,"wires":[["91bc83d1480be9ce","fa8ecd8584cd2497"]]},{"id":"cf03abb372a163fb","type":"comment","z":"95fe791a9c2e02fb","name":"","info":"This example demonstrates how to connect to \na TCP sever that streams RTCM messages.\n\nE.g. https://github.com/Stefal/rtkbase\n","x":480,"y":100,"wires":[]}]
@@ -5,13 +5,16 @@
5
5
  <script type="text/javascript">
6
6
  RED.nodes.registerType('NtripClient', {
7
7
  category: 'NTRIP',
8
- color: '#DDDDDD',
8
+ color: '#C0DEED',
9
9
  defaults: {
10
10
  description: { value:"" },
11
11
  port: { value: 2101, required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 0) && (v <= 65535))) }},
12
12
  host: { value:"" },
13
13
  mountpoint: { value:"" },
14
14
  interval: { value: 1000, required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 0) && (v <= 100000))) }},
15
+ xcoordinate: { value: 0, required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) )) }},
16
+ ycoordinate: { value: 0, required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) )) }},
17
+ zcoordinate: { value: 0, required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) )) }},
15
18
  },
16
19
  credentials: {
17
20
  username: { type: "text" },
@@ -62,6 +65,30 @@
62
65
  <input type="text" id="node-input-interval" placeholder="The interval in milliseconds or 0">
63
66
  </div>
64
67
 
68
+
69
+ <hr align="middle"/>
70
+
71
+ <div class="form-row" id="coordinates" style="background: var(--red-ui-tertiary-background)">
72
+ <label style="width: auto"><i class="fa fa-crosshairs"></i> Optional location (if set a NMEA GGA sentence is sent to the server)</label>
73
+
74
+ <div class="form-row">
75
+ <label for="node-input-x"> X</label>
76
+ <input type="text" id="node-input-x" placeholder="The X position or 0 (optional)">
77
+ </div>
78
+
79
+ <div class="form-row">
80
+ <label for="node-input-y"> Y</label>
81
+ <input type="text" id="node-input-y" placeholder="The Y position or 0 (optional)">
82
+ </div>
83
+
84
+ <div class="form-row">
85
+ <label for="node-input-z"> Z</label>
86
+ <input type="text" id="node-input-z" placeholder="The Z position or 0 (optional)">
87
+ </div>
88
+ </div>
89
+
90
+ <hr align="middle"/>
91
+
65
92
  <div class="form-row">
66
93
  <label for="node-input-description"><i class="fa fa-comment"></i> Description</label>
67
94
  <input type="text" id="node-input-description" placeholder="The description of the node (optional)">
@@ -89,7 +116,7 @@
89
116
  <script type="text/javascript">
90
117
  RED.nodes.registerType('RtcmDecoder', {
91
118
  category: 'NTRIP',
92
- color: '#DDDDDD',
119
+ color: '#C0DEED',
93
120
  defaults: {
94
121
  description: { value:"" },
95
122
  },
@@ -134,7 +161,7 @@
134
161
  <script type="text/javascript">
135
162
  RED.nodes.registerType('NmeaDecoder', {
136
163
  category: 'NTRIP',
137
- color: '#DDDDDD',
164
+ color: '#C0DEED',
138
165
  defaults: {
139
166
  description: { value:"" },
140
167
  },
@@ -173,6 +200,3 @@
173
200
  <p>.</p>
174
201
  <p><code>msg.payload</code></p>
175
202
  </script>
176
-
177
- // TODO: ntrip server / caster
178
- // TODO: rtcm encoder
package/ntrip/99-ntrip.js CHANGED
@@ -25,9 +25,18 @@ module.exports = function (RED) {
25
25
  username: node.credentials.username,
26
26
  password: node.credentials.password,
27
27
  interval: config.interval,
28
- // TODO: xyz, ... see https://github.com/dxhbiz/ntrip-client/blob/master/lib/client.js
29
28
  };
30
29
 
30
+ let x = config.xcoordinate;
31
+ let y = config.ycoordinate;
32
+ let z = config.zcoordinate;
33
+
34
+ if (x !== undefined && x !== 0 &&
35
+ y !== undefined && y !== 0 &&
36
+ z !== undefined && z !== 0) {
37
+ options.xyz = [x, y, z];
38
+ }
39
+
31
40
  const client = new NtripClient(options);
32
41
 
33
42
  client.on('data', (data) => {
@@ -87,28 +96,40 @@ module.exports = function (RED) {
87
96
  let buffer = msg.payload;
88
97
  try
89
98
  {
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++;
99
+ do {
100
+ let message;
101
+ let length;
102
+ [message, length] = RtcmTransport.decode(buffer);
103
+
104
+ let messageType = message.constructor.name.replace('RtcmMessage', '');
105
+
106
+ let msg = {
107
+ payload : {
108
+ rtcm : message.messageType,
109
+ messageType : messageType,
110
+ message : message,
111
+ input : buffer,
112
+ length : length
113
+ }
114
+ };
115
+
116
+ node.send([msg, null]);
117
+ node.rtcmMessagesReceived++;
118
+
119
+ // find next message in buffer.
120
+ buffer = buffer.slice(length);
121
+ if(buffer.length == 0){
122
+ done = true;
123
+ }
124
+ } while(!done);
106
125
  }
107
126
  catch(ex)
108
127
  {
109
128
  let msg = {
110
- payload : ex,
111
- buffer : buffer,
129
+ payload : {
130
+ error : ex,
131
+ input : buffer,
132
+ }
112
133
  };
113
134
  node.send([null, msg]);
114
135
  node.invalidMessagesReceived++;
@@ -139,6 +160,10 @@ module.exports = function (RED) {
139
160
  this.on('input', function (msg) {
140
161
 
141
162
  let buffer = msg.payload;
163
+ if(Buffer.isBuffer(buffer)){
164
+ buffer = buffer.toString();
165
+ }
166
+
142
167
  try
143
168
  {
144
169
  let message = NmeaTransport.decode(buffer);
@@ -147,9 +172,9 @@ module.exports = function (RED) {
147
172
  let msg = {
148
173
  payload : {
149
174
  messageType : messageType,
150
- message : message,
175
+ message : message,
176
+ input : buffer
151
177
  },
152
- buffer : buffer,
153
178
  };
154
179
 
155
180
  node.send([msg, null]);
@@ -158,8 +183,10 @@ module.exports = function (RED) {
158
183
  catch(ex)
159
184
  {
160
185
  let msg = {
161
- payload : ex,
162
- buffer : buffer,
186
+ payload : {
187
+ error : ex,
188
+ input : buffer,
189
+ }
163
190
  };
164
191
  node.send([null, msg]);
165
192
  node.invalidMessagesReceived++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-ntrip",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Node for ntrip and rtcm handling.",
5
5
  "node-red": {
6
6
  "version": ">=0.1.0",