144fb144e976aca67bf65913abe7ca0e4d758ecb
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 = {}
dblume Add RIDA and full client ID

dblume authored 1 year ago

8)     aa["RIDA"] = deviceInfo.GetRIDA()
dblume Client ID not useful in UI,...

dblume authored 1 year ago

9)     print "Client ID = " deviceInfo.GetChannelClientId()
David Blume first commit

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

18)         elements = root.GetNamedElements("device-id")
19)         if elements.Count() > 0
20)             aa["device ID"] = elements[0].GetText()
21)         end if
22)         elements = root.GetNamedElements("model-number")
23)         if elements.Count() > 0
24)             aa.["model"] = elements[0].GetText()
25)         end if
26)         elements = root.GetNamedElements("build-number")
27)         if elements.Count() > 0
David Blume Add an easier-to-read versi...

David Blume authored 4 years ago

28)             fv =  elements[0].GetText()
29)             elements = root.GetNamedElements("software-version")
30)             if elements.Count() > 0
31)                 aa.["firmware version"] = fv + " (" + elements[0].GetText() + " " + mid(fv, 9, 4) + ")"
32)             else
33)                 aa.["firmware version"] = fv
34)             end if
David Blume Add some invariant info to...

David Blume authored 4 years ago

35)         end if
36)         return aa
David Blume first commit

David Blume authored 4 years ago

37)     end if
38)     ' That did not work, so make a custom one.
dblume Add ModelNumber form GetMod...

dblume authored 1 year ago

39)     aa["model"] = deviceInfo.GetModel() + " (" + deviceInfo.GetModelDetails()["ModelNumber"] + ")"
dblume Add RIDA and full client ID

dblume authored 1 year ago

40)     mmrb = deviceInfo.GetOSVersion()  ' major minor revision build
41)     aa["firmware version"] = mmrb["major"]+"."+mmrb["minor"] +"."+mmrb["revision"]+" build "+mmrb["build"]
42) 
43)     return aa
David Blume first commit

David Blume authored 4 years ago

44) end function
45) 
46) function executeTask() as void
47) 
48)     am = CreateObject("roAppManager")
49)     aaRunParams = am.GetRunParams()
dblume Add ModelNumber form GetMod...

dblume authored 1 year ago

50)     for each key in aaRunParams.Keys()
David Blume first commit

David Blume authored 4 years ago

51)         val = aaRunParams[key]
52)         m.top.updateText = key + " = " + val.ToStr()
David Blume Fix static analysis problem...

David Blume authored 4 years ago

53)     end for
David Blume Add some invariant info to...

David Blume authored 4 years ago

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

David Blume authored 4 years ago

55) 
56)     deviceInfo = CreateObject("roDeviceInfo")
David Blume Add some invariant info to...

David Blume authored 4 years ago

57)     infoaa = getDeviceInfo(deviceInfo)
58)     if infoaa <> invalid:
dblume Add ModelNumber form GetMod...

dblume authored 1 year ago

59)         for each key in infoaa.Keys()
David Blume Add some invariant info to...

David Blume authored 4 years ago

60)             val = infoaa[key]
61)             m.top.updateText = key + " = " + val.ToStr()
David Blume Fix static analysis problem...

David Blume authored 4 years ago

62)         end for
David Blume Add some invariant info to...

David Blume authored 4 years ago

63)     else
64)         m.top.updateText = "(Could not get device info.)"
65)     end if
David Blume first commit

David Blume authored 4 years ago

66)     port = CreateObject("roMessagePort")
67)     deviceInfo.SetMessagePort(port)
David Blume Fix static analysis problem...

David Blume authored 4 years ago

68)     input = CreateObject("roInput")
69)     input.SetMessagePort(port)
dblume Enable CEC Active and HDMI...

dblume authored 1 year ago

70)     cecstatus = CreateObject("roCECStatus")
71)     cecStatus.SetMessagePort(port)
72)     hdmistatus = CreateObject("roHDMIStatus")
73)     hdmistatus.SetMessagePort(port)
David Blume first commit

David Blume authored 4 years ago

