|
4 | 4 | const net = require('net');
|
5 | 5 | const packet = require('packet');
|
6 | 6 | const TSLUMD = require('tsl-umd'); // TSL UDP package
|
| 7 | +const TSLUMDv5 = require('tsl-umd-v5'); |
7 | 8 | const dgram = require('dgram');
|
8 | 9 | const { Atem } = require('atem-connection');
|
9 | 10 | const AtemListVisibleInputs = require('atem-connection').listVisibleInputs;
|
@@ -633,6 +634,8 @@ var source_types_panasonic = [ // AV-HS410 INPUTS
|
633 | 634 | var output_types = [ //output actions that Tally Arbiter can perform
|
634 | 635 | { id: '7dcd66b5', label: 'TSL 3.1 UDP', type: 'tsl_31_udp', enabled: true},
|
635 | 636 | { id: '276a8dcc', label: 'TSL 3.1 TCP', type: 'tsl_31_tcp', enabled: true },
|
| 637 | + { id: '8b99d588', label: 'TSL 5 UDP', type: 'tsl_5_udp', enabled: true }, |
| 638 | + { id: '54ae4a7e', label: 'TSL 5 TCP', type: 'tsl_5_tcp', enabled: true }, |
636 | 639 | { id: 'ffe2b0b6', label: 'Outgoing Webhook', type: 'webhook', enabled: true},
|
637 | 640 | { id: '79e3ce27', label: 'Generic TCP', type: 'tcp', enabled: true},
|
638 | 641 | { id: '4827f903', label: 'RossTalk', type: 'rosstalk', enabled: true},
|
@@ -663,6 +666,30 @@ var output_types_datafields = [ //data fields for the outgoing actions
|
663 | 666 | { fieldName: 'tally4', fieldLabel: 'Tally 4', fieldType: 'bool' }
|
664 | 667 | ]
|
665 | 668 | },
|
| 669 | + { outputTypeId: '8b99d588', fields: [ //TSL 5 UDP |
| 670 | + { fieldName: 'ip', fieldLabel: 'IP Address', fieldType: 'text' }, |
| 671 | + { fieldName: 'port', fieldLabel: 'Port', fieldType: 'port' }, |
| 672 | + { fieldName: 'index', fieldLabel: 'Address Index', fieldType: 'number' }, |
| 673 | + { fieldName: 'screen', fieldLabel: 'Screen', fieldType: 'number' }, |
| 674 | + { fieldName: 'text', fieldLabel: 'Label', fieldType: 'text' }, |
| 675 | + { fieldName: 'text_tally', fieldLabel: 'Text Tally', fieldType: 'dropdown', options: [ { id: '0', label: 'Off' }, { id: '1', label: 'Red'}, { id: '2', label: 'Green'}, { id: '3', label: 'Amber'} ] }, |
| 676 | + { fieldName: 'rh_tally', fieldLabel: 'Right Tally', fieldType: 'dropdown', options: [ { id: '0', label: 'Off' }, { id: '1', label: 'Red'}, { id: '2', label: 'Green'}, { id: '3', label: 'Amber'} ] }, |
| 677 | + { fieldName: 'lh_tally', fieldLabel: 'Left Tally', fieldType: 'dropdown', options: [ { id: '0', label: 'Off' }, { id: '1', label: 'Red'}, { id: '2', label: 'Green'}, { id: '3', label: 'Amber'} ] }, |
| 678 | + { fieldName: 'brightness', fieldLabel: 'Brightness', fieldType: 'dropdown', options: [ { id: '0', label: '0' }, { id: '1', label: '1'}, { id: '2', label: '2'}, { id: '3', label: '3'} ] } |
| 679 | + ] |
| 680 | + }, |
| 681 | + { outputTypeId: '54ae4a7e', fields: [ //TSL 5 TCP |
| 682 | + { fieldName: 'ip', fieldLabel: 'IP Address', fieldType: 'text' }, |
| 683 | + { fieldName: 'port', fieldLabel: 'Port', fieldType: 'port' }, |
| 684 | + { fieldName: 'index', fieldLabel: 'Address Index', fieldType: 'number' }, |
| 685 | + { fieldName: 'screen', fieldLabel: 'Screen', fieldType: 'number' }, |
| 686 | + { fieldName: 'text', fieldLabel: 'Label', fieldType: 'text' }, |
| 687 | + { fieldName: 'text_tally', fieldLabel: 'Text Tally', fieldType: 'dropdown', options: [ { id: '0', label: 'Off' }, { id: '1', label: 'Red'}, { id: '2', label: 'Green'}, { id: '3', label: 'Amber'} ] }, |
| 688 | + { fieldName: 'rh_tally', fieldLabel: 'Right Tally', fieldType: 'dropdown', options: [ { id: '0', label: 'Off' }, { id: '1', label: 'Red'}, { id: '2', label: 'Green'}, { id: '3', label: 'Amber'} ] }, |
| 689 | + { fieldName: 'lh_tally', fieldLabel: 'Left Tally', fieldType: 'dropdown', options: [ { id: '0', label: 'Off' }, { id: '1', label: 'Red'}, { id: '2', label: 'Green'}, { id: '3', label: 'Amber'} ] }, |
| 690 | + { fieldName: 'brightness', fieldLabel: 'Brightness', fieldType: 'dropdown', options: [ { id: '0', label: '0' }, { id: '1', label: '1'}, { id: '2', label: '2'}, { id: '3', label: '3'} ] } |
| 691 | + ] |
| 692 | + }, |
666 | 693 | { outputTypeId: 'ffe2b0b6', fields: [ //Outgoing Webhook
|
667 | 694 | { fieldName: 'protocol', fieldLabel: 'Protocol', fieldType: 'dropdown', options: [ { id: 'http://', label: 'HTTP' }, { id: 'https://', label: 'HTTPS'} ] },
|
668 | 695 | { fieldName: 'ip', fieldLabel: 'IP Address/URL', fieldType: 'text' },
|
@@ -2539,9 +2566,7 @@ function SetUpTSL5Server_TCP(sourceId)
|
2539 | 2566 | });
|
2540 | 2567 |
|
2541 | 2568 | socket.on('close', function () {
|
2542 |
| - logger(`Source: ${source.name} TSL 5.0 Server connection closed.`, 'info'); |
2543 |
| - StopTSLServer_TCP(sourceId); |
2544 |
| - CheckReconnect(sourceId); |
| 2569 | + logger(`Source: ${source.name} TSL 5.0 Server remote disconnected`, 'info'); |
2545 | 2570 | });
|
2546 | 2571 | }).listen(port, function() {
|
2547 | 2572 | logger(`Source: ${source.name} TSL 5.0 Server started. Listening for data on TCP Port: ${port}`, 'info');
|
@@ -5259,6 +5284,12 @@ function RunAction(deviceId, busId, active) {
|
5259 | 5284 | case 'tsl_31_tcp':
|
5260 | 5285 | RunAction_TSL_31_TCP(actionObj.data);
|
5261 | 5286 | break;
|
| 5287 | + case 'tsl_5_udp': |
| 5288 | + RunAction_TSL_5_UDP(actionObj.data); |
| 5289 | + break; |
| 5290 | + case 'tsl_5_tcp': |
| 5291 | + RunAction_TSL_5_TCP(actionObj.data); |
| 5292 | + break; |
5262 | 5293 | case 'webhook':
|
5263 | 5294 | RunAction_Webhook(actionObj.data);
|
5264 | 5295 | break;
|
@@ -5365,6 +5396,68 @@ function RunAction_TSL_31_TCP(data) {
|
5365 | 5396 | }
|
5366 | 5397 | }
|
5367 | 5398 |
|
| 5399 | +function RunAction_TSL_5_UDP(data) { |
| 5400 | + try { |
| 5401 | + var umd = new TSLUMDv5(); |
| 5402 | + var display_fields = ['rh_tally', 'text_tally', 'lh_tally', 'brightness',' text'] |
| 5403 | + let tally = { display: {} } |
| 5404 | + |
| 5405 | + if (!data.ip | !data.port) { |
| 5406 | + logger('Error in TSL 5 UDP Action. IP and Port must be given', 'error') |
| 5407 | + } |
| 5408 | + if (!data.index) { |
| 5409 | + logger('TSL 5 UDP Action. No index given. Using index 1 by default', 'info') |
| 5410 | + tally.index = 1 |
| 5411 | + } |
| 5412 | + |
| 5413 | + for (var [key, value] of Object.entries(data)) { |
| 5414 | + if (display_fields.includes(key)) { |
| 5415 | + tally.display[key] = value |
| 5416 | + } |
| 5417 | + else { |
| 5418 | + tally[key] = value |
| 5419 | + } |
| 5420 | + } |
| 5421 | + |
| 5422 | + umd.sendTallyUDP(data.ip, data.port, tally) |
| 5423 | + logger(`TSL 5 UDP Data sent.`, 'info'); |
| 5424 | + } |
| 5425 | + catch (error) { |
| 5426 | + logger(`An error occured sending the TSL 5 UDP Message: ${error}`, 'error'); |
| 5427 | + } |
| 5428 | +} |
| 5429 | + |
| 5430 | +function RunAction_TSL_5_TCP(data) { |
| 5431 | + try { |
| 5432 | + var umd = new TSLUMDv5(); |
| 5433 | + var display_fields = ['rh_tally', 'text_tally', 'lh_tally', 'brightness',' text'] |
| 5434 | + let tally = { display: {} } |
| 5435 | + |
| 5436 | + if (!data.ip | !data.port) { |
| 5437 | + logger('Error in TSL 5 TCP Action. IP and Port must be given', 'error') |
| 5438 | + } |
| 5439 | + if (!data.index) { |
| 5440 | + logger('TSL 5 TCP Action. No index given. Using index 1 by default', 'info') |
| 5441 | + tally.index = 1 |
| 5442 | + } |
| 5443 | + |
| 5444 | + for (var [key, value] of Object.entries(data)) { |
| 5445 | + if (display_fields.includes(key)) { |
| 5446 | + tally.display[key] = value |
| 5447 | + } |
| 5448 | + else { |
| 5449 | + tally[key] = value |
| 5450 | + } |
| 5451 | + } |
| 5452 | + |
| 5453 | + umd.sendTallyTCP(data.ip, data.port, tally) |
| 5454 | + logger(`TSL 5 TCP Data sent.`, 'info'); |
| 5455 | + } |
| 5456 | + catch (error) { |
| 5457 | + logger(`An error occured sending the TSL 5 TCP Message: ${error}`, 'error'); |
| 5458 | + } |
| 5459 | +} |
| 5460 | + |
5368 | 5461 | function RunAction_Webhook(data) {
|
5369 | 5462 | try {
|
5370 | 5463 | let path = data.path ? (data.path.startsWith('/') ? data.path : '/' + data.path) : '';
|
|
0 commit comments