sub init() m.top.functionName = "executeTask" end sub function getDeviceId(deviceInfo as object) as String ' Try to get the Serial Number for an ECP call request = CreateObject("roUrlTransfer") request.SetUrl("http://localhost:8060/query/device-info") root = CreateObject("roXMLElement") if root.Parse(request.GetToString()) then serialnums = root.GetNamedElements("serial-number") if serialnums.Count() > 0 model = root.GetNamedElements("model-number") if model.Count() > 0 return serialnums[0].GetText() + ":" + model[0].GetText() end if end if end if ' That did not work, so make a custom one. clientID = Right(deviceInfo.GetChannelClientId(), 6) modelID = deviceInfo.GetModel() return clientID + "-" + modelID end function function executeTask() as void am = CreateObject("roAppManager") aaRunParams = am.GetRunParams() for each key in aaRunParams val = aaRunParams[key] m.top.updateText = key + " = " + val.ToStr() end for deviceInfo = CreateObject("roDeviceInfo") port = CreateObject("roMessagePort") deviceInfo.SetMessagePort(port) success = deviceInfo.EnableLinkStatusEvent(true) if not success m.top.updateTextLower = "EnableLinkStatusEvent failure" success = deviceInfo.EnableAudioDestinationEvent(true) if not success then m.top.updateTextLower = "EnableAudioDestinationEvent failure" success = deviceInfo.EnableAudioGuideChangedEvent(true) if not success then m.top.updateTextLower = "EnableAudioGuideChangedEvent failure" success = deviceInfo.EnableAppFocusEvent(true) if not success then m.top.updateTextLower = "EnableAppFocusEvent failure" success = deviceInfo.EnableCodecCapChangedEvent(true) if not success then m.top.updateTextLower = "EnableCodecCapChangedEvent failure" ' ' This is a good place to experiment. ' Here, we print the GetConnectionInfo AssociativeArray. ' aaConnectionInfo = deviceInfo.GetConnectionInfo() for each key in aaConnectionInfo val = aaConnectionInfo[key] m.top.updateTextRight = key + " = " + val.ToStr() end for while(true) msg = wait(0, port) msgType = type(msg) dt = Mid(CreateObject("roDateTime").ToISOString(), 15, 5) if msgType = "roHdmiStatusEvent" aa = msg.GetInfo() v = aa.LookupCI("Plugged") if v <> invalid then m.top.updateTextLower = dt + " HDMI plugged " + v.toStr() elseif msgType = "roCECStatusEvent" aa = msg.GetInfo() v = aa.LookupCI("Active") if v <> invalid then m.top.updateTextLower = dt + " CEC Status " + v.toStr() elseif msgType = "roDeviceInfoEvent" aa = msg.GetInfo() v = aa.LookupCI("Mute") if v <> invalid then m.top.updateTextLower = dt + " Mute " + v.toStr() v = aa.LookupCI("Mode") if v <> invalid then m.top.updateTextLower = dt + " Mode " + v.toStr() v = aa.LookupCI("linkStatus") if v <> invalid then m.top.updateTextLower = dt + " LinkStatus " + v.toStr() v = aa.LookupCI("audioGuideEnabled") if v <> invalid then m.top.updateTextLower = dt + " AudioGuide " + v.toStr() v = aa.LookupCI("appFocused") if v <> invalid then m.top.updateTextLower = dt + " appFocused " + v.toStr() v = aa.LookupCI("audioCodecCapabilityChanged") if v <> invalid then m.top.updateTextLower = dt + " audioCodecCapabilityChanged " + v.toStr() else m.top.updateTextLower = dt + " msgType " + msgType end if end while end function