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

Open Mash Cross Reference
mash/tcl/degas/degasclient/vic-application-degas-client.tcl

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

  1 import VicApplication
  2 import AnnounceListenManager/DegasClient
  3 import VicUI/Degas
  4 import AGLP/Client
  5 import TCP/Client/DegasControl
  6 
  7 #------------------------------------------------------------------

  8 # VicApplication/DegasClient

  9 #

 10 # members : 

 11 #   agent_ - inherited : VicApplication

 12 #          - class     : VideoAgent

 13 #------------------------------------------------------------------

 14 Class VicApplication/DegasClient -superclass VicApplication
 15 
 16 
 17 #------------------------------------------------------------------

 18 # VicApplication/DegasClient::init

 19 #

 20 # purpose : Constructor for VicApplication/DegasClient object.

 21 #           This application is just like the current Vic, except

 22 #           it has it's own user interface element, protocol to

 23 #           communicate with the DegasServer, and additional 

 24 #           command line parameters.

 25 # input   : widget_path - prefix of the widgets' path.

 26 #           argv - command lines arguments.

 27 # output  : none

 28 #------------------------------------------------------------------

 29 
 30 VicApplication/DegasClient public init {widget_path argv} {
 31 
 32 #   controller_ is the tcp channel to the server, and is needed deep in the

 33 #   widget tree to send events to the server.  it is also needed by the 

 34 #   announce listen manager to process various server message.  this is why

 35 #   we created it here, before the widgets get created.

 36 
 37     $self instvar controller_
 38     set controller_ [new TCP/Client/DegasControl]
 39 
 40     set options [$self options]
 41     $self init_args $options
 42     $self init_resources $options
 43         set argv [$options parse_args $argv]
 44         set deglet [$self get_prog_filename]
 45         if {$deglet != ""} {
 46 
 47                 # We create a new ALM, and get the program 

 48                 # specification, either thru command line or

 49                 # gui.

 50                 $self instvar alm_
 51                 $self instvar agent_
 52                 set ctrl_session_spec [$self get_option degasCtrlSessionSpec]
 53                 puts "Control Session : $ctrl_session_spec"
 54                 set alm_ [new AGLP/Client $self $controller_ $ctrl_session_spec 4096]
 55                 $alm_ start
 56                 $controller_ set aglp_ $alm_
 57 
 58                 # controller needs access to alm_ to restart announcement when the

 59                 # control channel is close.

 60                 #$controller_ set alm_ $alm_

 61 
 62                 $alm_ set prog_filename_ $deglet
 63                 $self set start_vic_ 0
 64         } else {
 65                 $self set start_vic_ 1
 66         }
 67 
 68     $self next $widget_path $argv
 69     $self init_degas_ui $widget_path
 70     
 71 }
 72 
 73 VicApplication/DegasClient private exit {} {
 74     $self instvar ui_
 75     $ui_ close_log
 76     $self next
 77 }
 78 
 79 
 80 VicApplication/DegasClient private start_service { recv_session_spec } {
 81         $self instvar agent_
 82         set ab [new AddressBlock $recv_session_spec]
 83         $agent_ reset $ab
 84         delete $ab
 85 }
 86 
 87 
 88 #------------------------------------------------------------------

 89 # VicApplication/DegasClient::init_args

 90 #

 91 # purpose : Initialize arguments for DegasClient.

 92 # input   : options - an Option object for storing options.

 93 # output  : none

 94 #------------------------------------------------------------------

 95 
 96 VicApplication/DegasClient public init_args {options} {
 97     $self next $options
 98     $options register_option -os outSession
 99     $options register_option -outSession outSession
100     $options register_option -df degasProgFilename
101     $options register_option -degasProgFilename degasProgFilename
102     $options register_option -dc degasCtrlSessionSpec
103     $options register_option -degasCtrlSessionSpec degasCtrlSessionSpec
104     $options register_option -ds degasSessionSpec
105     $options register_option -degasSessionSpec degasSessionSpec
106     $options register_option -fl fpsLog
107     $options register_option -fps_log fpsLog
108         $options register_option -minPort minPort
109         $options register_option -maxPort maxPort
110         $options register_option -ttl ttl
111         $options register_option -debug debug
112 }
113 
114 
115 #------------------------------------------------------------------

116 # VicApplication/DegasClient::init_resources 

117 #

118 # purpose : Initialize the resources for this application.

119 # input   : options - an Option object for managing command line

120 #           options.

121 # output  : none.

122 #------------------------------------------------------------------

