node-red-contrib-tak-registration 0.11.4 → 0.11.5
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/package.json +1 -1
- package/tak-ingest.js +11 -7
package/package.json
CHANGED
package/tak-ingest.js
CHANGED
|
@@ -52,19 +52,16 @@ module.exports = function(RED) {
|
|
|
52
52
|
|
|
53
53
|
node.on("input",function(msg) {
|
|
54
54
|
if (Buffer.isBuffer(msg.payload)) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
msg.payload = msg.payload.slice(3,l+3);
|
|
58
|
-
handleProtoBuf(msg);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
else if (msg.payload[0] === 191 && msg.payload[2] === 191) {
|
|
55
|
+
// handle UDP packet
|
|
56
|
+
if (msg.payload[0] === 191 && msg.payload[2] === 191) {
|
|
62
57
|
var head = msg.payload[1];
|
|
63
58
|
msg.payload = msg.payload.slice(3);
|
|
59
|
+
// type 1 = protobuf
|
|
64
60
|
if (head === 1) {
|
|
65
61
|
handleProtoBuf(msg);
|
|
66
62
|
return;
|
|
67
63
|
}
|
|
64
|
+
// type 0 = plain text
|
|
68
65
|
else if (head === 0) {
|
|
69
66
|
msg.payload = msg.payload.toString();
|
|
70
67
|
}
|
|
@@ -73,6 +70,13 @@ module.exports = function(RED) {
|
|
|
73
70
|
return;
|
|
74
71
|
}
|
|
75
72
|
}
|
|
73
|
+
// ideally need to check if tcp and streaming protobuf...
|
|
74
|
+
// else if (msg.payload[0] === 191 && !msg.hasOwnProperty("fromip")) {
|
|
75
|
+
// var l = msg.payload[1] + msg.payload[2] * 256;
|
|
76
|
+
// msg.payload = msg.payload.slice(3,l+3);
|
|
77
|
+
// handleProtoBuf(msg);
|
|
78
|
+
// return;
|
|
79
|
+
// }
|
|
76
80
|
else {
|
|
77
81
|
node.error("Unknown buffer type",msg);
|
|
78
82
|
return;
|