74) 
75)     success = deviceInfo.EnableLinkStatusEvent(true)
76)     if not success m.top.updateTextLower = "EnableLinkStatusEvent failure"
77)     success = deviceInfo.EnableAudioDestinationEvent(true)
78)     if not success then m.top.updateTextLower = "EnableAudioDestinationEvent failure"
79)     success = deviceInfo.EnableAudioGuideChangedEvent(true)
80)     if not success then m.top.updateTextLower = "EnableAudioGuideChangedEvent failure"
81)     success = deviceInfo.EnableAppFocusEvent(true)
82)     if not success then m.top.updateTextLower = "EnableAppFocusEvent failure"
83)     success = deviceInfo.EnableCodecCapChangedEvent(true)
84)     if not success then m.top.updateTextLower = "EnableCodecCapChangedEvent failure"
dblume Better and more events

dblume authored 1 year ago

85)     success = deviceInfo.EnableScreensaverExitedEvent(true)
86)     if not success then m.top.updateTextLower = "EnableScreensaverExitedEvent failure"
David Blume first commit

David Blume authored 4 years ago

87) 
88)     while(true)
89)         msg = wait(0, port)
90)         msgType = type(msg)
91) 
dblume Client ID not useful in UI,...

dblume authored 1 year ago

92)         dt = Mid(CreateObject("roDateTime").ToISOString(), 12, 8)
David Blume first commit

David Blume authored 4 years ago

93) 
94)         if msgType = "roHdmiStatusEvent"
95)             aa = msg.GetInfo()
dblume Better and more events

dblume authored 1 year ago

96)             plugged = aa.LookupCI("Plugged")
97)             portnum = aa.LookupCI("PortNumber")
98)             porttype = aa.LookupCI("PortType")
99)             s = dt + " HDMI "
100)             if porttype <> invalid then s = s + porttype + " "
101)             if portnum <> invalid then s = s + portnum.ToStr() + " "
102)             if plugged <> invalid then
103)                 if plugged then s = s + "Plugged" else s = s + "Unplugged"
104)             end if
105)             m.top.updateTextLower = s
David Blume first commit

David Blume authored 4 years ago

106)         elseif msgType = "roCECStatusEvent"
107)             aa = msg.GetInfo()
108)             v = aa.LookupCI("Active")
dblume Enable CEC Active and HDMI...

dblume authored 1 year ago

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

David Blume authored 4 years ago

110)         elseif msgType = "roDeviceInfoEvent"
111)             aa = msg.GetInfo()
112)             v = aa.LookupCI("Mute")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

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

David Blume authored 4 years ago

114)             v = aa.LookupCI("Mode")
dblume Rename Mode to Caption Mode

dblume authored 1 year ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

120)             v = aa.LookupCI("appFocused")
dblume Better and more events

dblume authored 1 year ago

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

David Blume authored 4 years ago

122)             v = aa.LookupCI("audioCodecCapabilityChanged")
dblume Better and more events

dblume authored 1 year ago

123)             if v <> invalid then m.top.updateTextLower = dt + " AudioCodecCapabilityChanged " + v.toStr()
124)             v = aa.LookupCI("videoCodecCapabilityChanged")
125)             if v <> invalid then m.top.updateTextLower = dt + " VideoCodecCapabilityChanged " + v.toStr()
126)             v = aa.LookupCI("exitedScreensaver")
127)             if v <> invalid then  m.top.updateTextLower = dt + " ExitedScreensaver " + v.toStr()
128)             v = aa.LookupCI("appFocus")  ' Need to verify it's actually appFocused above
129)             if v <> invalid then m.top.updateTextLower = dt + " AppFocus " + v.toStr()
130)             v = aa.LookupCI("generalMemoryLevel")
131)             if v <> invalid then m.top.updateTextLower = dt + " GeneralMemoryLevel " + v.toStr()
David Blume Fix static analysis problem...

David Blume authored 4 years ago

132)         elseif msgType = "roInputEvent"
133)             info = msg.GetInfo()
134)             m.top.updateTextLower = dt + " Input " + FormatJSON(info)