02a7bf67e4f397fa0e7ed4111be0df86442437c2
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) 
49)     while(true)
50)         msg = wait(0, port)
51)         msgType = type(msg)
52) 
53)         dt = Mid(CreateObject("roDateTime").ToISOString(), 15, 5)
54) 
55)         if msgType = "roHdmiStatusEvent"
56)             aa = msg.GetInfo()
57)             v = aa.LookupCI("Plugged")
David Blume Remove unused QR images; Ad...

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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

David Blume authored 4 years ago

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