aca-device-modules 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,181 +15,181 @@ module Extron::Mixer; end
15
15
 
16
16
 
17
17
  class Extron::Mixer::Dmp44
18
- include ::Orchestrator::Constants
18
+ include ::Orchestrator::Constants
19
19
  include ::Orchestrator::Transcoder
20
20
 
21
-
22
- def on_load
23
- #
24
- # Setup constants
25
- #
26
- self[:output_volume_max] = 2168
27
- self[:output_volume_min] = 1048
28
- self[:mic_gain_max] = 2298
29
- self[:mic_gain_min] = 1698
30
-
31
- config({
32
- :clear_queue_on_disconnect => true # Clear the queue as we may need to send login
33
- })
34
- end
35
-
36
- def connected
37
- device_ready
38
- @polling_timer = schedule.every('2m') do
39
- logger.debug "-- Extron Maintaining Connection"
40
- send('Q', :priority => 0) # Low priority poll to maintain connection
41
- end
42
- end
43
-
44
- def disconnected
45
- #
46
- # Disconnected may be called without calling connected
47
- # Hence the check if timer is nil here
48
- #
49
- @polling_timer.cancel unless @polling_timer.nil?
50
- @polling_timer = nil
51
- end
52
-
53
-
54
- def call_preset(number)
55
- if number < 0 || number > 32
56
- number = 0 # Current configuration
57
- end
58
- send("#{number}.") # No Carriage return for presents
59
- # Response: Rpr#{number}
60
- end
61
-
62
- #
63
- # Input control
64
- #
65
- def adjust_gain(input, value) # \e == 0x1B == ESC key
66
- input -= 1
67
- do_send("\eG3000#{input}*#{value}AU")
68
- # Response: DsG3000#{input}*#{value}
69
- end
70
-
71
- def adjust_gain_relative(input, value) # \e == 0x1B == ESC key
72
- input -= 1
73
- current = do_send("\eG3000#{input}AU", :emit => "mic#{input + 1}_gain")
74
- do_send("\eG3000#{input}*#{current + (value * 10)}AU")
75
-
76
- # Response: DsG3000#{input}*#{value}
77
- end
78
-
79
- def mute_input(input)
80
- input -= 1
81
- do_send("\eM3000#{input}*1AU")
82
- # Response: DsM3000#{input}*1
83
- end
84
-
85
- def unmute_input(input)
86
- input -= 1
87
- do_send("\eM3000#{input}*0AU")
88
- # Response: DsM3000#{input}*0
89
- end
90
-
91
-
92
- #
93
- # Group control
94
- #
95
- def mute_group(group)
96
- do_send("\eD#{group}*1GRPM")
97
- # Response: GrpmD#{group}*+00001
98
- end
99
-
100
- def unmute_group(group)
101
- do_send("\eD#{group}*0GRPM")
102
- # Response: GrpmD#{group}*+00000
103
- end
104
-
105
- def volume(group, value) # \e == 0x1B == ESC key
106
- do_send("\eD#{group}*#{value * 10}*GRPM")
107
- # Response: GrpmD#{group}*#{value}*GRPM
108
- end
109
-
110
- def volume_relative(group, value) # \e == 0x1B == ESC key
111
-
112
- if value < 0
113
- value = -value
114
- do_send("\eD#{group}*#{value * 10}-GRPM")
115
- else
116
- do_send("\eD#{group}*#{value * 10}+GRPM")
117
- end
118
- # Response: GrpmD#{group}*#{value}*GRPM
119
- end
120
-
121
-
122
- def response_delimiter
123
- [0x0D, 0x0A] # Used to interpret the end of a message
124
- end
125
-
126
- #
127
- # Sends copyright information
128
- # Then sends password prompt
129
- #
130
- def received(data, resolve, command)
131
- logger.debug "Extron DSP 44 sent #{data}"
132
-
133
- if command.nil? && data =~ /Copyright/i
134
- device_ready
135
- else
136
- case data[0..2].to_sym
137
- when :Grp # Mute or Volume
138
- data = data.split('*')
139
- if data[1][0] == '+' # mute
140
- self["ouput#{data[0][5..-1].to_i}_mute"] = data[1][-1] == '1' # 1 == true
141
- else
142
- self["ouput#{data[0][5..-1].to_i}_volume"] = data[1].to_i
143
- end
144
- when :DsG # Input gain
145
- self["input#{data[7].to_i + 1}_gain"] = data[9..-1].to_i
146
- when :DsM # Input Mute
147
- self["input#{data[7].to_i + 1}_mute"] = data[-1] == '1' # 1 == true
148
- when :Rpr # Preset called
149
- logger.debug "Extron DSP called preset #{data[3..-1]}"
150
- else
151
- if data == 'E22' # Busy! We should retry this one
152
- command[:delay_on_receive] = 1 unless command.nil?
153
- return :failed
154
- elsif data[0] == 'E'
155
- logger.info "Extron Error #{ERRORS[data[1..2].to_i]}"
156
- logger.info "- for command #{command[:data]}" unless command.nil?
157
- end
158
- end
159
- end
160
-
161
- return :success
162
- end
163
-
164
-
165
- private
166
-
167
-
168
- ERRORS = {
169
- 10 => 'Invalid command',
170
- 11 => 'Invalid preset',
171
- 12 => 'Invalid port number',
172
- 13 => 'Invalid parameter (number is out of range)',
173
- 14 => 'Not valid for this configuration',
174
- 17 => 'System timed out',
175
- 23 => 'Checksum error (for file uploads)',
176
- 24 => 'Privilege violation',
177
- 25 => 'Device is not present',
178
- 26 => 'Maximum connections exceeded',
179
- 27 => 'Invalid event number',
180
- 28 => 'Bad filename or file not found'
181
- }
182
-
183
-
184
- def device_ready
185
- do_send("\e3CV") # Verbose mode and tagged responses
186
- end
187
-
188
-
189
-
190
-
191
- def do_send(data, options = {})
192
- send(data << 0x0D, options)
193
- end
21
+
22
+ def on_load
23
+ #
24
+ # Setup constants
25
+ #
26
+ self[:output_volume_max] = 2168
27
+ self[:output_volume_min] = 1048
28
+ self[:mic_gain_max] = 2298
29
+ self[:mic_gain_min] = 1698
30
+
31
+ config({
32
+ :clear_queue_on_disconnect => true # Clear the queue as we may need to send login
33
+ })
34
+ end
35
+
36
+ def connected
37
+ device_ready
38
+ @polling_timer = schedule.every('2m') do
39
+ logger.debug "-- Extron Maintaining Connection"
40
+ send('Q', :priority => 0) # Low priority poll to maintain connection
41
+ end
42
+ end
43
+
44
+ def disconnected
45
+ #
46
+ # Disconnected may be called without calling connected
47
+ # Hence the check if timer is nil here
48
+ #
49
+ @polling_timer.cancel unless @polling_timer.nil?
50
+ @polling_timer = nil
51
+ end
52
+
53
+
54
+ def call_preset(number)
55
+ if number < 0 || number > 32
56
+ number = 0 # Current configuration
57
+ end
58
+ send("#{number}.") # No Carriage return for presents
59
+ # Response: Rpr#{number}
60
+ end
61
+
62
+ #
63
+ # Input control
64
+ #
65
+ def adjust_gain(input, value) # \e == 0x1B == ESC key
66
+ input -= 1
67
+ do_send("\eG3000#{input}*#{value}AU")
68
+ # Response: DsG3000#{input}*#{value}
69
+ end
70
+
71
+ def adjust_gain_relative(input, value) # \e == 0x1B == ESC key
72
+ input -= 1
73
+ current = do_send("\eG3000#{input}AU", :emit => "mic#{input + 1}_gain")
74
+ do_send("\eG3000#{input}*#{current + (value * 10)}AU")
75
+
76
+ # Response: DsG3000#{input}*#{value}
77
+ end
78
+
79
+ def mute_input(input)
80
+ input -= 1
81
+ do_send("\eM3000#{input}*1AU")
82
+ # Response: DsM3000#{input}*1
83
+ end
84
+
85
+ def unmute_input(input)
86
+ input -= 1
87
+ do_send("\eM3000#{input}*0AU")
88
+ # Response: DsM3000#{input}*0
89
+ end
90
+
91
+
92
+ #
93
+ # Group control
94
+ #
95
+ def mute_group(group)
96
+ do_send("\eD#{group}*1GRPM")
97
+ # Response: GrpmD#{group}*+00001
98
+ end
99
+
100
+ def unmute_group(group)
101
+ do_send("\eD#{group}*0GRPM")
102
+ # Response: GrpmD#{group}*+00000
103
+ end
104
+
105
+ def volume(group, value) # \e == 0x1B == ESC key
106
+ do_send("\eD#{group}*#{value * 10}*GRPM")
107
+ # Response: GrpmD#{group}*#{value}*GRPM
108
+ end
109
+
110
+ def volume_relative(group, value) # \e == 0x1B == ESC key
111
+
112
+ if value < 0
113
+ value = -value
114
+ do_send("\eD#{group}*#{value * 10}-GRPM")
115
+ else
116
+ do_send("\eD#{group}*#{value * 10}+GRPM")
117
+ end
118
+ # Response: GrpmD#{group}*#{value}*GRPM
119
+ end
120
+
121
+
122
+ def response_delimiter
123
+ [0x0D, 0x0A] # Used to interpret the end of a message
124
+ end
125
+
126
+ #
127
+ # Sends copyright information
128
+ # Then sends password prompt
129
+ #
130
+ def received(data, resolve, command)
131
+ logger.debug "Extron DSP 44 sent #{data}"
132
+
133
+ if command.nil? && data =~ /Copyright/i
134
+ device_ready
135
+ else
136
+ case data[0..2].to_sym
137
+ when :Grp # Mute or Volume
138
+ data = data.split('*')
139
+ if data[1][0] == '+' # mute
140
+ self["ouput#{data[0][5..-1].to_i}_mute"] = data[1][-1] == '1' # 1 == true
141
+ else
142
+ self["ouput#{data[0][5..-1].to_i}_volume"] = data[1].to_i
143
+ end
144
+ when :DsG # Input gain
145
+ self["input#{data[7].to_i + 1}_gain"] = data[9..-1].to_i
146
+ when :DsM # Input Mute
147
+ self["input#{data[7].to_i + 1}_mute"] = data[-1] == '1' # 1 == true
148
+ when :Rpr # Preset called
149
+ logger.debug "Extron DSP called preset #{data[3..-1]}"
150
+ else
151
+ if data == 'E22' # Busy! We should retry this one
152
+ command[:delay_on_receive] = 1 unless command.nil?
153
+ return :failed
154
+ elsif data[0] == 'E'
155
+ logger.info "Extron Error #{ERRORS[data[1..2].to_i]}"
156
+ logger.info "- for command #{command[:data]}" unless command.nil?
157
+ end
158
+ end
159
+ end
160
+
161
+ return :success
162
+ end
163
+
164
+
165
+ private
166
+
167
+
168
+ ERRORS = {
169
+ 10 => 'Invalid command',
170
+ 11 => 'Invalid preset',
171
+ 12 => 'Invalid port number',
172
+ 13 => 'Invalid parameter (number is out of range)',
173
+ 14 => 'Not valid for this configuration',
174
+ 17 => 'System timed out',
175
+ 23 => 'Checksum error (for file uploads)',
176
+ 24 => 'Privilege violation',
177
+ 25 => 'Device is not present',
178
+ 26 => 'Maximum connections exceeded',
179
+ 27 => 'Invalid event number',
180
+ 28 => 'Bad filename or file not found'
181
+ }
182
+
183
+
184
+ def device_ready
185
+ do_send("\e3CV") # Verbose mode and tagged responses
186
+ end
187
+
188
+
189
+
190
+
191
+ def do_send(data, options = {})
192
+ send(data << 0x0D, options)
193
+ end
194
194
  end
