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

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

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

  1 # client-dc.tcl --
  2 #
  3 #       Provides an abstract interface to the DC API to control the DC
  4 #       remotely.
  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 DpClient
 33 
 34 Class DcClient
 35 
 36 DcClient instproc init {hostname port} {
 37     $self instvar dc_
 38 
 39     set dc_ [new DpClient $hostname $port]
 40 }
 41 
 42 DcClient public getThumbnailInfo {} {
 43     $self instvar dc_
 44 
 45     set retVal [$dc_ do dcApi_getThumbnailInfo]
 46     return $retVal
 47 }
 48 
 49 DcClient public getPreviewInfo {} {
 50     $self instvar dc_
 51 
 52     set retVal [$dc_ do dcApi_getPreviewInfo]
 53     return $retVal
 54 }
 55 
 56 DcClient public getBroadcastInfo {} {
 57     $self instvar dc_
 58 
 59     set retVal [$dc_ do dcApi_getBroadcastInfo]
 60     return $retVal
 61 }
 62 
 63 DcClient public previewAll {} {
 64     $self instvar dc_
 65 
 66     set retVal [$dc_ do dcApi_getThumbnailInfo]
 67     array set thumbInfo $retVal
 68     foreach index $thumbInfo(windows) {
 69         $dc_ do dcApi_previewThumbnail $index
 70     }
 71 }
 72 
 73 
 74 DcClient public broadcastAll {} {
 75     $self instvar dc_
 76 
 77     set retVal [$dc_ do dcApi_getThumbnailInfo]
 78     array set thumbInfo $retVal
 79     foreach index $thumbInfo(windows) {
 80         $dc_ do dcApi_broadcastThumbnail $index
 81     }
 82 }
 83 
 84 DcClient public clearPreviewPane {} {
 85     $self instvar dc_
 86 
 87     $dc_ do dcApi_clearPreviewPane
 88 }
 89 
 90 DcClient public clearBroadcastPane {} {
 91     $self instvar dc_
 92 
 93     $dc_ do dcApi_clearBroadcastPane
 94 }
 95 
 96 DcClient public clearAll {} {
 97     $self instvar dc_
 98 
 99     $dc_ do dcApi_clearPreviewPane
100     $dc_ do dcApi_clearBroadcastPane
101 }
102 
103 DcClient public broadcastHost {hostname} {
104     $self instvar dc_
105 
106     set hostname [string tolower $hostname]
107     set retVal [$dc_ do dcApi_getBroadcastInfo]
108     array set broadcastInfo $retVal
109     foreach index $broadcastInfo(windows) {
110         if {$broadcastInfo($index,hostname) == $hostname} {
111             # already broadcasting
112             return 1
113         }
114     }
115 
116     set retVal [$dc_ do dcApi_getThumbnailInfo]
117     array set thumbInfo $retVal
118     foreach index $thumbInfo(windows) {
119         if {$thumbInfo($index,hostname) == $hostname} {
120             $dc_ do dcApi_broadcastThumbnail $index
121             return 1
122         }
123     }
124 
125     # if we got here, there is no thumbnail from that host, so fail
126     return 0
127 }
128 
129 DcClient public unbroadcastHost {hostname} {
130     $self instvar dc_
131 
132     set hostname [string tolower $hostname]
133     set retVal [$dc_ do dcApi_getBroadcastInfo]
134     array set broadcastInfo $retVal
135     foreach index $broadcastInfo(windows) {
136         if {$broadcastInfo($index,hostname) == $hostname} {
137             $dc_ do dcApi_removeBroadcast $index
138         }
139     }
140     return 1
141 }
142 
143 

~ [ 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.