Does anyone has a working example or ecp for inputs?
Im trying to send a message from java or python to my channel while its running.
my code so far would be something like this:
while (true)
msg = wait(0, port)
print "type(msg): ",type(msg)
print "msg.GetMessage(): ",msg.GetMessage()
if (type(msg) = "roInput")
print "Got the message: ", msg.url
end if
end while
keypresses up, down, querying apps and home key are working as expected according to the ecp manual, but i cant get any custom message across my channel, it just doesnt show up while waiting for input from the remote…
The external control server places these name-value pairs into a BrightScript associative array and passes them directly through to the currently executing channel script via a Message Port attached to a created roInput object.
…
Messages of type roInputEvent have a GetInfo() method that will obtain the associative array.
“adrianc1982” wrote:
Does anyone has a working example or ecp for inputs?
Sub Main ()
inputObject = CreateObject ("roInput")
port = CreateObject ("roMessagePort")
inputObject.SetMessagePort (port)
While True
msg = Wait (0, port)
If Type (msg) = "roInputEvent"
info = msg.GetInfo ()
Print info
EndIf
End While
End Sub
The trick to sending an ECP input request is to ensure that you use the HTTP POST verb (not GET), and put the arguments in the QUERY STRING (NOT in the request body). This is a non-conventional practice. Normally, if you have query string arguments with no message body, you’d use a GET request; if you wanted to use a POST request, you’d put the arguments in the body. However, Roku chooses to do things differently, for whatever reason, and you have to make sure you use a POST with a query string and an empty message body.