forked from willosof/node-barco-eventmaster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
947 lines (719 loc) · 36.4 KB
/
index.js
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
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
var util = require('util');
var rest = require('node-rest-client').Client;
function eventmaster(ip) {
var self = this;
self.ip = ip;
self.rest = new rest();
if (ip == undefined) {
console.error("NO IP SPECIFIED FOR EVENTMASTER")
return;
}
return self;
}
eventmaster.prototype.query = function(method,params,cb) {
var self = this;
var args = {
data: {
method: method,
params: params,
jsonrpc: "2.0",
id: "0"
},
headers: {
"Content-Type": "application/json"
}
};
return self.rest.post("http://"+self.ip+":9999/jsonrpc", args, function (data, response) {
if (cb !== undefined && typeof cb === "function") {
if (data.result !== undefined && data.result.success == 0) {
cb(null, data.result.response);
}
else {
cb(true, data);
}
}
});
};
// DEFINITIONS FROM EM 5.0
/*
Definition
– It executes “allTrans” command.
Request
params: {} - It doesn’t require any parameter.
Returns
response: null
success: (0=success, anything else an error)
Example
– {"params":{}, "method":"allTrans", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.allTrans = function(cb) {
var self = this;
return self.query("allTrans", {}, cb);
}
/*
Definition
– It executes “Cut” command.
Request
params: {} - It doesn’t require any parameter.
Returns
response: null
success: (0=success, anything else an error)
Example
– {"params":{}, "method":"cut", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.cut = function(cb) {
var self = this;
return self.query("cut", {}, cb);
}
/*
Definition
– Expose ALL reset types on Event Master processor with different options.
Request
params: – {"reset":x}
possible Value: “x” can be 0 – 5. - 0: Soft reset.- 1: Factory reset. - 2: Factory reset (save IP). - 3: Factory reset (save IP/EDID). - 4: Factory reset (save VPID). - 5: Shut Down.
Returns
response: null
success: (0=success, anything else an error)
Example
– {"params":{"reset": 0}, "method":"resetFrameSettings", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.resetFrameSettings = function(resetKind, cb) {
var self = this;
return self.query("resetFrameSettings", { reset: resetKind }, cb);
}
/*
Definition
– This queries the power plug status of the Event Master processor. (There can be 1 or 2 power slots in Event Master processor).
Request
params: {} It doesn’t require any parameter.
Returns
response: {FrameId1 :{ PwrStatus1, PwrStatus2},{FrameId2 :{ PwrStatus1, PwrStatus2} - PwrStatus1 gives the power status of the 1st slot in Event Master processor with frame id FrameId1, FrameId2. - PwrStatus2 gives the power status of the 2nd slot in Event Master processor with frame id FrameId1, FrameId2.
success: (0=success, anything else an error)
Example
– {"params":{}, "method":"powerStatus", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.powerStatus = function(cb) {
var self = this;
return self.query("powerStatus", {}, cb);
}
/*
Definition
– This queries the list of presets on a particular destination or on the system.
Request
params: {"ScreenDest":x , "AuxDest":x}
possible Value: “x” can be: -2: Do not include any destinations of this type. –1: Do not care (All presets). 0–999: want to see the presets with the destination this particular id in it or array of ids. Eg. "ScreenDest":0
Returns
response: Array of presets: [{"id": 0, "Name": "Preset3.00", "LockMode": 0, "presetSno": 3.00},{"id": 1, "Name": "Preset4.00", "LockMode": 0, "presetSno": 4.00}]. Response contains id, name, lock mode preset serial number of the all the presets.
success: (0=success, anything else an error)
Example
– {"params":{"ScreenDest": 0}, "method":"listPresets", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.listPresets = function(ScreenDest, AuxDest, cb) {
var self = this;
if (ScreenDest == null) ScreenDest = -1;
if (AuxDest == null) AuxDest = -1;
return self.query("listPresets", { ScreenDest: ScreenDest, AuxDest: AuxDest }, cb);
}
/*
Definition
– Lists the content of a Preset.
Request
params: {“id”:x }
possible Value: “x” can be: –1: List all presets. 0–999: list only that specific preset.
Returns
response: Array of presets: [{"id": 0, "Name": "Preset3.00", "LockMode": 0, "presetSno": 3.00,"ScreenDest":[{"id": 0}, {"id": 3}],"AuxDest":[{"id": 0}, {"id": 1}]}]. Response contains id, name, lock mode preset serial number and associated Screen and Aux destinations of the all the presets.
success: (0=success, anything else an error)
Example
– { "params":{"id": 0}, "method":"listDestinationsForPreset", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.listDestinationsForPreset = function(presetId) {
var self = this;
if (presetId == null) presetId = -1;
return self.query("listDestinationsForPreset", { id: presetId }, cb);
}
/*
Definition
– Creates a Preset on the Event Master processor.
Request
params: {"presetName": "NewPreset", "ScreenDestination":[{"id": 2}, {"id": 3}],"AuxDestination":[{"id": 1}, {"id": 2}]}
possible Value: “presetName”—Name of the preset to save. - ScreenDestinations—ScreenDest id for which preset to be created. - AuxDestinations—AuxDest id for which preset to be created. - ScreenDestination, AuxDestinations are optional parameters. If user didn’t provide it, preset will be saved for selected destinations.
Returns
response: null
success: (0=success, anything else an error)
Example
– {"params": {"presetName": "NewPreset"}, "method":"savePreset", "id":"1234", "jsonrpc":"2.0"}
– {"params": {"presetName": "NewPreset", "ScreenDestination":{"id": 0},"AuxDestination":{"id": 0}}, "method":"savePreset", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.savePreset = function(presetName, ScreenDestinationsArray, AuxDestinationsArray, cb) {
var self = this;
return self.query("savePreset", {
presetName: presetName,
ScreenDestination: ScreenDestinationsArray,
AuxDestination: AuxDestinationsArray
}, cb);
};
/*
Definition
– Rename a Preset on the Event Master processor. User can rename Preset with id, Preset serial number, or preset name. – Send any one of the parameters to rename Preset.
Request
params: {"id": x, "newPresetName": "NewPresetName"}
params: {"presetSno": x.y, "newPresetName": "NewPresetName"}
params: {"presetName": "OldPresetName", "newPresetName": "NewPresetName"}
possible Value: "x" is the valid preset id. "x.y" is possible preset serial number. “newPresetName”— New Preset name to set
Returns
response: null
success: (0=success, anything else an error)
Example
– {"params": {"id": 0, "newPresetName": " newPresetName "}, "method":"renamePreset", "id":"1234", "jsonrpc":"2.0"}
– {"params": {"presetName": "NewPreset", "newPresetName": "NewPresetName"}, "method":"renamePreset", "id":"1234", "jsonrpc":"2.0"}
– {"params": {"presetSno": 1.00, "newPresetName": " newPresetName "}, "method":"renamePreset", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.renamePresetById = function(presetId, newPresetName, cb) {
var self = this;
return self.query("renamePreset", { id: presetId, newPresetName: newPresetName }, cb);
}
eventmaster.prototype.renamePresetBySno = function(presetSno, newPresetName, cb) {
var self = this;
return self.query("renamePreset", { presetSno: presetSno, newPresetName: newPresetName }, cb);
}
eventmaster.prototype.renamePresetByName = function(presetName, newPresetName, cb) {
var self = this;
return self.query("renamePreset", { presetName: presetName, newPresetName: newPresetName }, cb);
}
/*
Definition
– Recall a Preset on the Event Master processor. User can recall Preset with id, Preset serial number, or Preset name. – Send any one of the parameters to recall Preset.
Request
params: {"id": x, "type": x}
params: {"presetSno": x.y, "type": x}
params: {"presetName": "PresetName"}
possible Value: “type”—0 to recall in preview (default), 1 to recall in program. This is not a mandatory parameter but should be given when the user wants to recall a Preset in program.
Returns
response: null
success: (0=success, anything else an error)
Example
– {"params": {"id": 0, "type": 0}, "method":"activatePreset", "id":"1234", "jsonrpc":"2.0"}
– {"params": {"presetName": "abc" }, "method":"activatePreset", "id":"1234", "jsonrpc":"2.0"}
– {"params": {"presetSno": 1.00, "type": 1}, "method":"activatePreset", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.activatePresetById = function(presetId, recallInProgramInt, cb) {
var self = this;
return self.query("activatePreset", { id: presetId, type: recallInProgramInt }, cb);
}
eventmaster.prototype.activatePresetBySno = function(presetSno, recallInProgramInt, cb) {
var self = this;
return self.query("activatePreset", { presetSno: presetSno, type: recallInProgramInt }, cb);
}
eventmaster.prototype.activatePresetByName = function(presetName, recallInProgramInt, cb) {
var self = this;
return self.query("activatePreset", { presetName: presetName, type: recallInProgramInt }, cb);
}
/*
* Added in 8.2
* "activatePreset": added parameters when Multi-Operator is active to recall a preset either as a particular normal operator or as the Super operator (with password).
* Example to recall preset 51 as operator 1: {"params": {"presetSno": 51, "operatorId": 0}, "method":"activatePreset", "id":"1234", "jsonrpc":"2.0"}
* Example to recall preset 51 as the Super operator: {"params": {"presetSno": 51, "password": "password"}, "method":"activatePreset", "id":"1234", "jsonrpc":"2.0"}
* NOTE: The additional user parameters must also be added in order to Delete or Save Presets and for All Trans & Cut commands when Multi-Operator is active on the system.
*/
eventmaster.prototype.activatePresetByIdSuper = function(presetId, recallInProgramInt, password, cb) {
var self = this;
return self.query("activatePreset", { id: presetId, type: recallInProgramInt, password: password }, cb);
}
eventmaster.prototype.activatePresetBySnoSuper = function(presetSno, recallInProgramInt, password, cb) {
var self = this;
return self.query("activatePreset", { presetSno: presetSno, type: recallInProgramInt, password: password }, cb);
}
eventmaster.prototype.activatePresetByNameSuper = function(presetName, recallInProgramInt, password, cb) {
var self = this;
return self.query("activatePreset", { presetName: presetName, type: recallInProgramInt, password:password }, cb);
}
eventmaster.prototype.activatePresetByIdOperator = function(presetId, recallInProgramInt, operatorId, cb) {
var self = this;
return self.query("activatePreset", { id: presetId, type: recallInProgramInt, operatorId: operatorId }, cb);
}
eventmaster.prototype.activatePresetBySnoOperator = function(presetSno, recallInProgramInt, operatorId, cb) {
var self = this;
return self.query("activatePreset", { presetSno: presetSno, type: recallInProgramInt, operatorId: operatorId }, cb);
}
eventmaster.prototype.activatePresetByNameOperator = function(presetName, recallInProgramInt, operatorId, cb) {
var self = this;
return self.query("activatePreset", { presetName: presetName, type: recallInProgramInt, operatorId:operatorId }, cb);
}
/*
Definition
– Delete a Preset on the Event Master processor. User can delete Preset with id, Preset serial number, or Preset name. – Send any one of the parameters to delete Preset.
Request
params: {"id": x}
params: {"presetSno": x.y}
params: {"presetName": "PresetName"}
Returns
response: null
success: (0=success, anything else an error)
Example
– {"params": {"id": 1}, "method":"deletePreset", "id":"1234", "jsonrpc":"2.0"}
– {"params": {"presetSno": 1.00}, "method":"deletePreset", "id":"1234", "jsonrpc":"2.0"}
– {"params": {"presetName": "Preset 5.00"}, "method":"deletePreset", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.deletePresetById = function(presetId, cb) {
var self = this;
return self.query("deletePreset", { id: presetId }, cb);
}
eventmaster.prototype.deletePresetBySno = function(presetSno, cb) {
var self = this;
return self.query("deletePreset", { presetSno: presetSno }, cb);
}
eventmaster.prototype.deletePresetByName = function(presetName, cb) {
var self = this;
return self.query("deletePreset", { presetName: presetName }, cb);
}
/*
Definition
– Recall the next Preset on the Event Master processor. – No parameter is required – Make sure that the user has at least recalled one Preset. Web app recalls the next Preset from the last Preset recalled
Request
params: {}
Returns
response: null
success: (0=success, anything else an error)
Example
– {"params": {}, "method":" recallNextPreset", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.recallNextPreset = function(cb) {
var self = this;
return self.query("recallNextPreset", {}, cb);
}
/*
Definition
– This API lists all the destinations with properties such as layers, outputs, id, size, and name.
Request
params: {"type": x}
possible Value: "x" can be 0 — Show all the destinations, 0 is the default value for the type parameter. 1—Only screen destinations, 2—Only aux destinations.
Returns
response: Array of destinations : {"ScreenDestination":[{"id": 0, "Name": "Dest1", "HSize": 3840, "VSize": 1080, "Layers": 1,"DestOutMapColl":[{"id": 0"DestOutMap":[{"id": 0, "Name": "Out1", "HPos": 0, "VPos": 0, "HSize": 1920, "VSize":1080, "Freeze": 0},{"id": 1, "Name": "Out2", "HPos": 1920, "VPos": 0, "HSize": 1920, "VSize":1080, "Freeze": 1}]}]}],"AuxDestination":[{"id": 0, "AuxStreamMode": 4}, {"id": 1, "AuxStreamMode": 4}]}"
success: (0=success, anything else an error)
Example
– {"params": {"type": 0}, "method":"listDestinations", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.listDestinations = function(type, cb) {
var self = this;
return self.query("listDestinations", { type: type }, cb);
}
/*
Definition
– This API lists all the input sources with properties.
Request
params: {"type": x}
possible Value: "x" can be : 0 — Show all the input sources. 0 is the default value for the type parameter. 1 — Only background sources.
Returns
response: Array of : {"id": 0, "Name": "InSource1", "HSize": 3840, "VSize": 1080, "Src-Type": 0, "InputCfgIndex": -1, "StillIndex": 0, "DestIndex": -1, "UserKeyIndex": -1, "Mode3D": 0, "Freeze": 1, "Capacity": 2, "InputCfgVideoStatus": 4}
success: (0=success, anything else an error)
Example
– {"params": {"type": 0}, "method":"listSources", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.listSources = function(type, cb) {
var self = this;
return self.query("listSources", { type: type }, cb);
}
/*
listContent
Definition
– This API shows the content of a screen destination.
Request
params: {"id": x}
possible Value: “id”—Screen destination index.
Returns
response: { "id": 0, "Name": "ScreenDest1""BGLyr":[{"id": 0, "LastBGSourceIndex": 0,"BGShowMatte":0, "BGColor":[{"id":0, "Red":0, "Green":0, "Blue":0}]}, {"id": 1, "LastBGSourceIndex":0, "BGShowMatte":0, "BGColor":[{"id":0, "Red":0, "Green":0, "Blue":0}]}],(0= PGM Background, 1 = PVW Background)"Layers":[{"id": 0, "LastSrcIdx": 0, "HPos": 0,"VPos": 0, "HSize": 400, "VSize": 300, "PvwMode": 0, "PgmMode": 0, "Freeze": 0,"FlexZOrder": 0,"LayerTrans":[{"id": 0, "TransTime": 30, "TransPos": 0}, {"id": 1,"TransTime": 30, "TransPos": 0}] , "3D": "Yes", "Freeze": 0, "Capacity": 2}]}]}
Response Param: - id—index of screen destination. - Name—Name of ScreenDestination. - BGLayer—There are 2 bglayer , one in program and one in preview. Hence, showing Index of background on screen destination. - LastBGSoureIndex—This is –1 if no background is dropped, else this is index of last background dropped on screen destination. - BGShowMatte—This is if BG to be matte or not. - BGColor—This is background color. - Layers—Lists layers on screen destination with its properties. - Transition—This property of screen destination contains the transition time (from time to move from preview to program).
success: (0=success, anything else an error)
Example
– {"params": {"id": 0}, "method":"listContent", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.listContent = function(id, cb) {
var self = this;
return self.query("listContent", { id: id }, cb);
}
/*
Definition
– This API changes the content of a screen destination by putting background and layers in it.
Request
params: {
"id":0,
"BGLyr":[
{
"id":0,
"LastBGSourceIndex":0,
"BGShowMatte":0,
"BGColor":[
{ "id":0, "Red":0, "Green":0, "Blue":0 }
]
},
{
"id":1,
"LastBGSourceIndex":0,
"BGShowMatte":0,
"BGColor":[
{ "id":0, "Red":0, "Green":0, "Blue":0 }
]
}
],
"Layers":[
{
"id":0,
"LastSrcIdx":0,
"Window":{
"HPos":0,"VPos":0,"HSize":400,"VSize":300
},
"Source":{
"HPos":0,"VPos":0,"HSize":1920,"VSize":1080
},
"Mask":{
"Left":0.01,"Right":10.1, "Top":0.0,"Bottom":0.0
},
"PvwMode":1,
"PgmMode":0,
"Freeze":0,
"Pgm-ZOrder":0,
"PvwZOrder":0
}
]
}
Request Param,: - id—index of screen destination. - BGLayer—Background layer index, Last source index of background - Layers—Layer information. - Window—Layer window size. - Source—Source info and size. - Mask—Crop the visible part of the layer. - PvwMode—Set 1 if you want the content in preview. (Default). - PgmMode—Set 1 if you want the content in program.
Returns
response: null
success: (0=success, anything else an error)
Example
– {"params":{"id":0,"BGLyr":[{"id":0,"LastBGSourceIndex":0,"BGShowMatte":0,"BGColor":[{"id":0,"Red":0,"Green":0,"Blue":0}]},{"id":1,"LastBGSourceIndex":0,"BGShowMatte":0,"BGColor":[{"id":0,"Red":0,"Green":0,"Blue":0}]}],"Layers":[{"id":0,"LastSrcIdx":0,"Window":{"HPos":0,"VPos":0,"HSize":400,"VSize":300},"Source":{"HPos":0,"VPos":0,"HSize":1920,"VSize":1080}, "Mask":{ "Left":0.01,"Right":10.1, "Top":0.0,"Bottom":0.0},"PvwMode":1,"PgmMode":0,"Freeze":0,"Pgm-ZOrder":0,"PvwZOrder":0}]}, "method":"changeContent", "id":"1234", "jsonrpc":"2.0"}.
*/
eventmaster.prototype.changeContent = function(screenDestIndex, bgLayer, Layers, cb) {
var self = this;
return self.query("changeContent", { id: screenDestIndex, BGLyr: bgLayer, Layers: Layers }, cb);
}
/*
Definition
– This API changes the source in the Aux destinations.
Request
params: {
"id":x ,
"Name": "AuxDest1" ,
"PvwLastSrcIndex": y ,
"PgmLastSrcIndex": z
}
Request Param,: - Id—Index of the Aux destination.
Returns
response: null
success: (0=success, anything else an error)
Example
– {"params": {"id":0 , "Name": "AuxDest1" , "PvwLastSrcIndex": 6 , "PgmLastSrcIndex":1}, "method":"changeAuxContent", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.changeAuxContent = function(id, pvwLastSrcIndex, pgmLastSrcIndex, cb) {
var self = this;
return self.query("changeAuxContent", { id: id, PvwLastSrcIndex: pvwLastSrcIndex, PgmLastSrcIndex: pgmLastSrcIndex }, cb);
}
eventmaster.prototype.changeAuxContentName = function(id, name, pvwLastSrcIndex, pgmLastSrcIndex, cb) {
var self = this;
return self.query("changeAuxContent", { id: id, name: name, PvwLastSrcIndex: pvwLastSrcIndex, PgmLastSrcIndex: pgmLastSrcIndex }, cb);
}
/*
Definition
– This API Freezes/Unfreezes the sources.
Request
params: {
"type": x,
"id": y,
"screengroup": z ,
"mode": z
}
Request Param,: - type — type of source. 0 — Input source.◦ 1 — Background source.◦ 2 — ScreenDestination. 3 — AuxDestination. - id—Index of the source. - Screengroup—For future use. Always set to 0 .– Mode- 0 : UnFreeze, 1 : Freeze.
Returns
response: null
success: (0=success, anything else an error)
Example
– {"params": {"type": 0, "id": 0, "screengroup": 0 ,"mode": 1}, "method":"freezeDest-Source", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.freezeDestSource = function(type, id, screenGroup, mode, cb) {
var self = this;
return self.query("freezeDestSource", { type: type, id: id, screengroup: screenGroup, mode: mode }, cb);
}
/*
Definition
– This API lists all the stills with properties such as id, Name, H/V size, LockMode, StillState, PngState, File size.
Request
params: – {}
Returns
response: Array of : [{"id":0,"Name":"StillStore1","Lock-Mode":0,"HSize":{"Min":0,"Max":99999,"$t":1920},"VSize":{"Min":0,"Max":99999,"$t":1080},"Still-State":{"Min":0,"Max":4,"$t":3},"PngState":{"Min":0,"Max":2,"$t":0},"File-Size":{"Min":0,"Max":100000,"$t":9331.2}}]
Response Param: - id—Index of still store. - Name—Name of still store. - LockMode—For future use. Always set to 0. - H/V size—Horizontal and vertical size, Min, max and current value. It shows the current value. - StillState—This tells user if the still is currently being captured or not, or if it is getting deleted. - PngState—The “PNG” for stills are for the thumbnails we capture for the stills. - FileSize—Size of the file created in KBs.
success: (0=success, anything else an error)
Example
– {"params": {}, "method":"listStill", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.listStill = function(cb) {
var self = this;
return self.query("listStill", {}, cb);
}
/*
Definition
– This API deletes a still.
Request
params: – {“id”: x}
Request Param,: - id—Index of still.
Returns
response: null
success: (0=success, anything else an error)
Example
– {"params":{"id": 0}, "method":"deleteStill", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.deleteStill = function(stillIndex,cb) {
var self = this;
return self.query("deleteStill", { id:stillIndex }, cb);
}
/*
Definition
– This API creates/overwrites a still.
Request
params: - {
"type": x,
"id": y,
“file”: z
}
Request Param,: - type – 0 for input source, 1 for BG source. Id – Index of the input source. If source id of destination is provided, no still be create and an error will be shown. File – still file id. If you pass “file” : 5, this will create StillStore6
Returns
response: null
success: (0=success, anything else an error)
Example
– {"params":{"type":0 , "id": 1, “file”: 5}, "method":"takeStill", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.takeStill = function(type, id, fileid, cb) {
var self = this;
return self.query("takeStill", { type: type, id: id, file: fileid }, cb);
}
/*
Definition
– This API shows system information, including all the frames information.
Request
params: – {}
Returns
response: – {"System":{"id":0,"Name":"System1","FrameCollection":{"id":0,"Frame":{"id":"00:0c:29:0e:86:d4","Name":"E2","Contact":"","Version":"4.2.30738","OSVersion":"NA","FrameType":0,"FrameTypeName":"E2","Enet":{"Dhcp-Mode":0,"DhcpModeName":"Static","IP":"10.98.0.165","StaticIP":"192.168.000.175","MacAddress":"00:0c:29:0e:86:d4","StaticMask":"255.255.255.000","StaticGateway":"192.168.000.001"},"SysCard":{"SlotState":2,"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":80,"CardTypeLabel":"System","CardID":0},"Slot":[{"Card":{"Card-StatusID":2,"CardStatusLabel":"Ready","CardTypeID":70,"CardTypeLabel":"Expansion","CardID":"thisissometextforid0"}},{"Card":{"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":70,"CardTypeLabel":"Expansion","CardID":"thisissometextforid1"}},{"Card":{"CardStatusID":0,"CardStatusLabel":"NotInstalled","CardTypeID":255,"CardTypeLabel":"Unknown","CardID":"Undefined"}},{"Card":{"CardStatusID":2,"CardStatus-Label":"Ready","CardTypeID":1,"CardTypeLabel":"SDIInput","CardID":"thisissometextforid211"}},{"Card":{"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":3,"CardID":"thisissometextforid2"}},{"Card":{"Card-StatusID":2,"CardStatusLabel":"Ready","CardTypeID":0,"CardTypeLabel":"DVIInput","CardID":"thisissometextforid4"}},{"Card"{"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":2,"CardTypeLabel":"HDMI/DPInput","CardID":"thisissometextforid5"}},{"Card"{"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":2,"CardTypeLabel":"HDMI/DPInput","CardID":"thisissometextforid7"}},{"Card"{"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":2,"CardTypeLabel":"HDMI/DPInput","CardID":"thisissometextforid8"}},{"Card"{"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":2,"CardTypeLabel":"HDMI/DPInput","CardID":"thisissometextforid9"}},{"Card":{"CardStatusID":2,"Card-StatusLabel":"Ready","CardTypeID":22,"CardTypeLabel":"HDMIOutput","CardID":"CardID3"}},{"Card":{"CardStatusID":2,"Card-StatusLabel":"Ready","CardTypeID":22,"CardTypeLabel":"HDMIOutput","CardID":"CardID4"}},{"Card":{"CardStatusID":2,"Card-StatusLabel":"Ready","CardTypeID":21,"CardTypeLabel":"SDIOutput","CardID":"CardID415"}},{"Card":{"CardStatusID":2,"CardStatusLabel":"Ready","Card-TypeID":40,"CardTypeLabel":"MVR","CardID":"CardID15"}},{"Card":{"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":50,"CardTypeLabel":"VPUScaler","CardID":"thisissometextforid501"},{"Card"{"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":50,"CardTypeLabel":"VPUScaler","CardID":"thisissometextforid502"}},{"Card"{"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":50,"CardTypeLabel":"VPUScaler","CardID":"thisissometextforid503"}},{"Card"{"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":50,"CardTypeLabel":"VPUScaler","CardID":"thisissometextforid504"}},{"Card":{"Card-StatusID":0,"CardStatusLabel":"NotInstalled","CardTypeID":255,"CardTypeLabel":"Unknown","CardID":"Undefined"}},{"Card":{"CardStatusID":2,"CardStatus-Label":"Ready","CardTypeID":50,"CardTypeLabel":"VPUScaler","CardID":"thisissometextforid505"}},{"Card"{"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":50,"CardTypeLabel":"VPUScaler","CardID":"thisissometextforid506"}}{"Card"{"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":50,"CardTypeLabel":"VPUScaler","CardID":"thisissometextforid507"}}{"Card"{"CardStatusID":2,"CardStatusLabel":"Ready","CardTypeID":50,"CardTypeLabel":"VPUScaler","CardID":"thisissometextforid508"}}]}}}}}
Response Param: - System—System name and index. - FrameCollection—Collection of frames in a system containing frame information. - Frame—Contains frame information. - Id—Mac Id of the frame. - Name—Name of the frame. - Contact—Contact information. - Version—Current version of the software installed on the frame. - OSVersion—Current OS version installed on the frame. - FrameType—0: E2, 1:S3, 2: Ex - FrameTypeName—Type of the frame: E2/S3/Ex. - Enet—Ethernet settings - SysCard—System card information - Slot—List of Input/Output/Expansion card information
success: (0=success, anything else an error)
Example
– {"params":{}, "method":"getFrameSettings", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.getFrameSettings = function(cb) {
var self = this;
return self.query("getFrameSettings", {}, cb);
}
/*
Definition
– This API shows Aux destination information.
Request
params: - {“id” : x}
Request Param,: - Id—Index of the Aux destination.
Returns
response: {"id":0,"Name":"AuxDest1","PvwLastSrcIndex":0,"PgmLastSrcIndex":0}
Response Param: - id—Index of Aux destination. - Name—Name of Aux destination. - PvwLastSrcIndex—Input/Background source index in preview area. - PgmLastSrcIndex—Input/Background source index in program area.
success: (0=success, anything else an error)
Example
– {"params": {"id": 0}, "method":"listAuxContent", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.listAuxContent = function(auxDestIndex, cb) {
var self = this;
return self.query("listAuxContent", { id: auxDestIndex }, cb);
}
/*
Definition
– User can use this API to subscribe to change events in the Event Master processor. Once subscribed, the API sends a notification in the form of an HTTP Post to the Url: http://hostname:port/.
Request
params: {
"hostname": hostname,
"port": port,
"notification" : notificationTypes[]
}
Request Param,: - hostname—Hostname or IP Address to which the notifications are sent. - port—TCP port to which the notification are posted. - notificationTypes—an array of notifications to which a user wants to subscribe. - ScreenDestChanged - AUXDestChanged - FrameChanged - NativeRateChanged - InputCfgChanged - SourceChanged - BGSourceChanged - PresetChanged - StillChanged - OutputCfgChanged
Returns
response: {"jsonrpc": "2.0","result": {"success": 0,"response": {"method": "subscribe"}},"id": "1234"} Actual notification will be sent asynchronously as HTTP Post, with the following structure {result: {method: "notification",notificationType: "ScreenDestChanged",change: { add: [2], remove: [], update: [0, 1, 2] }}} The change fields contains the XmlId(s) of the screens which were added/removed or updated.
success: (0=success, anything else an error)
Example
– {"params": {"hostname" : "192.168.247.131", "port": "3000", "notification" : ["Screen-DestChanged", "AUXDestChanged"]}, "method":"subscribe", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.subscribe = function(hostname, port, notificationTypes, cb) {
var self = this;
return self.query("subscribe", { hostname: hostname, port: port, notification: notificationTypes }, cb);
}
/*
Definition
– User can use this API to remove the subscription for the given hostname: port and notificationType.
Request
params: {"hostname": hostname, "port": port, "notification" : notificationType[]} Removes the subscription for the given hostname: port and notificationType array. Please see the subscribe section for a detailed explanation of the subscription. NOTE: All subscriptions are lost once the E2 is restarted, and need to be subscribed again if required.
Returns
response: {"jsonrpc": "2.0","result": {"success": 0,"response": {"method": "unsubscribe"}},"id": "1234"}
success: (0=success, anything else an error)
Example
– {"params": {"hostname" : "192.168.247.131", "port": "3000", "notification" : ["Screen-DestChanged", "AUXDestChanged"]}, "method":"unsubscribe", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.unsubscribe = function(hostname, port, notificationTypes, cb) {
var self = this;
return self.query("unsubscribe", { hostname: hostname, port: port, notification: notificationTypes }, cb);
}
/*
Definition
- This API provides the option to play/pause/stop a cue. User can recall cue with id, serial number, or name.
Request:
params: {"id": 1, "type": x}, "method":"activateCue", "id":"1234", "jsonrpc":"2.0"}
- id – Index of the cue
- type – (Default is play). x" can be : 0 — Play. 0 is the default value for the type parameter. 1 — Pause, 2 – Stop
params: {"cueName": "Cue1", "type": x}, "method":"activateCue", "id":"1234", "jsonrpc":"2.0"}
params: {"cueSerialNo": 1.00, "type": x}, "method":"activateCue", "id":"1234", "jsonrpc":"2.0"}
Response:
response: null
success: (0=success, anything else is an error)
Example:
//Play – no parame or type 0
- {"params": {"id": 1}, "method":"activateCue", "id":"1234", "jsonrpc":"2.0"}
//Pause – type 1
- {"params": {"type": 1}, "method":"activateCue", "id":"1234", "jsonrpc":"2.0"}
//Stop – type 2
- {"params": {"type": 2}, "method":"activateCue", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.activateCueById = function(id, type, cb) {
var self = this;
return self.query("activateCue", { id: id, type: type }, cb);
}
eventmaster.prototype.activateCueByCueName = function(cueName, type, cb) {
var self = this;
return self.query("activateCue", { cueName: cueName, type: type }, cb);
}
eventmaster.prototype.activateCueByCueSerialNo = function(cueSerialNo, type, cb) {
var self = this;
return self.query("activateCue", { cueSerialNo: cueSerialNo, type: type }, cb);
}
/*
Definition:
- This API lists all the cues.
Request:
params: {}, "method":"listCues", "id":"1234", "jsonrpc":"2.0"}
- id – Index of the input config.
Response:
response: Array of cue objects.
success: (0=success, anything else is an error)
Example:
- {"params": {}, "method":"listCues", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.listCues = function(cb) {
var self = this;
return self.query("listCues", {}, cb);
}
/*
Definition:
- This API provides the option to modify 3d Controls.
Request:
params: {"id" : id, "type": x, "syncSource": y, "syncInvert": z}
- id – Index of the input config.
- type – "x" can be: 0 – Type Off. 0 is the default value for the type parameter. 1 – Type Sequentia.
- syncSource – "y" can be: 1 – mini-Din 1, 2 – mini-Din 2, 3 – mini-Din 3, 4 – mini-Din 4. Default value is 1.
- syncInvert – "z" can be: 0 – Type Off. 0 is the default value for the syncInvert. 1 – Type Invert.
- To reset, do not provide any parameter except "id".
Response:
- response: {"id": 0, "Name": "InSource1", "HSize": 3840, "VSize": 1080, "Src-Type": 0, "InputCfgIndex": -1, "StillIndex": 0, "DestIndex": -1, "UserKeyIndex": -1, "Mode3D": 0, "Freeze": 1, "Capacity": 2, "InputCfgVideoStatus": 4}
- success: (0=success, anything else is an error)
Example:
- {"params": {"id": 1, "type": 0, "syncSource": 1, "syncInvert": 0},
"method":"3dControl", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.control3d = function(id, type, syncSource, syncInvert, cb) {
var self = this;
return self.query("3dControl", { id: id, type: type, syncSource: syncSource, syncInvert: syncInvert }, cb);
}
/**6.3.0 functions**/
/*
Definition:
-This API recalls a DestGroup
Example:
params: {"id": 0},
"method":"activateDestGroup", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.activateDestGroup = function(id, cb) {
var self = this;
return self.query("activateDestGroup", { id: id }, cb);
}
/*
Definition:
-This API has Ability to arm / unarm Destination
Example:
params: {"arm": 1 ,"ScreenDestination":[{"id": 0}, {"id": 2}], "AuxDestination":[{"id": 0}, {"id": 1}]},
"method":"armUnarmDestination", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.armUnarmDestination = function(arm, screenDestinations, auxDestinations, cb) {
var self = this;
return self.query("armUnarmDestination", { arm: arm , ScreenDestination: screenDestinations, AuxDestination: auxDestinations}, cb);
}
/*
Definition:
-This API to add test pattern control for changeContent for Screen Dest and changeAuxContent for Aux Dest
Example:
params:{"id":0, "TestPattern" :5 },
"method":"changeContent", "id":"1234", "jsonrpc":"2.0"}
Example:
params:{"id":0, "TestPattern" :3 },
"method":"changeAuxContent", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.changeAuxContentTestPattern = function(id, testPattern, cb) {
var self = this;
return self.query("changeAuxContent", { id: id, TestPattern: testPattern }, cb);
}
eventmaster.prototype.changeContentTestPattern = function(id, testPattern, cb) {
var self = this;
return self.query("changeContent", { id: id, TestPattern: testPattern }, cb);
}
/**8.2 functions**/
/*
Definition:
- Switch the active MVR layout per chassis in a system.
Example:
"params": {"frameUnitId": 0, "mvrLayoutId": 0}
"method":"mvrLayoutChange", "id":"1234", "jsonrpc":"2.0"}
to change the MVR in UnitID 0 to layout 1: {"params": {"frameUnitId": 0, "mvrLayoutId": 0}, "method":"mvrLayoutChange", "id":"1234", "jsonrpc":"2.0"}
*/
eventmaster.prototype.mvrLayoutChange = function (frameUnitId, mvrLayoutId, cb) {
var self = this;
return self.query("mvrLayoutChange", {frameUnitId: frameUnitId, mvrLayoutId: mvrLayoutId}, cb);
}
/**
* listOperators": Return a list of the normal operators, their state of enablement, assigned destinations and preset range.
* Example to see the full ist of normal operators: {"params":{}, "method":"listOperators", "id":"1234", "jsonrpc":"2.0"}
* @param {*} cb
*/
eventmaster.prototype.listOperators = function (cb) {
var self = this;
return self.query("listOperators", {}, cb)
}
/**
* configureOperator: Configure the paramaters for normal operator functionality. See JSON documentation for all parameters that can be configured
* Example to enable Operator 1: {"params": {"operatorId": 0, "enable": 1}, "method":"configureOperator", "id":"1234", "jsonrpc":"2.0"}
* @param {*} operatorId
* @param {*} enable
* @param {*} cb
*/
eventmaster.prototype.configureOperator = function(operatorId, enable, cb) {
var self = this;
return self.query("configureOperator", {operatorId: operatorId, enable: enable }, cb);
}
/**
* "listDestGroups" to return a list of all Destination Groups group names and IDs including all member destination names and IDs.
* Example to return all Destination Groups: {"params": {}, "method":"listDestGroups", "id":"1234", "jsonrpc":"2.0"}
* @param {*} cb
*/
eventmaster.prototype.listDestGroups = function(cb) {
var self = this;
return self. query("listDestGroups", {}, cb);
}
/**
* "listDestGroups" to return a list of all Destination Groups group names and IDs including all member destination names and IDs.
* An additional parameter ("destGroupId", "destGroupSno", "destGroupName") may be added to return only the names and IDs of a particular Destination Group
* Example to return all Destination Groups: {"params": {destGroupId}, "method":"listDestGroups", "id":"1234", "jsonrpc":"2.0"}
* @param {*} type (destGroupId, destGroupSno, destGroupName)
* @param {*} cb
*/
eventmaster.prototype.listDestGroupsPerType = function(type, cb) {
var self = this;
return self. query("listDestGroups", {type}, cb);
}
exports = module.exports = eventmaster;