1 # dcc.tcl --
2 #
3 # Test app for testing DcClient and DC RPC API
4 #
5 # Copyright (c) 2000-2002 The Regents of the University of California.
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
10 #
11 # A. Redistributions of source code must retain the above copyright notice,
12 # this list of conditions and the following disclaimer.
13 # B. Redistributions in binary form must reproduce the above copyright notice,
14 # this list of conditions and the following disclaimer in the documentation
15 # and/or other materials provided with the distribution.
16 # C. Neither the names of the copyright holders nor the names of its
17 # contributors may be used to endorse or promote products derived from this
18 # software without specific prior written permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
24 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31 import DpClient DcClient
32
33 Class DcClientApp
34
35 DcClientApp instproc init {hostname port} {
36 $self instvar dcc_
37
38 set dcc_ [new DcClient $hostname $port]
39
40 $self initUI ""
41 }
42
43 DcClientApp instproc initUI {base} {
44
45 wm title . "DC Client"
46 wm minsize . 150 0
47
48 button .thumbInfo -text "ThumbInfo" -command "$self getThumbInfo"
49 pack .thumbInfo -side top
50 button .pvInfo -text "PreviewInfo" -command "$self getPreviewInfo"
51 pack .pvInfo -side top
52 button .bcInfo -text "BroadcastInfo" -command "$self getBroadcastInfo"
53 pack .bcInfo -side top
54 button .pvAll -text "PreviewAll" -command "$self previewAll"
55 pack .pvAll -side top
56 button .bcAll -text "BroadcastAll" -command "$self broadcastAll"
57 pack .bcAll -side top
58 button .clearAll -text "ClearAll" -command "$self clearAll"
59 pack .clearAll -side top
60
61 button .test -text "Test" -command "$self test"
62 pack .test -side top
63
64 button .exit -text "Exit" -command "exit"
65 pack .exit -side bottom
66 }
67
68 DcClientApp instproc getThumbInfo {} {
69 $self instvar dcc_
70
71 set retVal [$dcc_ getThumbnailInfo]
72 puts stdout "dcApi_getThumbnailInfo returns $retVal"
73 }
74
75 DcClientApp instproc getPreviewInfo {} {
76 $self instvar dcc_
77
78 set retVal [$dcc_ getPreviewInfo]
79 puts stdout "dcApi_getPreviewInfo returns $retVal"
80 }
81
82 DcClientApp instproc getBroadcastInfo {} {
83 $self instvar dcc_
84
85 set retVal [$dcc_ getBroadcastInfo]
86 puts stdout "dcApi_getBroadcastInfo returns $retVal"
87 }
88
89 DcClientApp instproc previewAll {} {
90 $self instvar dcc_
91
92 $dcc_ previewAll
93 }
94
95
96 DcClientApp instproc broadcastAll {} {
97 $self instvar dcc_
98
99 $dcc_ broadcastAll
100 }
101
102 DcClientApp instproc clearAll {} {
103 $self instvar dcc_
104
105 $dcc_ clearAll
106 }
107
108
109 DcClientApp instproc test {} {
110 $self instvar dcc_
111
112 $dcc_ unbroadcastHost "htsr.bmrc.berkeley.edu"
113 }
114
115
116 # main program
117
118 set hostname "garfield.cs.berkeley.edu"
119 set port 6907
120 set dcc [new DcClientApp $hostname $port]
121
122
123
124 vwait forever
125
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.