~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Open Mash Cross Reference
mash/tcl/vd/clients/client-405.tcl

Component: ~ [ mash ] ~ [ apps ] ~ [ gsm ] ~ [ lib ] ~ [ otcl ] ~ [ srm ] ~ [ tcl8.3 ] ~ [ tclcl ] ~ [ tk8.3 ] ~ [ tutorials ] ~

  1 # client-405.tcl --
  2 #
  3 #       Provides abstract access to some amxd commands; user doesn't need to
  4 #       know where the amxd is.
  5 #
  6 # Copyright (c) 2000-2002 The Regents of the University of California.
  7 # All rights reserved.
  8 #
  9 # Redistribution and use in source and binary forms, with or without
 10 # modification, are permitted provided that the following conditions are met:
 11 #
 12 # A. Redistributions of source code must retain the above copyright notice,
 13 #    this list of conditions and the following disclaimer.
 14 # B. Redistributions in binary form must reproduce the above copyright notice,
 15 #    this list of conditions and the following disclaimer in the documentation
 16 #    and/or other materials provided with the distribution.
 17 # C. Neither the names of the copyright holders nor the names of its
 18 #    contributors may be used to endorse or promote products derived from this
 19 #    software without specific prior written permission.
 20 #
 21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 22 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 23 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 24 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
 25 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 26 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 27 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 28 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 29 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 31 
 32 Import enable
 33 
 34 import DpClient
 35 
 36 Class 405Client
 37 
 38 
 39 #-----------------------------------------------------------------------------
 40 #
 41 # 405Client constructor
 42 #
 43 # Input:
 44 #   amxHost, amxPort - the host/port of amxd server.  Must NOT be "".
 45 #
 46 # Description:
 47 #   Creates DP clients to talk to the servers.
 48 #   FIXME: hostnames and ports for vcc3 server should be parameters and
 49 #   not hardcoded.
 50 #
 51 #-----------------------------------------------------------------------------
 52 
 53 405Client instproc init { amxHost amxPort aCamHost aCamPort sCamHost sCamPort} {
 54     $self instvar amx_ cams_
 55 
 56     # AMXd
 57     if {[catch {new DpClient $amxHost $amxPort} amx_]} {
 58         puts stderr "WARNING: could not connect to AMX server"
 59         set amx_ ""
 60     }
 61 
 62     # VCC3d
 63     set hostname $sCamHost
 64     set port $sCamPort
 65     if {[catch {new DpClient $hostname $port} cams_(speaker)]} {
 66         puts stderr "WARNING: could not connect to speaker camera server $hostname $port, will use AMX control"
 67         unset cams_(speaker)
 68     }
 69 
 70     # VCC3d
 71     set hostname $aCamHost
 72     set port $aCamPort
 73     if {[catch {new DpClient $hostname $port} cams_(audience)]} {
 74         puts stderr "WARNING: could not connect to audience camera server $hostname $port, will use AMX control"
 75         unset cams_(audience)
 76     }
 77 }
 78 
 79 
 80 #-----------------------------------------------------------------------------
 81 #
 82 # 405Client isConnectedToAMX
 83 #
 84 # Description:
 85 #   If connection to amx_ is successful, return 1, else return 0.
 86 #
 87 #-----------------------------------------------------------------------------
 88 
 89 405Client public isConnectedToAMX {} {
 90     $self instvar amx_ 
 91     if {$amx_ != ""} {
 92         return 1
 93     } else {
 94         return 0
 95     }
 96 }
 97 
 98 # this should only be called when the 405Client object will no longer be used
 99 405Client public closeConnection {} {
100     $self instvar amx_ cams_
101 
102     catch {$amx_ closeRPC}
103     catch {$cams_(speaker) closeRPC}
104     catch {$cams_(audience) closeRPC}
105 }
106 
107 # FIXME - there should be a better way to do this, possibly pass in a
108 #    do/doNoWait option to the functions which defaults to "do"
109 # these are provided to allow the user to call doNoWait explicitly
110 405Client public getAmxClient {} {
111     $self instvar amx_
112 
113     return $amx_
114 }
115 
116 405Client public getVcc3Client {id} {
117     $self instvar cams_
118 
119     if {[info exists cams_($id)]} {
120         return $cams_($id)
121     }
122     return -code error "405Client::getVcc3Client: id $id not supported"
123 }
124 
125 # FIXME - all these catch statements should print a warning when they fail
126 
127 405Client public matrix_switchVideoStream {input output {projectorScanConverted 0}} {
128     $self instvar amx_
129 
130     catch {$amx_ do matrix_switchVideoStream $input $output $projectorScanConverted} result
131     return $result
132 }
133 
134 405Client public matrix_getInputSource {output} {
135     $self instvar amx_
136 
137     catch {$amx_ do matrix_getInputSource $output} result
138     return $result
139 }
140 
141 405Client public camera_pulseMove {id dir {numTimes 1}} {
142     $self instvar amx_ cams_
143 
144     if {[info exists cams_($id)]} {
145         switch -exact -- $dir {
146             in {
147                 set temp [$cams_($id) do vcc3_getZoomPosition]
148                 set temp [expr $temp + 20]
149                 return [$cams_($id) do vcc3_setZoomPosition $temp]
150             }
151             out {
152                 set temp [$cams_($id) do vcc3_getZoomPosition]
153                 set temp [expr $temp - 20]
154                 return [$cams_($id) do vcc3_setZoomPosition $temp]
155             }
156             default {
157                 return [$cams_($id) do vcc3_moveRelative $dir 100]
158             }
159         }
160     }
161     # if we got here, the vcc3d is not working, or the id is invalid
162     catch {$amx_ do camera_pulseMove $id $dir $numTimes} result
163     return $result
164 }
165 
166 405Client public camera_center {id} {
167     $self instvar amx_ cams_
168 
169     if {[info exists cams_($id)]} {
170         catch {$cams_($id) do vcc3_home} result
171         return $result
172     }
173     # if we got here, the id is invalid, or the vcc3d wasn't up when
174     #   we initialized, try to use AMX
175     catch {$amx_ do camera_center $id} result
176     return $result
177 }
178 
179 405Client public camera_startMove {id dir} {
180     $self instvar amx_ cams_
181 
182     if {[info exists cams_($id)]} {
183         catch {$cams_($id) do vcc3_startMove $dir} result
184         return $result
185     }
186     # if we got here, the id is invalid, or the vcc3d wasn't up when
187     #   we initialized, try to use AMX
188     catch {$amx_ do camera_startMove $id $dir} result
189     return $result
190 }
191 
192 # keep for backward compatibility
193 405Client public camera_stopMove {id} {
194     $self camera_stop $id
195 }
196 
197 405Client public camera_stop {id} {
198     $self instvar amx_ cams_
199 
200     if {[info exists cams_($id)]} {
201         catch {$cams_($id) do vcc3_stop} result
202         return $result
203     }
204     # if we got here, the id is invalid, or the vcc3d wasn't up when
205     #   we initialized, try to use AMX
206     catch {$amx_ do camera_stopMove $id} result
207     return $result
208 }
209 
210 405Client public camera_setPreset {id num} {
211     $self instvar amx_ cams_
212 
213     if {[info exists cams_($id)]} {
214         catch {$cams_($id) do vcc3_setPreset $num} result
215         return $result
216     }
217     # if we got here, the id is invalid, or the vcc3d wasn't up when
218     #   we initialized, try to use AMX
219     catch {$amx_ do camera_setPreset $id $num} result
220     return $result
221 }
222 
223 405Client public camera_goPreset {id num} {
224     $self instvar amx_ cams_
225 
226     if {[info exists cams_($id)]} {
227         catch {$cams_($id) do vcc3_goPreset $num} result
228         return $result
229     }
230     # if we got here, the id is invalid, or the vcc3d wasn't up when
231     #   we initialized, try to use AMX
232     catch {$amx_ do camera_goPreset $id $num} result
233     return $result
234 }
235 
236 405Client public camera_fadeIn {id} {
237     $self instvar amx_ cams_
238 
239     if {[info exists cams_($id)]} {
240         catch {$cams_($id) doNoWait vcc3_fadeIn} result
241         return $result
242     }
243     # if we got here, the id is invalid, or the vcc3d wasn't up when
244     #   we initialized, do nothing
245     return -1
246 }
247 
248 405Client public camera_fadeOut {id} {
249     $self instvar amx_ cams_
250 
251     if {[info exists cams_($id)]} {
252         catch {$cams_($id) doNoWait vcc3_fadeOut} result
253         return $result
254     }
255     # if we got here, the id is invalid, or the vcc3d wasn't up when
256     #   we initialized, do nothing
257     return -1
258 }
259 
260 405Client public lights_set {setting} {
261     $self instvar amx_
262 
263     catch {$amx_ do lights_set $setting} result
264     return $result
265 }
266 
267 405Client public callback_register {callback {filter ""}} {
268     $self instvar amx_
269 
270     catch {$amx_ do callback_register $callback $filter} result
271     return $result
272 }
273 
274 405Client public callback_unregister {callback} {
275     $self instvar amx_
276 
277     catch {$amx_ do callback_unregister $callback} result
278     return $result
279 }
280 
281 405Client public callback_unregisterClient {sock} {
282     $self instvar amx_
283 
284     catch {$amx_ do callback_unregisterClient $sock} result
285     return $result
286 }
287 
288 405Client public callback_disable {callback} {
289     $self instvar amx_
290 
291     catch {$amx_ do callback_disable $callback} result
292     return $result
293 }
294 
295 405Client public callback_enable {callback} {
296     $self instvar amx_
297 
298 #   catch {$amx_ do callback_enable $callback} result
299 # WEITSANG
300     catch {$amx_ doNoWait callback_enable $callback} result
301     return $result
302 }
303 
304 405Client public amxd_getVersion {} {
305     $self instvar amx_
306 
307     catch {$amx_ do amxd_getVersion} result
308     return $result
309 }
310 
311 405Client public vcr_doFunction { id func} {
312     $self instvar amx_
313 
314     catch {$amx_ do vcr_doFunction $id $func} result
315     return $result
316 }
317 
318 405Client public scanConv_adjustSize {dir} {
319     $self instvar amx_
320 
321     catch {$amx_ do scanConv_adjustSize $dir} result
322     return $result
323 }
324 
325 
326 405Client public scanConv_adjustPosition {dir} {
327     $self instvar amx_
328 
329     catch {$amx_ do scanConv_adjustPosition $dir} result
330     return $result
331 }
332 
333 405Client public scanConv_switchMode {mode} {
334     $self instvar amx_
335 
336     catch {$amx_ do scanConv_switchMode $mode} result
337     return $result
338 }
339 
340 405Client public onAir_turnOn {} {
341     $self instvar amx_
342 
343     catch {$amx_ do onAir_turnOn} result
344     return $result
345 }
346 
347 405Client public onAir_turnOff {} {
348     $self instvar amx_
349 
350     catch {$amx_ do onAir_turnOff} result
351     return $result
352 }
353 
354 #405Client public {} {
355 #    $self instvar amx_
356 #}
357 
358 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.