-
Notifications
You must be signed in to change notification settings - Fork 0
/
DWS_Example.js
85 lines (65 loc) · 2.99 KB
/
DWS_Example.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
import xapi from 'xapi';
import DWS from './DWS_Lib';
import config from './DWS_Config'
const states = {
Primary: {
Divided() {
// This function defines the Config changes and event handling
// the primary code should perform while divided
DWS.Command.StopSendingHeartbeats('Secondary');
DWS.Command.StopListeningHeartbeats('Secondary');
// Disable Ethernet Mic
DWS.Command.MuteEthernetMic('tcc2-pri2');
DWS.Subcriptions.push(xapi.Status.Audio.VolumeMute.on(state => {
console.log('Primary volume changed')
}))
xapi.Config.Audio.Output.HDMI[3].Mode.set('Off');
},
Combined() {
// This function defines the Config changes and event handling
// the primary code should perform while divided
// Start Sending Hearbeats to Secondary Codec every minute
DWS.Command.StartSendingHeartbeats('Secondary', 1);
// Listen for Heartbeats from Secondary Codec and require at least one every 10 min
DWS.Command.StartListeningHeartbeats('Secondary', 'Divided', 10 );
// Disable Ethernet Mic
DWS.Command.UnmuteEthernetMic('tcc2-pri2')
// Notify Secondary codec standby state and voluem changes
DWS.Subcriptions.push(xapi.Status.Standby.State.on(state => DWS.Command.NotifyCodecs('standby-' + state, ['Secondary']))
DWS.Subcriptions.push(xapi.Status.Audio.Volume.on(state => DWS.Command.NotifyCodecs('volumeChange-' + state, ['Secondary']))
DWS.Subcriptions.push(xapi.Status.Audio.VolumeMute.on(state => DWS.Command.NotifyCodecs('volumeMute-' + state, ['Secondary']))
xapi.Status.Standby.State.get().then(state => DWS.Command.NotifyCodecs('standby-' + state, ['Secondary']))
xapi.Status.Audio.Volume.get().then(state => DWS.Command.NotifyCodecs('volumeChange-' + state, ['Secondary']))
xapi.Status.Audio.VolumeMute.get().then(state => DWS.Command.NotifyCodecs('volumeMute-' + state, ['Secondary']))
}
},
Secondary: {
Divided() {
DWS.Command.StopHeartBeat();
DWS.Command.UnlockPanel();
xapi.Config.Standby.Control.set('On');
xapi.Config.Standby.Halfwake.Mode.set('Auto');
xapi.Config.Audio.Ultrasound.MaxVolume.set(70);
xapi.Command.Conference.DoNotDisturb.Deactivate();
},
Combined() {
// Start Sending Hearbeats to Primary Codec every minute
DWS.Command.StartSendingHeartbeats('Primary', 1);
// Listen for Heartbeats from Primary Codec and require at least one every 10 min
DWS.Command.StartListeningHeartbeats('Primary', 'Divided', 10 );
DWS.Command.LockPanel();
DWS.Command.ActivateDND();
xapi.Config.Standby.Control.set('Off');
xapi.Config.Standby.Halfwake.Mode.set('Auto');
xapi.Config.Audio.Ultrasound.MaxVolume.set(0);
}
}
}
init();
async function init(){
console.log('DWS Example Macro:');
await DWS.Setup.Config(config);
await DWS.Setup.States(states);
console.log('Setup Complete');
setTimeout(DWS.Command.ApplyState, 2000, 'Combined')
}