Player APIs (BrightScript & Ja...
...
Object Reference
Input/Output Objects
roIRReceiver
8min
this object supports receiving arbitrary infrared remote control codes using the nec and rc5 protocols the javascript equivalent is bsirreceiver docid\ w5oqmftxhlg8lwiswtg7r object creation the roirreceiver object is created with an associative array createobject("roirreceiver", config as roassociativearray) the associative array can contain the following parameters source a string value indicating the source of the input "ir in" the 3 5mm ir input/output connector (available on 4kx42 and xdx32 models) "gpio" pin 1 of the gpio connector "iguana" the iguanaworks http //iguanaworks net/ ir transceiver this source can support both nec and rc5 encodings simultaneously “tvcontroller” this virtual ir driver is only available on brightsign built in products it reads the ir messages from uart and drives the roirreceiver object like other ir receivers see the examples section encodings an array indicating the required encodings "nec" "rc5" (supported on the iguanaworks ir transceiver only) nec codes are expressed in 24 bits bits 0 7 button code bits 8 23 manufacturer code if the manufacturer code is zero, then the code is considered to be intended for the roku soundbridge remote control the roirreceiver object can generate the following events roirdownevent generates when a button is pressed roirrepeatevent generates when a button repeats roirupevent (iguanaworks ir transceiver only) generates when a button is released ifuserdata setuserdata(user data as object) sets the user data that will be returned when events are raised getuserdata() as object returns the user data that has previously been set via setuserdata() it will return invalid if no data has been set ifmessageport setport(port as romessageport) specifies the port that will receive events generated by the roirreceiver instance examples connecting a usb c port to an ir receiver the ls424 is the only platform where ir input is supported on the type c connector also, a special cable is required either an adapter (3 5mm plug to 3 5mm socket crossover), or custom all in one cable (liteon pn 306300009327) '2 3 23 v1 12 test ir input, output to system log sub main() scriptlog = createobject("rosystemlog") 'display messages in system log msgport = createobject("romessageport") gpioport = createobject("rogpiocontrolport") gpioport setport(msgport) configir = createobject("roassociativearray") 'built in ir via usb c configir source = "typec" configir encodings = createobject("roarray", 1, false) configir encodings\[0] = "nec" irrecep = createobject("roirreceiver", configir) if (type(irrecep) = "roirreceiver") then irrecep setport(msgport) scriptlog sendline(" @@@@ please press a button on remote control to display ir code ") else if irrecep = invalid then scriptlog sendline(" @@@@ ir receiver not detected, please connect ir receiver and reboot player ") end if eventloop(msgport) end sub sub eventloop(msgport as object) scriptlog = createobject("rosystemlog") 'display messages in system log while true event = wait(0, msgport) scriptlog sendline("@@@@ received event"+ type(event)) if (type(event) = "roirdownevent") then irdata$ = stri(event) scriptlog sendline(" @@@@ "+irdata$) end if end while end sub creating a tvcontoller ir receiver configir = createobject("roassociativearray") 'tvcontroller ir type configir source = "tvcontroller" configir encodings = createobject("roarray", 0, false) irrecep = createobject("roirreceiver", configir)