-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpusRadio.json
705 lines (705 loc) · 21.4 KB
/
OpusRadio.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
[
{
"id": "e1c07481.249ed8",
"type": "tab",
"label": "Opus Interface",
"disabled": false,
"info": ""
},
{
"id": "587a989.90cbf68",
"type": "serial-port",
"z": "",
"serialport": "/dev/ttyUSB1",
"serialbaud": "115200",
"databits": "8",
"parity": "none",
"stopbits": "1",
"waitfor": "",
"newline": "500",
"bin": "bin",
"out": "time",
"addchar": "false",
"responsetimeout": "10000"
},
{
"id": "25043b9d.ec5374",
"type": "serial-port",
"z": "",
"serialport": "/dev/ttyUSB1",
"serialbaud": "115200",
"databits": "8",
"parity": "none",
"stopbits": "1",
"newline": "50",
"bin": "bin",
"out": "time",
"addchar": false,
"responsetimeout": "10000"
},
{
"id": "56f5fd17.f00064",
"type": "ui_tab",
"z": "",
"name": "Radio Control",
"icon": "settings input antenna"
},
{
"id": "e732cfd6.f98fc",
"type": "ui_group",
"z": "",
"name": "Default",
"tab": "56f5fd17.f00064",
"disp": false,
"width": "6",
"collapse": false
},
{
"id": "77e6f6e.6a8c708",
"type": "ui_base",
"theme": {
"name": "theme-light",
"lightTheme": {
"default": "#0094CE",
"baseColor": "#0094CE",
"baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif",
"edited": true,
"reset": false
},
"darkTheme": {
"default": "#097479",
"baseColor": "#097479",
"baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif",
"edited": false
},
"customTheme": {
"name": "Untitled Theme 1",
"default": "#4B7930",
"baseColor": "#4B7930",
"baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
},
"themeState": {
"base-color": {
"default": "#0094CE",
"value": "#0094CE",
"edited": false
},
"page-titlebar-backgroundColor": {
"value": "#0094CE",
"edited": false
},
"page-backgroundColor": {
"value": "#fafafa",
"edited": false
},
"page-sidebar-backgroundColor": {
"value": "#ffffff",
"edited": false
},
"group-textColor": {
"value": "#1bbfff",
"edited": false
},
"group-borderColor": {
"value": "#ffffff",
"edited": false
},
"group-backgroundColor": {
"value": "#ffffff",
"edited": false
},
"widget-textColor": {
"value": "#111111",
"edited": false
},
"widget-backgroundColor": {
"value": "#0094ce",
"edited": false
},
"widget-borderColor": {
"value": "#ffffff",
"edited": false
},
"base-font": {
"value": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
}
}
},
"site": {
"name": "Node-RED Dashboard",
"hideToolbar": "false",
"allowSwipe": "false",
"allowTempTheme": "true",
"dateFormat": "DD/MM/YYYY",
"sizes": {
"sx": 48,
"sy": 48,
"gx": 6,
"gy": 6,
"cx": 6,
"cy": 6,
"px": 0,
"py": 0
}
}
},
{
"id": "c3019e46.d79c1",
"type": "serial-port",
"z": "",
"serialport": "/dev/ttyS0",
"serialbaud": "9600",
"databits": "8",
"parity": "none",
"stopbits": "1",
"newline": "ÿÿÿ",
"bin": "false",
"out": "char",
"addchar": true
},
{
"id": "f843e278.809ed",
"type": "serial-port",
"z": "",
"serialport": "/dev/ttyS0",
"serialbaud": "9600",
"databits": "8",
"parity": "none",
"stopbits": "1",
"newline": "50",
"bin": "bin",
"out": "time",
"addchar": true
},
{
"id": "8d64239f.1092d",
"type": "serial-port",
"serialport": "/dev/ttyS2",
"serialbaud": "9600",
"databits": "8",
"parity": "none",
"stopbits": "1",
"newline": "100",
"bin": "false",
"out": "time",
"addchar": "false"
},
{
"id": "5244eeb6.efacc",
"type": "mqtt-broker",
"z": "",
"name": "",
"broker": "localhost",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "34daa89f.7e48b8",
"type": "serial in",
"z": "e1c07481.249ed8",
"name": "",
"serial": "587a989.90cbf68",
"x": 90,
"y": 100,
"wires": [
[
"616aa3d3.02896c",
"741ed342.d2352c"
]
]
},
{
"id": "c7023270.3c7ff",
"type": "function",
"z": "e1c07481.249ed8",
"name": "Opus Receive Text",
"func": "var buf = Buffer.from(msg.payload);\n\nvar message = buf.slice(21,21 + parseInt(msg.payload[19]))\n\nmsg.SID = parseInt(msg.payload[9])\nmsg.DID = parseInt(msg.payload[13])\nmsg.message = message.toString()\n \nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 510,
"y": 80,
"wires": [
[
"97e23cef.5987f"
]
],
"icon": "node-red/envelope.png"
},
{
"id": "f0069f2a.c192e",
"type": "inject",
"z": "e1c07481.249ed8",
"name": "",
"topic": "",
"payload": "102",
"payloadType": "num",
"repeat": "900",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"x": 110,
"y": 320,
"wires": [
[
"4f1ddd3f.564cd4"
]
]
},
{
"id": "fb883ac3.7ade88",
"type": "serial out",
"z": "e1c07481.249ed8",
"name": "",
"serial": "587a989.90cbf68",
"x": 490,
"y": 320,
"wires": []
},
{
"id": "8c96bc8d.083bf",
"type": "function",
"z": "e1c07481.249ed8",
"name": "Opus Send Text",
"func": "//Get Message Parameters\nvar message = msg.payload;\nvar destination = msg.topic;\n\n//Set buffer sizes\nvar dest = Buffer.alloc(4);\nvar source = Buffer.alloc(4);\nvar DataLength = Buffer.alloc(2);\nvar dLengthBuf = Buffer.alloc(2);\nvar dChecksumBuf = Buffer.alloc(2);\nvar ChecksumBuf = Buffer.alloc(2);\n\n//Set Constants\nvar p1 = Buffer.from([0xb1,0x0]);\nvar p2 = Buffer.from([0x44,0x53,0x01,0x01]);\nvar CallType = Buffer.from([0x01]); //0x00 for Private, 0x01 for Group\nvar NoEncrypt = Buffer.from([0x0]);\nvar EOM = Buffer.from([0xd,0xa]);\nvar sendEnd = Buffer.from([0xb4]);\n\n//Set Variables\nvar SourceID = source.writeInt16LE(0);\nvar DestinationID = dest.writeInt16LE(destination);\nvar Message = Buffer.from(message,\"utf16LE\");\nvar MessageLength = DataLength.writeInt16LE([Number(Message.length)]);\n\n//Set dLength\nvar dLengthCalc = Buffer.concat([source,dest,CallType,NoEncrypt,DataLength,Message]);\nvar dLength = dLengthBuf.writeInt16LE(dLengthCalc.length);\n\n//Set dChecksum\nvar dChecksumConcat = Buffer.concat([p2,dLengthBuf,source,dest,CallType,NoEncrypt,DataLength,Message]);\nvar dChecksumArray = dChecksumBuf.writeInt16LE(Array.prototype.slice.call(dChecksumConcat, 0).reduce((a, b) => a + b, 0));\n\n//Set CF2\nvar CF2 = Buffer.from([p2.length + dLengthBuf.length + source.length + dest.length + CallType.length + NoEncrypt.length + DataLength.length + Message.length + dChecksumBuf.length + EOM.length]);\n\n//Set Checksum\nvar ChecksumConcat = Buffer.concat([p1,CF2,p2,dLengthBuf,source,dest,CallType,NoEncrypt,DataLength,Message,dChecksumBuf,EOM]);\nvar ChecksumArray = ChecksumBuf.writeInt16LE(Array.prototype.slice.call(ChecksumConcat, 0).reduce((a, b) => a + b, 0));\n\n//Build Buffer\nvar array = [p1,CF2,p2,dLengthBuf,source,dest,CallType,NoEncrypt,DataLength,Message,dChecksumBuf,EOM,ChecksumBuf,sendEnd];\nvar buf = Buffer.concat(array);\n\n//Output Data\nmsg.payload = buf\n\nmsg.debug = DataLength\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 320,
"y": 260,
"wires": [
[
"21c169ba.217d66"
]
],
"icon": "font-awesome/fa-feed"
},
{
"id": "be63d2c8.4c932",
"type": "inject",
"z": "e1c07481.249ed8",
"name": "",
"topic": "240",
"payload": "Hello World",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 140,
"y": 260,
"wires": [
[
"8c96bc8d.083bf"
]
]
},
{
"id": "21c169ba.217d66",
"type": "serial out",
"z": "e1c07481.249ed8",
"name": "",
"serial": "587a989.90cbf68",
"x": 490,
"y": 260,
"wires": []
},
{
"id": "97e23cef.5987f",
"type": "template",
"z": "e1c07481.249ed8",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{{SID}} sent {{message}} to {{DID}}",
"output": "str",
"x": 680,
"y": 80,
"wires": [
[
"87d74a5f.6f16d8"
]
]
},
{
"id": "87d74a5f.6f16d8",
"type": "debug",
"z": "e1c07481.249ed8",
"name": "Processed Msg",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 840,
"y": 80,
"wires": []
},
{
"id": "616aa3d3.02896c",
"type": "switch",
"z": "e1c07481.249ed8",
"name": "Detect Message Type",
"property": "payload[1]",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "0",
"vt": "num"
},
{
"t": "eq",
"v": "1",
"vt": "str"
},
{
"t": "eq",
"v": "2",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 300,
"y": 100,
"wires": [
[
"c7023270.3c7ff"
],
[],
[
"fb72f3d5.4ebb3"
]
],
"info": "0 = New Text Message\n1 = Repeated Text Message\n2 = New Location\n3 = Repeated Location\n4 = "
},
{
"id": "4f1ddd3f.564cd4",
"type": "function",
"z": "e1c07481.249ed8",
"name": "Opus Request Location",
"func": "//Get Message Parameters\nvar destination = msg.payload;\n\n//Set buffer sizes\nvar dest = Buffer.alloc(4);\nvar dLengthBuf = Buffer.alloc(2);\nvar dChecksumBuf = Buffer.alloc(2);\nvar ChecksumBuf = Buffer.alloc(2);\n\n//Set Constants\nvar p1 = Buffer.from([0xb1,0x0]);\nvar p2 = Buffer.from([0x44,0x53,0x10,0x01]);\nvar EOM = Buffer.from([0xd,0xa]);\nvar sendEnd = Buffer.from([0xb4]);\n\n//Set Variables\nvar DestinationID = dest.writeInt16LE(destination);\n\n//Set dLength\nvar dLength = dLengthBuf.writeInt16LE(dest.length);\n\n//Set dChecksum\nvar dChecksumConcat = Buffer.concat([p2,dLengthBuf,dest]);\nvar dChecksumArray = dChecksumBuf.writeInt16LE(Array.prototype.slice.call(dChecksumConcat, 0).reduce((a, b) => a + b, 0));\n\n//Set CF2\nvar CF2 = Buffer.from([p2.length + dLengthBuf.length + dest.length + dChecksumBuf.length + EOM.length]);\n\n//Set Checksum\nvar ChecksumConcat = Buffer.concat([p1,CF2,p2,dLengthBuf,dest,dChecksumBuf,EOM]);\nvar ChecksumArray = ChecksumBuf.writeInt16LE(Array.prototype.slice.call(ChecksumConcat, 0).reduce((a, b) => a + b, 0));\n\n//Build Buffer\nvar array = [p1,CF2,p2,dLengthBuf,dest,dChecksumBuf,EOM,ChecksumBuf,sendEnd];\nvar buf = Buffer.concat(array);\n\n//Output Data\nmsg.payload = buf\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 290,
"y": 320,
"wires": [
[
"fb883ac3.7ade88"
]
],
"icon": "node-red/white-globe.png"
},
{
"id": "fb72f3d5.4ebb3",
"type": "function",
"z": "e1c07481.249ed8",
"name": "Opus Location",
"func": "var buf = Buffer.from(msg.payload);\n\n//Time\nvar hh = parseInt(msg.payload[25]);\nvar mm = parseInt(msg.payload[26]);\nvar ss = parseInt(msg.payload[27]);\nmsg.time = hh + \":\" + mm + \":\" + ss\n\n//Date\nvar YY = parseInt(msg.payload[21]);\nvar MM = parseInt(msg.payload[22]);\nvar DD = parseInt(msg.payload[23]);\nmsg.date = DD + \"/\" + MM + \"/\" + YY\n\n//Lattitude\nvar LAD = parseInt(msg.payload[13]);\nvar LAM = parseInt(msg.payload[14]);\nvar LASBUF = Buffer.from([msg.payload[15],msg.payload[16]])\nvar LAS = LASBUF.readInt16LE()/100;\nmsg.Lattitude = (LAD + ((LAM / 60) + (LAS/ 3600))).toFixed(6);\nmsg.lat = LAD + \"°\" + LAM + \"'\" + LAS + \"N\" // Cardinal needs to be changed automatically\n\n//Longitude\nvar LOD = parseInt(msg.payload[17]);\nvar LOM = parseInt(msg.payload[18]);\nvar LOSBUF = Buffer.from([msg.payload[19],msg.payload[20]])\nvar LOS= LOSBUF.readInt16LE()/100;\nmsg.Longitude = (LOD + ((LOM / 60) + (LOS / 3600))).toFixed(6);\nmsg.lon = LOD + \"°\" + LOM + \"'\" + LOS +\"E\" // Cardinal needs to be changed automatically\n\n\nvar message = buf.slice(21,21 + parseInt(msg.payload[19]))\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 500,
"y": 120,
"wires": [
[
"98868245.f6738",
"b5107223.cc294"
]
],
"icon": "font-awesome/fa-location-arrow"
},
{
"id": "95599129.96da8",
"type": "template",
"z": "e1c07481.249ed8",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Radio {{SID}} was at {{{lat}}} {{{lon}}} at {{{time}}} on {{{date}}}",
"output": "str",
"x": 1040,
"y": 120,
"wires": [
[
"cdc689cf.59f288"
]
]
},
{
"id": "741ed342.d2352c",
"type": "debug",
"z": "e1c07481.249ed8",
"name": "Raw Data",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 260,
"y": 40,
"wires": []
},
{
"id": "98868245.f6738",
"type": "debug",
"z": "e1c07481.249ed8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 670,
"y": 160,
"wires": []
},
{
"id": "d85f8726.6f2a68",
"type": "worldmap",
"z": "e1c07481.249ed8",
"name": "",
"lat": "51.345664",
"lon": "1.042480",
"zoom": "16",
"layer": "Esri",
"cluster": "",
"maxage": "",
"usermenu": "show",
"layers": "show",
"panit": "true",
"panlock": "false",
"zoomlock": "false",
"hiderightclick": "false",
"coords": "deg",
"showgrid": "true",
"path": "/worldmap",
"x": 1300,
"y": 160,
"wires": []
},
{
"id": "dcf0e7d8.f134b8",
"type": "template",
"z": "e1c07481.249ed8",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"name\":\"Radio\", \"lat\":{{{Lattitude}}}, \"lon\":{{{Longitude}}}}",
"output": "json",
"x": 1040,
"y": 160,
"wires": [
[
"62072a6f.161654",
"66006464.c68eec"
]
]
},
{
"id": "62072a6f.161654",
"type": "debug",
"z": "e1c07481.249ed8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 1190,
"y": 200,
"wires": []
},
{
"id": "66006464.c68eec",
"type": "worldmap-tracks",
"z": "e1c07481.249ed8",
"name": "",
"depth": "50",
"layer": "separate",
"x": 1170,
"y": 160,
"wires": [
[
"d85f8726.6f2a68"
]
]
},
{
"id": "b5107223.cc294",
"type": "switch",
"z": "e1c07481.249ed8",
"name": "Filter 0 lon",
"property": "Longitude",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "0.000000",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 690,
"y": 120,
"wires": [
[
"b736ef4d.9b39"
]
]
},
{
"id": "b736ef4d.9b39",
"type": "switch",
"z": "e1c07481.249ed8",
"name": "Filter 0 Lat",
"property": "Lattitude",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "0.000000",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 850,
"y": 120,
"wires": [
[
"dcf0e7d8.f134b8",
"59fbc040.a962c",
"95599129.96da8"
]
]
},
{
"id": "59fbc040.a962c",
"type": "debug",
"z": "e1c07481.249ed8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 1030,
"y": 80,
"wires": []
},
{
"id": "cdc689cf.59f288",
"type": "debug",
"z": "e1c07481.249ed8",
"name": "Processed Data",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 1200,
"y": 120,
"wires": []
},
{
"id": "6a2c70dc.f7365",
"type": "uibuilder",
"z": "e1c07481.249ed8",
"name": "",
"topic": "",
"url": "test",
"fwdInMessages": false,
"allowScripts": false,
"allowStyles": false,
"copyIndex": true,
"showfolder": true,
"x": 250,
"y": 420,
"wires": [
[
"11b49474.8176fc"
],
[
"16098427.8e500c"
]
]
},
{
"id": "14ef3e37.c13222",
"type": "inject",
"z": "e1c07481.249ed8",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 120,
"y": 420,
"wires": [
[
"6a2c70dc.f7365"
]
]
},
{
"id": "11b49474.8176fc",
"type": "debug",
"z": "e1c07481.249ed8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 410,
"y": 400,
"wires": []
},
{
"id": "16098427.8e500c",
"type": "debug",
"z": "e1c07481.249ed8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 410,
"y": 440,
"wires": []
}
]