dd251c458fa222c779505bcbf0b244047f37362d
David Blume first commit

David Blume authored 4 years ago

1) sub init()
2)     m.top.functionName = "executeTask"
3) end sub
4) 
5) function getDeviceId(deviceInfo as object) as String
6)     ' Try to get the Serial Number for an ECP call
7)     request = CreateObject("roUrlTransfer")
8)     request.SetUrl("http://localhost:8060/query/device-info")
9)     root = CreateObject("roXMLElement")
10)     if root.Parse(request.GetToString()) then
11)         serialnums = root.GetNamedElements("serial-number")
12)         if serialnums.Count() > 0
13)             model = root.GetNamedElements("model-number")
14)             if model.Count() > 0
15)                 return serialnums[0].GetText() + ":" + model[0].GetText()
16)             end if
17)         end if
18)     end if
19)     ' That did not work, so make a custom one.
20)     clientID = Right(deviceInfo.GetChannelClientId(), 6)
21)     modelID = deviceInfo.GetModel()
22)     return clientID + "-" + modelID
23) end function
24) 
25) function executeTask() as void
26) 
27)     am = CreateObject("roAppManager")
28)     aaRunParams = am.GetRunParams()
29)     for each key in aaRunParams
30)         val = aaRunParams[key]
31)         m.top.updateText = key + " = " + val.ToStr()
32)     end for 
33) 
34)     deviceInfo = CreateObject("roDeviceInfo")
35)     port = CreateObject("roMessagePort")
36)     deviceInfo.SetMessagePort(port)
37) 
38)     success = deviceInfo.EnableLinkStatusEvent(true)
39)     if not success m.top.updateTextLower = "EnableLinkStatusEvent failure"
40)     success = deviceInfo.EnableAudioDestinationEvent(true)
41)     if not success then m.top.updateTextLower = "EnableAudioDestinationEvent failure"
42)     success = deviceInfo.EnableAudioGuideChangedEvent(true)
43)     if not success then m.top.updateTextLower = "EnableAudioGuideChangedEvent failure"
44)     success = deviceInfo.EnableAppFocusEvent(true)
45)     if not success then m.top.updateTextLower = "EnableAppFocusEvent failure"
46)     success = deviceInfo.EnableCodecCapChangedEvent(true)
47)     if not success then m.top.updateTextLower = "EnableCodecCapChangedEvent failure"
48) 
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

49)     '
50)     ' This is a good place to experiment.
51)     ' Here, we print the GetConnectionInfo AssociativeArray.
52)     '
David Blume first commit

David Blume authored 4 years ago

53)     aaConnectionInfo = deviceInfo.GetConnectionInfo()
54)     for each key in aaConnectionInfo
55)         val = aaConnectionInfo[key]
56)         m.top.updateTextRight = key + " = " + val.ToStr()
57)     end for
58) 
59)     while(true)
60)         msg = wait(0, port)
61)         msgType = type(msg)
62) 
63)         dt = Mid(CreateObject("roDateTime").ToISOString(), 15, 5)
64) 
65)         if msgType = "roHdmiStatusEvent"
66)             aa = msg.GetInfo()
67)             v = aa.LookupCI("Plugged")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

68)             if v <> invalid then m.top.updateTextLower = dt + " HDMI plugged " + v.toStr()
David Blume first commit

David Blume authored 4 years ago

69)         elseif msgType = "roCECStatusEvent"
70)             aa = msg.GetInfo()
71)             v = aa.LookupCI("Active")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

72)             if v <> invalid then m.top.updateTextLower = dt + " CEC Status " + v.toStr()
David Blume first commit

David Blume authored 4 years ago

73)         elseif msgType = "roDeviceInfoEvent"
74)             aa = msg.GetInfo()
75)             v = aa.LookupCI("Mute")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

76)             if v <> invalid then  m.top.updateTextLower = dt + " Mute " + v.toStr()
David Blume first commit

David Blume authored 4 years ago

77)             v = aa.LookupCI("Mode")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

78)             if v <> invalid then m.top.updateTextLower = dt + " Mode " + v.toStr()
David Blume first commit

David Blume authored 4 years ago

79)             v = aa.LookupCI("linkStatus")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

80)             if v <> invalid then m.top.updateTextLower = dt + " LinkStatus " + v.toStr()
David Blume first commit

David Blume authored 4 years ago

81)             v = aa.LookupCI("audioGuideEnabled")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

82)             if v <> invalid then m.top.updateTextLower = dt + " AudioGuide " + v.toStr()
David Blume first commit

David Blume authored 4 years ago

83)             v = aa.LookupCI("appFocused")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

84)             if v <> invalid then m.top.updateTextLower = dt + " appFocused " + v.toStr()
David Blume first commit

David Blume authored 4 years ago

85)             v = aa.LookupCI("audioCodecCapabilityChanged")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

86)             if v <> invalid then m.top.updateTextLower = dt + " audioCodecCapabilityChanged " + v.toStr()