Panel | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
ON THIS PAGE
|
BrightSign players use a standardized library of BrightScript objects to expose functionality for public software development. To publish a new API for interacting with BrightSign hardware, we create a new BrightScript object.
Interfaces and Methods
Every BrightScript object consists of one or more "interfaces." An interface consists of one or more "methods." For example, the roVideoPlayer object has several interfaces, including ifMessagePort. The interface ifMessagePort has one method: SetPort()
.
...
- Wait for an event.
- Process the event.
- Return to step 1.
An event can be any number occurrences: a button has been pressed; a timer has been triggered; a UDP message has been received; a video has finished playing back; etc.
By convention, event scripting for BrightScript objects follows this work flow:
- An object of the type roMessagePort is created by the user's script.
- Objects that can send events (i.e. those that support the ifMessagePort/ifSetMessagePort interface) are instructed to send their events to this message port using the
SetPort()
method. You can set up multiple message ports and have each event go to its own message port, but it is usually simpler to create one message port and have all the events sent to this one port. - The script waits for an event. The actual function to do this is ifMessagePort.WaitMessage(), but the built-in
Wait()
statement in BrightScript allows you to do this more easily. - If multiple event types are possible, your script should determine which event the wait function received, then process it. The script then jumps back to the wait.
An event can be generated by any BrightScript Object. For example, the class roControlPort sends events of type roControlDown and roControlUp. The roControlDown implements the ifInt interface, which allows access to an integer. An event loop needs to be aware of the possible events it can receive and be able to process them.
...