File: tvdevicepres.html

package info (click to toggle)
pupnp 1%3A1.14.20-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 3,440 kB
  • sloc: ansic: 34,488; xml: 1,173; cpp: 573; makefile: 341; sh: 130; python: 51; javascript: 7
file content (300 lines) | stat: -rw-r--r-- 9,348 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  <HTML>
    <HEAD>
      <TITLE>Presentation page for Controlling a UPnP Television</TITLE>
    </HEAD>

    <BODY>

      <H3><P ID=FName>Device Name</P></H3>


      <H3>TvDevice Control State Table</H3>
      <TABLE BGCOLOR='#D6D7DE' BORDER=0 VALIGN=top ALIGN=left CELLPADDING=1 CELLSPACING=3>
        <TR>
          <TD BGCOLOR='#000000' VALIGN=center ALIGN=center WIDTH=60><B><FONT SIZE="2" COLOR=whitesmoke>Variable</FONT></B></TD>
          <TD VALIGN=middle ALIGN=left BGCOLOR='#000000' WIDTH=60><B><FONT SIZE="2" COLOR=whitesmoke>Value</FONT></B></TD>
          <TD VALIGN=middle ALIGN=left BGCOLOR='#000000' WIDTH=60><B><FONT SIZE="2" COLOR=whitesmoke>Actions</FONT></B></TD>
        </TR>
        <TR>
          <TD  BGCOLOR="#FFFFFF" VALIGN=center ALIGN=center>Power</TD>
          <TD  BGCOLOR="#FFFFFF" valign="top"><P ID=Power></P></TD>
          <TD  BGCOLOR="#FFFFFF" valign="top">
		&nbsp;&nbsp;
		<INPUT type="button" onclick="SetPowerOn()"      value=" On   ">
	        &nbsp;&nbsp;
		<INPUT type="button" onclick="SetPowerOff()"     value=" Off  ">
		&nbsp;&nbsp;
          </TD>
        </TR>
        <TR>
          <TD  BGCOLOR="#FFFFFF" VALIGN=center ALIGN=center>Channel</TD>
          <TD  BGCOLOR="#FFFFFF" valign="top"><P ID=Channel></P></TD>
          <TD  BGCOLOR="#FFFFFF" valign="top">
		&nbsp;&nbsp;
		<INPUT type="button" onclick="IncreaseChannel()"     value=" Up   ">
		&nbsp;&nbsp;
	        <INPUT type="button" onclick="DecreaseChannel()"     value=" Down ">
		&nbsp;&nbsp;
          </TD>
        </TR>
        <TR>
          <TD  BGCOLOR="#FFFFFF" VALIGN=center ALIGN=center>Volume</TD>
          <TD  BGCOLOR="#FFFFFF" valign="top"><P ID=Volume></P></TD>
          <TD  BGCOLOR="#FFFFFF" valign="top">
		&nbsp;&nbsp;
		<INPUT type="button" onclick="IncreaseVolume()"     value=" Up   ">
		&nbsp;&nbsp;
	        <INPUT type="button" onclick="DecreaseVolume()"     value=" Down ">
		&nbsp;&nbsp;
          </TD>
        </TR>
      </TABLE>


      <BR>
      <BR>
      <BR>
      <BR>
      <BR>
      <BR>
      <BR>
      <BR>
      <BR>

      <H3>TvDevice Picture State Table</H3>
      <TABLE BGCOLOR='#D6D7DE' BORDER=0 VALIGN=top ALIGN=left CELLPADDING=1 CELLSPACING=3>
        <TR>
          <TD BGCOLOR='#000000' VALIGN=center ALIGN=center WIDTH=60><B><FONT SIZE="2" COLOR=whitesmoke>Variable</FONT></B></TD>
          <TD VALIGN=middle ALIGN=left BGCOLOR='#000000' WIDTH=60><B><FONT SIZE="2" COLOR=whitesmoke>Value</FONT></B></TD>
          <TD VALIGN=middle ALIGN=left BGCOLOR='#000000' WIDTH=60><B><FONT SIZE="2" COLOR=whitesmoke>Actions</FONT></B></TD>
        </TR>
        <TR>
          <TD  BGCOLOR="#FFFFFF" VALIGN=center ALIGN=center>Color</TD>
          <TD  BGCOLOR="#FFFFFF" valign="top"><P ID=Color></P></TD>
          <TD  BGCOLOR="#FFFFFF" valign="top">
		&nbsp;&nbsp;
		<INPUT type="button" onclick="IncreaseColor()"     value=" Up   ">
		&nbsp;&nbsp;
	        <INPUT type="button" onclick="DecreaseColor()"     value=" Down ">
		&nbsp;&nbsp;
          </TD>
        </TR>
        <TR>
          <TD  BGCOLOR="#FFFFFF" VALIGN=center ALIGN=center>Tint</TD>
          <TD  BGCOLOR="#FFFFFF" valign="top"><P ID=Tint></P></TD>
          <TD  BGCOLOR="#FFFFFF" valign="top">
		&nbsp;&nbsp;
		<INPUT type="button" onclick="IncreaseTint()"     value=" Up   ">
		&nbsp;&nbsp;
	        <INPUT type="button" onclick="DecreaseTint()"     value=" Down ">
		&nbsp;&nbsp;
          </TD>
        </TR>
        <TR>
          <TD  BGCOLOR="#FFFFFF" VALIGN=center ALIGN=center>Contrast</TD>
          <TD  BGCOLOR="#FFFFFF" valign="top"><P ID=Contrast></P></TD>
          <TD  BGCOLOR="#FFFFFF" valign="top">
		&nbsp;&nbsp;
		<INPUT type="button" onclick="IncreaseContrast()"     value=" Up   ">
		&nbsp;&nbsp;
	        <INPUT type="button" onclick="DecreaseContrast()"     value=" Down ">
		&nbsp;&nbsp;
          </TD>
        </TR>
        <TR>
          <TD  BGCOLOR="#FFFFFF" VALIGN=center ALIGN=center>Brightness</TD>
          <TD  BGCOLOR="#FFFFFF" valign="top"><P ID=Brightness></P></TD>
          <TD  BGCOLOR="#FFFFFF" valign="top">
		&nbsp;&nbsp;
		<INPUT type="button" onclick="IncreaseBrightness()"     value=" Up   ">
		&nbsp;&nbsp;
	        <INPUT type="button" onclick="DecreaseBrightness()"     value=" Down ">
		&nbsp;&nbsp;
          </TD>
        </TR>
      </TABLE>