123 
124 VicApplication/DegasClient public init_resources {options} {
125     $self next $options
126     $options add_default degasCtrlSessionSpec 224.10.85.29/40000/32
127     $options add_default iconPrefix "degasclient:" 
128         $options add_default ttl 32
129         $options add_default minPort 30000
130         $options add_default maxPort 30500
131         $options add_default debug 0
132         $options add_default outSession ""
133 }
134 
135 
136 
137 #------------------------------------------------------------------

138 # VicApplication/DegasClient get_prog_filename 

139 #

140 # purpose : Get the program to submit to server, thru command line

141 #           or gui.  Currently only command line is implemented.

142 # input   : none                

143 # output  : none

144 #------------------------------------------------------------------

145 
146 VicApplication/DegasClient private get_prog_filename {} {
147     $self instvar program_
148     set filename [$self get_option degasProgFilename]
149     if {$filename == ""} {
150         # Should popup a dialog box to ask the user

151         # which program to use.

152                 return ""
153     }
154     return $filename
155 }
156 
157 
158 #------------------------------------------------------------------

159 # VicApplication/DegasClient::parse_program

160 #

161 # purpose : Parse the program and initialize data for file.

162 # input   : filename - filename of the file to parse.

163 # output  : none

164 #------------------------------------------------------------------

165 
166 VicApplication/DegasClient private parse_program {filename} {
167     set f [open $filename r]
168     set l [read -nonewline $f]
169 
170     # We could have parse the program here, but why not send

171     # it to the server, and let the server parse it ?  Other

172     # we have to encode the info into ALM message, and the

173     # server have to parse the ALM message anyway.

174 #   foreach {key value} $l {

175 #       switch -exact $key {

176 #           {sources} {set sources_ $value}

177 #           {init_callback} {set init_callback_ $value}

178 #           {recv_frame_callback} {set recv_frame_callback_ $value}

179 #           {new_source_callback} {set new_source_callback_ $value}

180 #           {del_source_callback} {set del_source_callback_ $value}

181 #           {destroy_callback} {set destroy_callback_ $value}

182 #       }

183 #   }

184 }
185 
186 #------------------------------------------------------------------

187 # VicApplication/DegasClient::init_degas_ui 

188 #

189 # purpose : Creates GUI elements for Degas

190 # input   : widget_path - path of the widget for us to build ui on.

191 # output  : none

192 #------------------------------------------------------------------

193 
194 VicApplication/DegasClient private init_degas_ui {widget_path} {
195     # do nothing for now.

196 }
197 
198 
199 #------------------------------------------------------------------

200 # VicApplication/DegasClient::check_hostspec

201 #

202 # purpose : this overwrites the default in RTPApplication.  Defaults

203 #           behaviour dictates that we must passed in either a "usemega"

204 #           option or a multicast address to listen to.  We overwrites

205 #           the behavior.  We only requires 

206 # input   : argv, mega_session - don't care.

207 # output  : none.

208 #------------------------------------------------------------------

209 
210 VicApplication/DegasClient private check_hostspec {argv mega_session} {
211         $self instvar start_vic_
212         if {$start_vic_ == 1} {
213                 return [$self next $argv $mega_session]
214         } else {
215                 puts "RETURN EMPTY STRING"
216                 return ""
217         }
218 }
219 
220 
221 #------------------------------------------------------------------

222 # VicApplication/DegasClient::init_ui

223 #

224 # purpose : Create a user interface.  Similar to VicApplication::init_ui

225 #           except that we create a VicUI/Degas instead of VicUI.

226 # input   : wpath, spec - I don't care

227 #           controller - the controller that capture mouse events on

228 #               user window.

229 # output  : none

230 #------------------------------------------------------------------

231 
232 VicApplication/DegasClient private init_ui {wpath spec} {
233     $self instvar controller_
234         $self instvar agent_ vpipe_ scuba_sess_
235     $self instvar local_chan_ glob_chan_ ui_
236 
237         frame $wpath
238         set ui_ [new VicUI/Degas $wpath $local_chan_ \
239         $glob_chan_ $agent_ $vpipe_ "$self exit" $spec $controller_]
240         pack $wpath -expand 1 -fill both
241         update idletasks
242 
243         if { [$self get_option useScuba] != "" } {
244                 $ui_ set scuba_sess_ $scuba_sess_
245         }
246 
247         if { [$self get_option fpsLog] != "" } {
248                 $ui_ open_log [$self get_option fpsLog]
249         }
250 
251         return $ui_
252 }
253 

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