Get Input From IR Remote To JS App

Here is my current autorun.brs file:

sub Main()
reg = CreateObject("roRegistrySection", "networking")
reg.write("ssh", "22")
n = CreateObject("roNetworkConfiguration", 0)

info = CreateObject("roDeviceInfo")
m.PlayerId = info.GetDeviceUniqueId()
m.mPort = CreateObject("roMessagePort")
m.configIR = CreateObject("roAssociativeArray")
m.configIR.source = "Iguana"
m.configIR.encodings = CreateObject("roArray", 1, false)
m.configIR.encodings[0] = "NEC"
m.IRRecep = CreateObject("roIRReceiver", m.configIR)
m.irReceiver = CreateObject("roIRReceiver", m.configIR)

if type(m.irReceiver) = "roIRReceiver" then

r = CreateObject("roRectangle", 0, 0, 1920, 1080)

is = {
port: 2999

config = {
nodejs_enabled: true
inspector_server: is
brightsign_js_objects_enabled: true
url: "file:///sd:/frontend/index.html"

m.node = CreateObject("roNodeJS", "app.js", {message_port: m.mPort})
m.h = CreateObject("roHtmlWidget", r, config)

while true
' do nothing

end sub

In this file, I am trying to register my IguanaWorks IR Receiver, then start an express server, and finally show an html page (which makes calls to the server, hence the 5000 ms wait).

* I am sure there are numerous things wrong with this file, so if you see anything alarming outside my specific needs here, please share. *

I need to add an event listener in my javascript (which is loaded through file:///sd:/frontend/index.html) to be triggered by inputs on the remote. I don't know if I have to use the message port for this or the bs javascript API or both. Can someone steer me in the right direction here?

1 comment

  • 0
    Brandon Stryker

    following up on this. Since posting I have been able to post messages to my nodeJs app, confirm in the nodeJs app that the messages are being received (kinda...), print status updates to the message port, and view messages in the message port. I have not yet been able to confirm via the message port that a single roIRReceiver event has occurred. The Iguana Works transceiver is supposed to be able to receive input from a range of remote codes. I have tried the codes from a few popular brands (first and foremost roku) and have still failed to confirm that any messages events are being created and if they are they are certainly not in the messagePort (which I am viewing via ssh to the device). All other expected messages are in the messagePort log.

Please sign in to leave a comment.