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.
Example
To connect yourExamples
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).
Code Block |
---|
'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 |
Panel | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
ON THIS PAGE
|
Creating a tvcontoller IR Receiver
Code Block |
---|
configIR = CreateObject("roAssociativeArray")
'tvcontroller IR type
configIR.source = "tvcontroller"
configIR.encodings = CreateObject("roArray", 0, false)
IRRecep = CreateObject("roIRReceiver", configIR) |