<H3>&nbsp;</H3>

<SCRIPT language=VBScript>


' *********************************************************
' Event handler called when the UPnP device submits events
' *********************************************************



Sub eventHandler(callbackType, svcObj, varName, value)

'Dim output
'output = output & "varName " & varName & vbCrLf 
'output = output & "value " & value & vbCrLf
'output = output & "svcObj " & svcObj.Id & vbCrLf
'MsgBox output 

  If (callbackType = "VARIABLE_UPDATE") Then
    select case svcObj.Id
      case "urn:upnp-org:serviceId:tvcontrol1"
        select case varName
          Case "Power"      Power.innerText = value
          Case "Channel"    Channel.innerText = value
          Case "Volume"     Volume.innerText = value
        end select
      case "urn:upnp-org:serviceId:tvpicture1"
        select case varName
          Case "Color"      Color.innerText = value
          Case "Tint"       Tint.innerText = value
          Case "Contrast"   Contrast.innerText = value
          Case "Brightness" Brightness.innerText = value
        end select
      end select
    End If
End Sub



' **********************************************************
' Button action callbacks invoke actions
' **********************************************************

function SetPowerOn()
    Dim inArgs(0)
    Dim outArgs(0)
    TvControlService.InvokeAction "PowerOn", inArgs, outArgs
end function


function SetPowerOff()
    Dim inArgs(0)
    Dim outArgs(0)
    TvControlService.InvokeAction "PowerOff", inArgs, outArgs
end function

function IncreaseChannel()
    Dim inArgs(0)
    Dim outArgs(0)
    TvControlService.InvokeAction "IncreaseChannel", inArgs, outArgs
end function

function DecreaseChannel()
    Dim inArgs(0)
    Dim outArgs(0)
    TvControlService.InvokeAction "DecreaseChannel", inArgs, outArgs
end function

function IncreaseVolume()
    Dim inArgs(0)
    Dim outArgs(0)
    TvControlService.InvokeAction "IncreaseVolume", inArgs, outArgs
end function

function DecreaseVolume()
    Dim inArgs(0)
    Dim outArgs(0)
    TvControlService.InvokeAction "DecreaseVolume", inArgs, outArgs
end function

function IncreaseColor()
    Dim inArgs(0)
    Dim outArgs(0)
    TvPictureService.InvokeAction "IncreaseColor", inArgs, outArgs
end function

function DecreaseColor()
    Dim inArgs(0)
    Dim outArgs(0)
    TvPictureService.InvokeAction "DecreaseColor", inArgs, outArgs
end function

function IncreaseTint()
    Dim inArgs(0)
    Dim outArgs(0)
    TvPictureService.InvokeAction "IncreaseTint", inArgs, outArgs
end function

function DecreaseTint()
    Dim inArgs(0)
    Dim outArgs(0)
    TvPictureService.InvokeAction "DecreaseTint", inArgs, outArgs
end function

function IncreaseContrast()
    Dim inArgs(0)
    Dim outArgs(0)
    TvPictureService.InvokeAction "IncreaseContrast", inArgs, outArgs
end function

function DecreaseContrast()
    Dim inArgs(0)
    Dim outArgs(0)
    TvPictureService.InvokeAction "DecreaseContrast", inArgs, outArgs
end function

function IncreaseBrightness()
    Dim inArgs(0)
    Dim outArgs(0)
    TvPictureService.InvokeAction "IncreaseBrightness", inArgs, outArgs
end function

function DecreaseBrightness()
    Dim inArgs(0)
    Dim outArgs(0)
    TvPictureService.InvokeAction "DecreaseBrightness", inArgs, outArgs
end function




' ********************************************************
' Download the description document from the UPnP device
' ********************************************************
Dim TvDesc
Set TvDesc = CreateObject("UPnP.DescriptionDocument.1")
TvDesc.Load("tvdevicedesc.xml")


' ********************************************************
' Get the Root Device from the description document
' ********************************************************
Dim TvDevice
Set TvDevice = TvDesc.RootDevice


' ********************************************************
' Output some of the device properties to the user
' ********************************************************
Dim output
output = "Found: " & vbCrLf
output = output & "DisplayName: " & TvDevice.FriendlyName & vbCrLf 
output = output & "Type: " & TvDevice.Type & vbCrLf
output = output & "UDN: " & TvDevice.UniqueDeviceName & vbCrLf
MsgBox output 

FName.innerText =  TvDevice.FriendlyName


' ********************************************************
' Attach the event handler to the tv control service 
' ********************************************************
Dim TvControlService
set TvControlService=TvDevice.Services("urn:upnp-org:serviceId:tvcontrol1")
TvControlService.AddCallback GetRef("eventHandler")

' ********************************************************
' Attach the event handler to the tv picture service 
' ********************************************************
Dim TvPictureService
set TvPictureService=TvDevice.Services("urn:upnp-org:serviceId:tvpicture1")
TvPictureService.AddCallback GetRef("eventHandler")



</SCRIPT>
</BODY>
</HTML>