beautypg.com

Classes, Rolist, Lasses – BrightSign HD2000 Object Reference Manual User Manual

Page 8

background image

By convention, Roku Object (RO) events work as follows.

 A RO of type “roMessagePort” is created. In BrightScript, by the user’s script.

 ROs that can send events are instructed to send their events to this message port. You could set up

multiple message ports, and have each event go to its own message port, but it is usually simpler
to just create one message port, and have the events all go to this one port. To instruct the RO to
send events to a specific port, use the ifSetMessagePort Interface.

 The script waits for an event. The actual function to do this is the ifMessagePort.WaitMessage(),

but if you are using BrightScript, the built-in statement WAIT makes this easy.

 If multiple event types are possible, your script should determine which event that the wait

received, then process it. The script then jumps back to the Wait.


An “Event” can be generated by any Roku Object. For example, the class “roGpioControlPort” sends
events of type “roGpioButton”. The “roGpioButton” has one interface: ifInt. ifInt allows access to an
integer. An event loop needs to be aware of the possible events it can get, and process them.


Example

print "BrightSign Button-LED Test Running"
p = CreateObject("roMessagePort")
tmr = CreateObject("roMessagePort")
gpio = CreateObject("roGpioControlPort")
gpio.SetPort(p)

event_loop:
msg=wait(0, p)

if type(msg)<>"roGpioButton" then event_loop

butn = msg.GetInt()
if butn > 5 then event_loop
gpio.SetOutputState(butn+17,1)
print "Button Pressed: ";butn
msg = wait (500, tmr)
gpio.SetOutputState(butn+17,0)

clear_events:
msg=p.GetMessage():if type(msg)<>"rotINT32" then clear_events
goto event_loop

Classes

For each class a brief description is given, a list of interfaces, and the member functions in the interfaces.

roList

A general purpose doubly link list. It can be used as a container for arbitrary length lists of Roku Objects.

Interfaces:

ifList


rotINT32

Count(rotVOID)

rotBOOL

IsEmpty(rotVOID)

rotBOOL

ResetIndex(rotVOID)

rotVOID AddTail(rotOBJECT obj)

rotVOID AddHead(rotOBJECT obj)

rotBOOL FindIndex(rotSTRING name)

rotOBJECT

RemoveIndex(rotVOID)

rotOBJECT

GetIndex(rotVOID)

8

This manual is related to the following products: