5720af930a3639ec8fdf66c13d3f9d432f77d4f5
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()
9)     aa["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"
85) 
86)     while(true)
87)         msg = wait(0, port)
88)         msgType = type(msg)
89) 
90)         dt = Mid(CreateObject("roDateTime").ToISOString(), 15, 5)
91) 
92)         if msgType = "roHdmiStatusEvent"
93)             aa = msg.GetInfo()
94)             v = aa.LookupCI("Plugged")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

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

David Blume authored 4 years ago

96)         elseif msgType = "roCECStatusEvent"
97)             aa = msg.GetInfo()
98)             v = aa.LookupCI("Active")
dblume Enable CEC Active and HDMI...

dblume authored 1 year ago

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

David Blume authored 4 years ago

100)         elseif msgType = "roDeviceInfoEvent"
101)             aa = msg.GetInfo()
102)             v = aa.LookupCI("Mute")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

dblume authored 1 year ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

113)             if v <> invalid then m.top.updateTextLower = dt + " audioCodecCapabilityChanged " + v.toStr()
David Blume Fix static analysis problem...

David Blume authored 4 years ago

114)         elseif msgType = "roInputEvent"
115)             info = msg.GetInfo()
116)             m.top.updateTextLower = dt + " Input " + FormatJSON(info)