ba02c2fe86f1081e2fe1fc80a60761b1cf296dbc
David Blume first commit

David Blume authored 5 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 
David Blume Add a certificates file to...

David Blume authored 5 years ago

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

David Blume authored 5 years ago

34) 
35)     deviceInfo = CreateObject("roDeviceInfo")
36)     port = CreateObject("roMessagePort")
37)     deviceInfo.SetMessagePort(port)
38) 
39)     success = deviceInfo.EnableLinkStatusEvent(true)
40)     if not success m.top.updateTextLower = "EnableLinkStatusEvent failure"
41)     success = deviceInfo.EnableAudioDestinationEvent(true)
42)     if not success then m.top.updateTextLower = "EnableAudioDestinationEvent failure"
43)     success = deviceInfo.EnableAudioGuideChangedEvent(true)
44)     if not success then m.top.updateTextLower = "EnableAudioGuideChangedEvent failure"
45)     success = deviceInfo.EnableAppFocusEvent(true)
46)     if not success then m.top.updateTextLower = "EnableAppFocusEvent failure"
47)     success = deviceInfo.EnableCodecCapChangedEvent(true)
48)     if not success then m.top.updateTextLower = "EnableCodecCapChangedEvent failure"
49) 
50)     while(true)
51)         msg = wait(0, port)
52)         msgType = type(msg)
53) 
54)         dt = Mid(CreateObject("roDateTime").ToISOString(), 15, 5)
55) 
56)         if msgType = "roHdmiStatusEvent"
57)             aa = msg.GetInfo()
58)             v = aa.LookupCI("Plugged")
David Blume Remove unused QR images; Ad...

David Blume authored 5 years ago

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

David Blume authored 5 years ago

60)         elseif msgType = "roCECStatusEvent"
61)             aa = msg.GetInfo()
62)             v = aa.LookupCI("Active")
David Blume Remove unused QR images; Ad...

David Blume authored 5 years ago

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

David Blume authored 5 years ago

64)         elseif msgType = "roDeviceInfoEvent"
65)             aa = msg.GetInfo()
66)             v = aa.LookupCI("Mute")
David Blume Remove unused QR images; Ad...

David Blume authored 5 years ago

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

David Blume authored 5 years ago

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

David Blume authored 5 years ago

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

David Blume authored 5 years ago

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

David Blume authored 5 years ago

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

David Blume authored 5 years ago

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

David Blume authored 5 years ago

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

David Blume authored 5 years ago

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

David Blume authored 5 years ago

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

David Blume authored 5 years ago

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

David Blume authored 5 years ago

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