-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeedbacks.js
104 lines (103 loc) · 3 KB
/
feedbacks.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
const Options = require('./options')
const Styles = require('./styles')
module.exports = async function(self) {
self.setFeedbackDefinitions({
output_channel_feedback: {
type: 'advanced',
name: 'Output State',
description: 'Indicates current state of an Output',
options: [Options.Output],
callback: async (feedback) => {
// V7 data unavailable
if (self.deviceData.firstLoad || self.deviceData.state == undefined) return;
var fetchedPortData = self.deviceData.state.outputChannels;
if (fetchedPortData[feedback.options.outputNumber-1].isOn) {
if (fetchedPortData[feedback.options.outputNumber-1].isConnected) {
return Styles.OutputOn;
}
return Styles.OutputOff;
} else {
return Styles.Default;
}
}
},
next_feedback: {
type: 'advanced',
name: 'Next State',
description: 'Indicates state of Next Cue',
options: [],
callback: async (feedback) => {
// V7 data unavailable
if (self.deviceData.firstLoad || self.deviceData.state == undefined) return;
if (self.deviceData.state.outputsSuspended) {
return Styles.IdleNext;
}
return Styles.FullNext;
}
},
back_feedback: {
type: 'advanced',
name: 'Back State',
description: 'Indicates state of Back Cue',
options: [],
callback: async (feedback) => {
// V7 data unavailable
if (self.deviceData.firstLoad || self.deviceData.state == undefined) return;
if (self.deviceData.state.outputsSuspended) {
return Styles.IdleBack;
}
return Styles.FullBack;
}
},
blackout_feedback: {
type: 'advanced',
name: 'Blackout State',
description: 'Indicates state of Blackout Cue',
options: [],
callback: async (feedback) => {
// V7 data unavailable
if (self.deviceData.firstLoad || self.deviceData.state == undefined) return;
if (!self.deviceData.settings.misc.enableBlack) {
return Styles.IdleBlackout;
}
return Styles.FullBlackout;
}
},
technician_feedback: {
type: 'advanced',
name: 'TM State',
description: 'Indicates state of Technician Mode',
options: [],
callback: async (feedback) => {
// V7 data unavailable
if (self.deviceData.firstLoad || self.deviceData.state == undefined) return;
if (self.deviceData.settings.misc.cueLightOnly) {
return Styles.LampOnly;
}
return Styles.FullCues;
}
},
ack_cue_feedback: {
type: 'advanced',
name: 'Acknowledge Cue',
description: 'Indicates Cue being received (Last Feedback step)',
options: [Options.CueType],
callback: async (feedback) => {
if (self.deviceData.firstLoad) return; // Haven't got V7 data yet
var _type = self.deviceData.fetchedCueType;
if (_type == 'forward') _type = 'next'; //...
// This button isn't of cueType
if (feedback.options.cueType != _type) {
return Styles.Default;
}
if (_type == 'next') {
return Styles.NextAck;
} else if (_type == 'back') {
return Styles.BackAck;
} else if (_type == 'black') {
return Styles.BlackoutAck;
}
}
},
});
}