195
195
 
@@ -25,188 +25,199 @@ module Extron::Mixer; end
25
25
 
26
26
 
27
27
  class Extron::Mixer::Dmp64
28
- include ::Orchestrator::Constants
28
+ include ::Orchestrator::Constants
29
29
  include ::Orchestrator::Transcoder
30
30
 
31
-
32
- def on_load
33
- #
34
- # Setup constants
35
- #
36
- self[:output_volume_max] = 2168
37
- self[:output_volume_min] = 1048
38
- self[:mic_gain_max] = 2298
39
- self[:mic_gain_min] = 1698
40
-
41
- config({
42
- :clear_queue_on_disconnect => true # Clear the queue as we may need to send login
43
- })
44
- end
45
-
46
- def connected
47
-
48
- end
49
-
50
- def disconnected
51
- #
52
- # Disconnected may be called without calling connected
53
- # Hence the check if timer is nil here
54
- #
55
- @polling_timer.cancel unless @polling_timer.nil?
56
- @polling_timer = nil
57
- end
58
-
59
-
60
- def call_preset(number)
61
- if number < 0 || number > 32
62
- number = 0 # Current configuration
63
- end
64
- send("#{number}.") # No Carriage return for presents
65
- # Response: Rpr#{number}
66
- end
67
-
68
- #
69
- # Input control
70
- #
71
- def adjust_gain(mic, value) # \e == 0x1B == ESC key
72
- do_send("\eG4010#{mic}*#{value}AU")
73
- # Response: DsG4010#{mic}*#{value}
74
- end
75
-
76
- def adjust_gain_relative(mic, value) # \e == 0x1B == ESC key
77
- current = do_send("\eG4010#{mic}AU", :emit => "mic#{mic}_gain")
78
- do_send("\eG4010#{mic}*#{current + (value * 10)}AU")
79
-
80
- # Response: DsG4010#{mic}*#{value}
81
- end
82
-
83
- def mute_mic(mic)
84
- do_send("\eM4000#{mic}*1AU") # 4000 (input gain), 4010 (pre-mixer gain)
85
- # Response: DsM4010#{mic}*1
86
- end
87
-
88
- def unmute_mic(mic)
89
- do_send("\eM4000#{mic}*0AU")
90
- # Response: DsM4010#{mic}*0
91
- end
92
-
93
-
94
- #
95
- # Output control
96
- #
97
- def mute_group(group)
98
- do_send("\eD#{group}*1GRPM", :group_type => :mute)
99
- # Response: GrpmD#{group}*+00001
100
- end
101
-
102
- def unmute_group(group)
103
- do_send("\eD#{group}*0GRPM", :group_type => :mute)
104
- # Response: GrpmD#{group}*+00000
105
- end
106
-
107
- def volume(group, value) # \e == 0x1B == ESC key
108
- do_send("\eD#{group}*#{value}GRPM", :group_type => :volume)
109
- # Response: GrpmD#{group}*#{value}*GRPM
110
- end
111
-
112
- def group_status(group, type)
113
- do_send("\eD#{group}GRPM", :group_type => type)
114
- end
115
-
116
- def volume_relative(group, value) # \e == 0x1B == ESC key
117
- if value < 0
118
- value = -value
119
- do_send("\eD#{group}*#{value}-GRPM")
120
- else
121
- do_send("\eD#{group}*#{value}+GRPM")
122
- end
123
- # Response: GrpmD#{group}*#{value}*GRPM
124
- end
125
-
126
-
127
- def response_delimiter
128
- [0x0D, 0x0A] # Used to interpret the end of a message
129
- end
130
-
131
- #
132
- # Sends copyright information
133
- # Then sends password prompt
134
- #
135
- def received(data, resolve, command)
136
- logger.debug "Extron DSP sent #{data}"
137
-
138
- if command.nil? && data =~ /Copyright/i
139
- pass = setting(:password)
140
- if pass.nil?
141
- device_ready
142
- else
143
- do_send(pass) # Password set
144
- end
145
- elsif data =~ /Login/i
146
- device_ready
147
- else
148
- case data[0..2].to_sym
149
- when :Grp # Mute or Volume
150
- data = data.split('*')
151
- if command.present? && command[:group_type] == :mute
152
- self["ouput#{data[0][5..-1].to_i}_mute"] = data[1][-1] == '1' # 1 == true
153
- elsif command.present? && command[:group_type] == :volume
154
- self["ouput#{data[0][5..-1].to_i}_volume"] = data[1].to_i
155
- else
156
- return :failed
157
- end
158
- when :DsG # Mic gain
159
- self["mic#{data[7]}_gain"] = data[9..-1].to_i
160
- when :DsM # Mic Mute
161
- self["mic#{data[7]}_mute"] = data[-1] == '1' # 1 == true
162
- when :Rpr # Preset called
163
- logger.debug "Extron DSP called preset #{data[3..-1]}"
164
- else
165
- if data == 'E22' # Busy! We should retry this one
166
- command[:delay_on_receive] = 1 unless command.nil?
167
- return :failed
168
- elsif data[0] == 'E'
169
- logger.info "Extron Error #{ERRORS[data[1..2].to_i]}"
170
- logger.info "- for command #{command[:data]}" unless command.nil?
171
- end
172
- end
173
- end
174
-
175
- return :success
176
- end
177
-
178
-
179
- private
180
-
181
-
182
- ERRORS = {
183
- 1 => 'Invalid input number (number is too large)',
184
- 12 => 'Invalid port number',
185
- 13 => 'Invalid parameter (number is out of range)',
186
- 14 => 'Not valid for this configuration',
187
- 17 => 'System timed out',
188
- 23 => 'Checksum error (for file uploads)',
189
- 24 => 'Privilege violation',
190
- 25 => 'Device is not present',
191
- 26 => 'Maximum connections exceeded',
192
- 27 => 'Invalid event number',
193
- 28 => 'Bad filename or file not found'
194
- }
195
-
196
-
197
- def device_ready
198
- do_send("\e3CV") # Verbose mode and tagged responses
199
- @polling_timer = schedule.every('2m') do
200
- logger.debug "-- Extron Maintaining Connection"
201
- send('Q', :priority => 0) # Low priority poll to maintain connection
202
- end
203
- end
204
-
205
-
206
-
207
-
208
- def do_send(data, options = {})
209
- send(data << 0x0D, options)
210
- end
31
+
32
+ def on_load
33
+ #
34
+ # Setup constants
35
+ #
36
+ self[:output_volume_max] = 2168
37
+ self[:output_volume_min] = 1048
38
+ self[:mic_gain_max] = 2298
39
+ self[:mic_gain_min] = 1698
40
+
41
+ config({
42
+ :clear_queue_on_disconnect => true # Clear the queue as we may need to send login
43
+ })
44
+ end
45
+
46
+ def connected
47
+
48
+ end
49
+
50
+ def disconnected
51
+ #
52
+ # Disconnected may be called without calling connected
53
+ # Hence the check if timer is nil here
54
+ #
55
+ @polling_timer.cancel unless @polling_timer.nil?
56
+ @polling_timer = nil
57
+ end
58
+
59
+
60
+ def call_preset(number)
61
+ if number < 0 || number > 32
62
+ number = 0 # Current configuration
63
+ end
64
+ send("#{number}.") # No Carriage return for presents
65
+ # Response: Rpr#{number}
66
+ end
67
+
68
+ #
69
+ # Input control
70
+ #
71
+ def adjust_gain(mic, value) # \e == 0x1B == ESC key
72
+ do_send("\eG4010#{mic}*#{value}AU")
73
+ # Response: DsG4010#{mic}*#{value}
74
+ end
75
+
76
+ def adjust_gain_relative(mic, value) # \e == 0x1B == ESC key
77
+ current = do_send("\eG4010#{mic}AU", :emit => "mic#{mic}_gain")
78
+ do_send("\eG4010#{mic}*#{current + (value * 10)}AU")
79
+
80
+ # Response: DsG4010#{mic}*#{value}
81
+ end
82
+
83
+ def mute_mic(mic)
84
+ do_send("\eM4000#{mic}*1AU") # 4000 (input gain), 4010 (pre-mixer gain)
85
+ # Response: DsM4010#{mic}*1
86
+ end
87
+
88
+ def unmute_mic(mic)
89
+ do_send("\eM4000#{mic}*0AU")
90
+ # Response: DsM4010#{mic}*0
91
+ end
92
+
93
+
94
+ #
95
+ # Output control
96
+ #
97
+ def mute(group, value = true, index = nil)
98
+ group = index if index
99
+ val = is_affirmative?(value) ? 1 : 0
100
+
101
+ faders = group.is_a?(Array) ? group : [group]
102
+ faders.each do |fad|
103
+ do_send("\eD#{fad}*#{val}GRPM", :group_type => :mute)
104
+ end
105
+ # Response: GrpmD#{group}*+00001
106
+ end
107
+
108
+ def unmute(group, index = nil)
109
+ mute(group, false, index)
110
+ #do_send("\eD#{group}*0GRPM", :group_type => :mute)
111
+ # Response: GrpmD#{group}*+00000
112
+ end
113
+
114
+ def fader(group, value, index = nil) # \e == 0x1B == ESC key
115
+ faders = group.is_a?(Array) ? group : [group]
116
+ faders.each do |fad|
117
+ do_send("\eD#{fad}*#{value}GRPM", :group_type => :volume)
118
+ end
119
+
120
+ # Response: GrpmD#{group}*#{value}*GRPM
121
+ end
122
+
123
+ def fader_status(group, type)
124
+ do_send("\eD#{group}GRPM", :group_type => type)
125
+ end
126
+
127
+ def fader_relative(group, value) # \e == 0x1B == ESC key
128
+ if value < 0
129
+ value = -value
130
+ do_send("\eD#{group}*#{value}-GRPM")
131
+ else
132
+ do_send("\eD#{group}*#{value}+GRPM")
133
+ end
134
+ # Response: GrpmD#{group}*#{value}*GRPM
135
+ end
136
+
137
+
138
+ def response_delimiter
139
+ [0x0D, 0x0A] # Used to interpret the end of a message
140
+ end
141
+
142
+ #
143
+ # Sends copyright information
144
+ # Then sends password prompt
145
+ #
146
+ def received(data, resolve, command)
147
+ logger.debug "Extron DSP sent #{data}"
148
+
149
+ if command.nil? && data =~ /Copyright/i
150
+ pass = setting(:password)
151
+ if pass.nil?
152
+ device_ready
153
+ else
154
+ do_send(pass) # Password set
155
+ end
156
+ elsif data =~ /Login/i
157
+ device_ready
158
+ else
159
+ case data[0..2].to_sym
160
+ when :Grp # Mute or Volume
161
+ data = data.split('*')
162
+ if command.present? && command[:group_type] == :mute
163
+ self["fader#{data[0][5..-1].to_i}_mute"] = data[1][-1] == '1' # 1 == true
164
+ elsif command.present? && command[:group_type] == :volume
165
+ self["fader#{data[0][5..-1].to_i}"] = data[1].to_i
166
+ else
167
+ return :failed
168
+ end
169
+ when :DsG # Mic gain
170
+ self["mic#{data[7]}_gain"] = data[9..-1].to_i
171
+ when :DsM # Mic Mute
172
+ self["mic#{data[7]}_mute"] = data[-1] == '1' # 1 == true
173
+ when :Rpr # Preset called
174
+ logger.debug "Extron DSP called preset #{data[3..-1]}"
175
+ else
176
+ if data == 'E22' # Busy! We should retry this one
177
+ command[:delay_on_receive] = 1 unless command.nil?
178
+ return :failed
179
+ elsif data[0] == 'E'
180
+ logger.info "Extron Error #{ERRORS[data[1..2].to_i]}"
181
+ logger.info "- for command #{command[:data]}" unless command.nil?
182
+ end
183
+ end
184
+ end
185
+
186
+ return :success
187
+ end
188
+
189
+
190
+ private
191
+
192
+
193
+ ERRORS = {
194
+ 1 => 'Invalid input number (number is too large)',
195
+ 12 => 'Invalid port number',
196
+ 13 => 'Invalid parameter (number is out of range)',
197
+ 14 => 'Not valid for this configuration',
198
+ 17 => 'System timed out',
199
+ 23 => 'Checksum error (for file uploads)',
200
+ 24 => 'Privilege violation',
201
+ 25 => 'Device is not present',
202
+ 26 => 'Maximum connections exceeded',
203
+ 27 => 'Invalid event number',
204
+ 28 => 'Bad filename or file not found'
205
+ }
206
+
207
+
208
+ def device_ready
209
+ do_send("\e3CV") # Verbose mode and tagged responses
210
+ @polling_timer = schedule.every('2m') do
211
+ logger.debug "-- Extron Maintaining Connection"
212
+ send('Q', :priority => 0) # Low priority poll to maintain connection
213
+ end
214
+ end
215
+
216
+
217
+
218
+
219
+ def do_send(data, options = {})
220
+ send(data << 0x0D, options)
221
+ end
211
222
  end
212
223