ee23104ddc72a15d791cad33a492c9528a4360ef
David Blume first commit

David Blume authored 4 years ago

1) sub init()
2)     m.top.functionName = "executeTask"
3) end sub
4) 
David Blume Add some invariant info to...

David Blume authored 4 years ago

5) function getDeviceInfo(deviceInfo as object) as Object
6)     ' Try to get various info from an ECP call
7)     aa = {}
David Blume first commit

David Blume authored 4 years ago

8)     request = CreateObject("roUrlTransfer")
9)     request.SetUrl("http://localhost:8060/query/device-info")
10)     root = CreateObject("roXMLElement")
11)     if root.Parse(request.GetToString()) then
David Blume Add some invariant info to...

David Blume authored 4 years ago

12)         elements = root.GetNamedElements("serial-number")
13)         if elements.Count() > 0
14)             aa["serial number"] = elements[0].GetText()
David Blume first commit

David Blume authored 4 years ago

15)         end if
David Blume Add some invariant info to...

David Blume authored 4 years ago

16)         elements = root.GetNamedElements("device-id")
17)         if elements.Count() > 0
18)             aa["device ID"] = elements[0].GetText()
19)         end if
20)         elements = root.GetNamedElements("model-number")
21)         if elements.Count() > 0
22)             aa.["model"] = elements[0].GetText()
23)         end if
24)         elements = root.GetNamedElements("build-number")
25)         if elements.Count() > 0
26)             aa.["firmware version"] = elements[0].GetText()
27)         end if
28)         return aa
David Blume first commit

David Blume authored 4 years ago

29)     end if
30)     ' That did not work, so make a custom one.
31)     clientID = Right(deviceInfo.GetChannelClientId(), 6)
32)     modelID = deviceInfo.GetModel()
David Blume Add some invariant info to...

David Blume authored 4 years ago

33)     return { "client ID": clientID, "model": modelID }
David Blume first commit

David Blume authored 4 years ago

34) end function
35) 
36) function executeTask() as void
37) 
38)     am = CreateObject("roAppManager")
39)     aaRunParams = am.GetRunParams()
40)     for each key in aaRunParams
41)         val = aaRunParams[key]
42)         m.top.updateText = key + " = " + val.ToStr()
43)     end for 
David Blume Add some invariant info to...

David Blume authored 4 years ago

44)     ' m.top.updateText = "devID " + CreateObject("roAppInfo").GetDevID()
David Blume first commit

David Blume authored 4 years ago

45) 
46)     deviceInfo = CreateObject("roDeviceInfo")
David Blume Add some invariant info to...

David Blume authored 4 years ago

47)     infoaa = getDeviceInfo(deviceInfo)
48)     if infoaa <> invalid:
49)         for each key in infoaa
50)             val = infoaa[key]
51)             m.top.updateText = key + " = " + val.ToStr()
52)         end for 
53)     else
54)         m.top.updateText = "(Could not get device info.)"
55)     end if
David Blume first commit

David Blume authored 4 years ago

56)     port = CreateObject("roMessagePort")
57)     deviceInfo.SetMessagePort(port)
58) 
59)     success = deviceInfo.EnableLinkStatusEvent(true)
60)     if not success m.top.updateTextLower = "EnableLinkStatusEvent failure"
61)     success = deviceInfo.EnableAudioDestinationEvent(true)
62)     if not success then m.top.updateTextLower = "EnableAudioDestinationEvent failure"
63)     success = deviceInfo.EnableAudioGuideChangedEvent(true)
64)     if not success then m.top.updateTextLower = "EnableAudioGuideChangedEvent failure"
65)     success = deviceInfo.EnableAppFocusEvent(true)
66)     if not success then m.top.updateTextLower = "EnableAppFocusEvent failure"
67)     success = deviceInfo.EnableCodecCapChangedEvent(true)
68)     if not success then m.top.updateTextLower = "EnableCodecCapChangedEvent failure"
69) 
70)     while(true)
71)         msg = wait(0, port)
72)         msgType = type(msg)
73) 
74)         dt = Mid(CreateObject("roDateTime").ToISOString(), 15, 5)
75) 
76)         if msgType = "roHdmiStatusEvent"
77)             aa = msg.GetInfo()
78)             v = aa.LookupCI("Plugged")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

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

David Blume authored 4 years ago

80)         elseif msgType = "roCECStatusEvent"
81)             aa = msg.GetInfo()
82)             v = aa.LookupCI("Active")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

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

David Blume authored 4 years ago

84)         elseif msgType = "roDeviceInfoEvent"
85)             aa = msg.GetInfo()
86)             v = aa.LookupCI("Mute")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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