"RokuChris" wrote:
Yes, it is possible to use ECP from within BrightScript. You can find the IP of the box using roDeviceinfo, then make ECP calls using roURLTransfer. There should be very few cases where you would need/want to do so, but for what you're trying to do, it might be a possible solution.
quantumguy, here's a snippet from something I've been working on that should help get you started:
Function GetRokuLocalIP() As String
deviceInfo = CreateObject("roDeviceInfo")
ipAddresses = deviceInfo.GetIPAddrs()
For Each key In ipAddresses
ipAddress = ipAddresses[key]
If ipAddress <> invalid And ipAddress.Len() > 0 Then
Return ipAddress
End If
Next
Return ""
End Function
ip = GetRokuLocalIP()
xfer = CreateObject("roURLTransfer")
ECPUrl= "http://" + ip + ":8060/keypress/Down"
xfer.SetURL(ECPUrl)
result = xfer.PostFromString("") 'Note:Most commands in the ECP protocol expect an empty POST body.
See the ExternalControlGuide.pdf of the sdk for more info.
Remoku.tv - A free web app for Roku Remote Control!
Want to control your Roku from nearly any phone, computer or tablet? Get started at http://help.remoku.tv
by Apps4TV - Applications for television and beyond: http://www.apps4tv.com