Object Reference Manual (ver 6.0)

2015-12-14

: Brightsign Object Reference Manual (Ver 6.0) Object Reference Manual (ver 6.0) s

Open the PDF directly: View PDF PDF.
Page Count: 376

DownloadObject Reference Manual (ver 6.0)
Open PDF In BrowserView PDF
OBJECT REFERENCE MANUAL
Firmware Versions 6.0.x

BrightSign, LLC. 16780 Lark Ave., Suite B Los Gatos, CA 95032 | 408-852-9263 | www.brightsign.biz

1

TABLE OF CONTENTS
INTRODUCTION ................................................................................................................ 1
INTERFACES AND METHODS OVERVIEW ..................................................................... 2
Classes .............................................................................................................................................................................. 3
Object and Class Name Syntax ......................................................................................................................................... 3
Zones................................................................................................................................................................................. 3
Event Loops....................................................................................................................................................................... 4
BrightSign Object Library ................................................................................................................................................... 5

BRIGHTSCRIPT CORE OBJECTS .................................................................................... 6
roArray ............................................................................................................................................................................... 6
roAssociativeArray............................................................................................................................................................. 8
roBoolean ........................................................................................................................................................................ 10
roByteArray...................................................................................................................................................................... 11
roDouble, roIntrinsicDouble ............................................................................................................................................. 13
roFunction........................................................................................................................................................................ 14
roGlobal ........................................................................................................................................................................... 15
roInt, roFloat, roString ...................................................................................................................................................... 23
roList ................................................................................................................................................................................ 27
roRegex ........................................................................................................................................................................... 30
roXMLElement ................................................................................................................................................................. 32

roXMLList ........................................................................................................................................................................ 36

PRESENTATION AND WIDGET OBJECTS .................................................................... 39
roAudioEventMx .............................................................................................................................................................. 39
roAudioOutput ................................................................................................................................................................. 40
roAudioPlayer .................................................................................................................................................................. 42
roAudioPlayerMx ............................................................................................................................................................. 49
roCanvasWidget .............................................................................................................................................................. 54
roClockWidget ................................................................................................................................................................. 60
roHdmiInputChanged, roHdmiOutputChanged ................................................................................................................ 64
roHtmlWidget ................................................................................................................................................................... 65
roImageBuffer .................................................................................................................................................................. 70
roImagePlayer ................................................................................................................................................................. 71
roImageWidget ................................................................................................................................................................ 80
roRectangle ..................................................................................................................................................................... 83
roShoutcastStream .......................................................................................................................................................... 84
roShoutcastStreamEvent ................................................................................................................................................. 85
roTextField....................................................................................................................................................................... 86
roTextWidget ................................................................................................................................................................... 89
roVideoEvent, roAudioEvent............................................................................................................................................ 94
roVideoInput .................................................................................................................................................................... 97
roVideoMode ................................................................................................................................................................. 100
roVideoPlayer ................................................................................................................................................................ 109
roTouchEvent, roTouchCalibrationEvent ....................................................................................................................... 128
roTouchScreen .............................................................................................................................................................. 130

FILE OBJECTS.............................................................................................................. 136

roAppendFile ................................................................................................................................................................. 136
roCreateFile ................................................................................................................................................................... 138
roReadFile ..................................................................................................................................................................... 140
roReadWriteFile............................................................................................................................................................. 142

HASHING AND STORAGE OBJECTS .......................................................................... 144
roBlockCipher ................................................................................................................................................................ 144
roBrightPackage ............................................................................................................................................................ 147
roDiskErrorEvent ........................................................................................................................................................... 150
roDiskMonitor ................................................................................................................................................................ 151
roHashGenerator ........................................................................................................................................................... 153
roPassKey ..................................................................................................................................................................... 154
roRegistry ...................................................................................................................................................................... 156
roRegistrySection .......................................................................................................................................................... 157
roSqliteDatabase ........................................................................................................................................................... 159
roSqliteEvent ................................................................................................................................................................. 162
roSqliteStatement .......................................................................................................................................................... 163
roStorageAttached, roStorageDetached ........................................................................................................................ 170
roStorageHotplug .......................................................................................................................................................... 171
roStorageInfo ................................................................................................................................................................. 173

CONTENT MANAGEMENT OBJECTS .......................................................................... 175
roAssetCollection........................................................................................................................................................... 175
roAssetFetcher .............................................................................................................................................................. 178
roAssetFetcherEvent ..................................................................................................................................................... 182
roAssetFetcherProgressEvent ....................................................................................................................................... 187
roAssetPool ................................................................................................................................................................... 188

roAssetPoolFiles............................................................................................................................................................ 190
roAssetRealizer ............................................................................................................................................................. 192
roAssetRealizerEvent .................................................................................................................................................... 194
roSyncSpec ................................................................................................................................................................... 196

NETWORKING OBJECTS ............................................................................................. 198
roDatagramSender, roDatagramReceiver, roDatagramSocket, roDatagramEvent ....................................................... 198
roHttpEvent.................................................................................................................................................................... 203
roHttpServer .................................................................................................................................................................. 205
roMediaServer ............................................................................................................................................................... 210
roMediaStreamer ........................................................................................................................................................... 212
roMediaStreamerEvent .................................................................................................................................................. 214
roMimeStream ............................................................................................................................................................... 215
roMimeStreamEvent ...................................................................................................................................................... 217
roNetworkAdvertisement ............................................................................................................................................... 218
roNetworkAttached, roNetworkDetached....................................................................................................................... 220
roNetworkConfiguration ................................................................................................................................................. 221
roNetworkHotplug .......................................................................................................................................................... 230
roNetworkStatistics ........................................................................................................................................................ 231
roPtp .............................................................................................................................................................................. 233
roPtpEvent ..................................................................................................................................................................... 234
roRssParser, roRssArticle ............................................................................................................................................. 235
roRtspStream ................................................................................................................................................................ 237
roShoutcastStream ........................................................................................................................................................ 239
roShoutcastStreamEvent ............................................................................................................................................... 240
roSnmpAgent ................................................................................................................................................................. 241
roSnmpEvent ................................................................................................................................................................. 242

roStreamByteEvent........................................................................................................................................................ 243
roStreamConnectResultEvent ....................................................................................................................................... 244
roStreamEndEvent ........................................................................................................................................................ 245
roStreamLineEvent ........................................................................................................................................................ 246
roSyncManager ............................................................................................................................................................. 247
roSyncManagerEvent .................................................................................................................................................... 251
roTCPConnectEvent ...................................................................................................................................................... 252
roTCPServer.................................................................................................................................................................. 253
roUPnPController .......................................................................................................................................................... 254
roUPnPSearchEvent...................................................................................................................................................... 257
roUPnPDevice ............................................................................................................................................................... 259
roUPnPService .............................................................................................................................................................. 260
roUPnPServiceEvent ..................................................................................................................................................... 261
roUPnPActionResult ...................................................................................................................................................... 262
roTCPStream................................................................................................................................................................. 263
roUrlStream ................................................................................................................................................................... 265
roUrlTransfer ................................................................................................................................................................. 266
roUrlEvent...................................................................................................................................................................... 275

INPUT/OUTPUT OBJECTS ........................................................................................... 280
roCecInterface ............................................................................................................................................................... 280
roCecRxFrameEvent, roCecTxCompleteEvent ............................................................................................................. 282
roChannelManager ........................................................................................................................................................ 284
roControlPort ................................................................................................................................................................. 292
roControlUp, roControlDown ......................................................................................................................................... 299
roGpioControlPort, roGpioButton................................................................................................................................... 300
roIRReceiver.................................................................................................................................................................. 302

roIRDownEvent, roIRRepeatEvent, roIRUpEvent.......................................................................................................... 304
roIRTransmitter.............................................................................................................................................................. 305
roIRTransmitCompleteEvent ......................................................................................................................................... 307
roIRRemote ................................................................................................................................................................... 308
roIRRemotePress .......................................................................................................................................................... 310
roKeyboard, roKeyboardPress ...................................................................................................................................... 312
roMessagePort .............................................................................................................................................................. 315
roSequenceMatcher ...................................................................................................................................................... 317
roSequenceMatchEvent ................................................................................................................................................ 319
roSerialPort.................................................................................................................................................................... 320

SYSTEM OBJECTS ....................................................................................................... 323
roDeviceCustomization .................................................................................................................................................. 323
roDeviceInfo .................................................................................................................................................................. 324
roResourceManager ...................................................................................................................................................... 328
roSystemLog ................................................................................................................................................................. 330

DATE AND TIME OBJECTS .......................................................................................... 332
roDateTime .................................................................................................................................................................... 332
roNetworkTimeEvent ..................................................................................................................................................... 334
roSystemTime ............................................................................................................................................................... 335
roTimer .......................................................................................................................................................................... 340
roTimerEvent ................................................................................................................................................................. 344
roTimeSpan ................................................................................................................................................................... 345

LEGACY OBJECTS....................................................................................................... 346

roRtspStreamEvent ....................................................................................................................................................... 346
roSyncPool .................................................................................................................................................................... 347
roSyncPoolEvent ........................................................................................................................................................... 350
roSyncPoolFiles............................................................................................................................................................. 351
roSyncPoolProgressEvent ............................................................................................................................................. 352

Change Log .................................................................................................................. 353
4.4.x, 4.2.x, 3.10.x ......................................................................................................................................................... 353
4.6.x, 4.4.x, 3.10.x ......................................................................................................................................................... 354
4.7.x ............................................................................................................................................................................... 355
4.8.x ............................................................................................................................................................................... 359
5.0.x ............................................................................................................................................................................... 361
5.1.x ............................................................................................................................................................................... 362
6.0.x ............................................................................................................................................................................... 365

INTRODUCTION
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.
This Object Reference Manual describes the BrightScript object architecture in two main sections:
•
•

How to use BrightScript objects (as a script writer)
How objects are defined for BrightSign players

1

INTERFACES AND METHODS OVERVIEW
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().
Example: The abstract interface ifMessagePort is exposed and implemented by both the roControlPort and the
roVideoPlayer objects. Once the SetPort() method is called, these objects will send their events to the supplied

message port. This is discussed more in the Event Loops section below.
p = CreateObject("roMessagePort")

video = CreateObject("roVideoPlayer")
gpio = CreateObject("roControlPort", "BrightSign")
gpio.SetPort(p)

video.SetPort(p)

The above syntax makes use of a shortcut provided by the language: The interface name is optional, unless it is needed
to resolve name conflicts. For example, the following two lines of code carry out the exact same function:
gpio.SetPort(p)

gpio.ifMessagePort.SetPort(p)

BrightScript Objects consist only of interfaces, and interfaces define only methods. There is no concept of a "property" or
variable at the object or interface level. These must be implemented as “set” or “get” methods in an interface.

2

Classes
A "class name" is used to create a BrightScript object. For example, the class name for a video playback instance is
roVideoPlayer, so, to initialize a video playback instance, you would use code similar to the following:
video = CreateObject("roVideoPlayer")

Note that “video” can be any name that follows the syntax outlined in the next section.

Object and Class Name Syntax
Class names have the following characteristics:
•
•
•
•

Must start with an alphabetic character (a – z).
May consist of alphabetic characters, numbers, or the "_" (i.e. underscore) symbol.
Are not case sensitive.
May be of any reasonable length.

Zones
With the BrightSign Zones feature, you can divide the screen into rectangles and play different content in each rectangle.
Depending on the BrightSign model, zones can contain video, images, HTML content, audio, a clock, or text. 4Kx42,
XDx32, and XDx30 models can display two video zones on screen, while the HDx22, HDx20, and LSx22 models can only
display one. There can be multiple zones of other types on the screen. A text zone can contain simple text strings or can
be configured to display an RSS feed in a ticker-type display.
As of firmware 6.0.x, zone support is enabled by default. When zones are enabled, the image layer is on top of the video
layer by default. The default behavior can be modified using the roVideoMode.SetGraphicsZOrder() method.
3

Zone support can be disabled by calling EnableZoneSupport(false). When zones are not enabled, the image layer
is hidden whenever video is played, and the video layer is hidden whenever images are played.

Event Loops
When writing anything more than a very simple script, an "event loop" will need to be created. Event loops typically have
the following structure:
1. Wait for an event.
2. Process the event.
3. 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:
1. An object of the type roMessagePort is created by the user’s script.
2. 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.
3. 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.
4. 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.

4

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.

BrightSign Object Library
The following chapters provide definitions for objects that can be used in BrightScript. A brief description, a list of
interfaces, and the member functions of the interfaces are provided for each object class.
While most BrightScript objects have self-contained sections in this chapter, some objects are grouped in the same
section if they are closely related or depend on one another for functionality.

5

BRIGHTSCRIPT CORE OBJECTS
roArray
This object stores objects in a continuous array of memory locations. Since an roArray contains BrightScript components,
and there are object wrappers for most intrinsic data types, entries can either be different types or all of the same type.
Object Creation: The roArray object is created with two parameters.
CreateObject("roArray", size As Integer, resize As Boolean)
•
•

size: The initial number of elements allocated for an array.
resize: If true, the array will be resized larger to accommodate more elements if needed. If the array is large, this
process might take some time.

The dim statement may be used instead of the CreateObject function to create a new array. The dim statement is
sometimes advantageous because it automatically creates array-of-array structures for multi-dimensional arrays.

Interfaces: ifArray, ifEnum, ifArrayGet, ifArraySet
The ifArray interface provides the following:
• Peek() As Dynamic: Returns the last (highest index) array entry without removing it.
• Pop() As Dynamic: Returns the last (highest index) entry and removes it from the array.
• Push(a As Dynamic): Adds a new highest index entry to the end of the array
• Shift() As Dynamic: Removes index zero from the array and shifts all other entries down by one unit.
• Unshift(a As Dynamic): Adds a new index zero to the array and shifts all other entries up by one unit.

6

•
•
•
•

Delete(a As Integer) As Boolean: Deletes the indicated array entry and shifts all above entries down by
one unit.
Count() As Integer Returns the index of the highest entry in the array plus one (i.e. the length of the array).
Clear(): Deletes every entry in the array.
Append(a As Object): Appends one roArray to another. If the passed roArray contains entries that were never
set to a value, they are not appended.
Note: The two appended objects must be of the same type.

The ifEnum interface provides the following:
• Reset(): Resets the position to the first element of enumeration.
• Next() As Dynamic: Returns a typed value at the current position and increment position.
• IsNext() As Boolean: Returns True if there is a next element.
• IsEmpty() As Boolean: Returns True if there is not an exact statement.
The ifArrayGet interface provides the following:
• GetEntry(a As Integer) As Dynamic: Returns an array entry of a given index. Entries start at zero. If an
entry that has not been set is fetched, Invalid is returned.
The ifArraySet interface provides the following:
•

SetEntry(a As Integer, b As Dynamic): Sets an entry of a given index to the passed type value.

7

roAssociativeArray
An associative array (also known as a map, dictionary, or hash table) that allows objects to be associated with string keys.
This object is created with no parameters:
CreateObject("roAssociativeArray")
Interfaces: ifEnum, ifAssociativeArray
The ifEnum interface provides the following:
• Reset(): Resets the position to the first element of enumeration.
• Next() As Dynamic: Returns the typed value at the current position and increment position.
• IsNext() As Boolean: Returns True if there is a next element.
• IsEmpty() As Boolean: Returns True if there is not a next element.
The ifAssociativeArray interface provides the following:
• AddReplace(key As String, value As Object) As Void: Adds a new entry to the array, associating the
supplied object with the supplied string. Only one object may be associated with a string, so any existing object is
discarded.
• Lookup(key As String) As Object: Looks for an object in the array associated with the specified string. If
there is no object associated with the string, then this method will return Invalid.
• DoesExist(key As String) As Boolean: Looks for an object in the array associated with the specified
string. If there is no associated object, then False is returned. If there is such an object, then True is returned.
• Delete(key As String) As Boolean: Looks for an object in the array associated with the specified string. If
there is such an object, then it is deleted and True is returned. If not, then False is returned.
• Clear As Void: Removes all objects from the associative array.
8

•
•

•

SetModeCaseSensitive(): Makes all subsequent actions case sensitive. All roAssociativeArray lookups
are case insensitive by default.
LookupCi(a As String) As Dynamic: Looks for an object in the array associated with the specified string.
This method functions similarly to Lookup(), with the exception that key comparisons are always case insensitive,
regardless of case mode.
Append(a As Object): Appends a second associative array to the first.

Example:
aa = CreateObject("roAssociativeArray")
aa.AddReplace("Bright", "Sign")
aa.AddReplace("TMOL", 42)
print aa.Lookup("TMOL")

print aa.Lookup("Bright")

The above script produces the following:
42

Sign

9

roBoolean
This is the object equivalent for the Boolean intrinsic type. It is useful in the following situations:
• When an object is needed instead of an intrinsic value. For example, if a Boolean is added to roList, it will be
automatically wrapped in an roBoolean object by the language interpreter. When a function that expects a
BrightScript component as a parameter is passed a Boolean, BrightScript automatically creates the equivalent
BrightScript component.
• When any object exposes the ifBoolean interface. That object can then be used in any expression that expects an
intrinsic value.
Interfaces: ifBoolean
The ifBoolean interface provides the following:
• GetBoolean() As Boolean
• SetBoolean(a As Boolean)

10

roByteArray
This object contains functions for converting strings to or from a byte array, as well as to or from ASCII hex or ASCII
base64. Note that if you are converting a byte array to a string, and the byte array contains a zero, the string conversion
will end at that point.
The byte array will automatically resize to become larger as needed. If you wish to disable this behavior, use the
SetResize() method. If an uninitialized index is read, Invalid is returned.
Since roByteArray supports the ifArray interface, it can be accessed with the array [] operator. The byte array is

always accessed as unsigned bytes while this interface is being used. This object also supports the ifEnum interface, and
so can be used with a FOR EACH statement.
Interfaces: ifByteArray, ifArray, ifArrayGet, ifEnum, ifArraySet
See roArray for a description of ifArray, ifArrayGet, ifEnum and ifArraySet.
The ifByteArray interface provides the following:
• WriteFile(file_path As String) As Boolean: Writes the bytes contained in the byte array to the
specified file. This method returns True if successful.
• WriteFile(file_path As String, start_index As Integer, length As Integer) As Boolean:
Writes a subset of the bytes contained in the byte array to the specified file. This method writes length bytes,
beginning at start_index of the byte array.
•

ReadFile(file_path As String) As Boolean: Reads the specified file into the byte array. This operation
will discard any data currently contained in the byte array.

11

•

•
•

•
•

•
•
•
•
•

•
•

ReadFile(file_path As String, start_index As Integer, length As Integer) As Boolean:
Reads a section of the specified file into the byte array. This method reads length bytes, beginning at
start_index of the file. This operation will discard any data currently contained in the byte array.

AppendFile(file_path As String) As Boolean: Appends the contents of the byte array to the specified
file.
SetResize(minimum_allocation_size As Integer, autoresize As Boolean): Expands the size of
the byte array to the minimum_allocation_size if it is less than the minimum_allocation_size. This

method also accepts a Boolean parameter that specifies whether the byte array should be resized automatically or
not.
ToHexString() As String: Returns a hexadecimal string representation of the contents of the byte array.
Each byte is represented as two hex digits.
FromHexString(hex_string As String): Writes the contents of the passed hexadecimal string to the byte
array. The passed string must contain an even number of hex digits. This operation will discard any data currently
contained in the byte array.
ToBase64String() As String: Returns the contents of the byte array as a base64-formatted string.
FromBase64String(base_64_string As String): Writes the contents of a valid base64-formatted string to
the byte array. This operation will discard any data currently contained in the byte array.
ToAsciiString() As String: Returns the contents of the byte array as an ASCII-formatted string.
FromAsciiString(a As String): Writes the contents of a valid ASCII-formatted string to the byte array. This
operation will discard any data currently contained in the byte array.
GetSignedByte(index As Integer) As Integer: Returns the signed byte at the specified zero-based
index in the byte array. To read an unsigned byte within a byte array, use the ifArrayGet.GetEntry() method or the
[] array operator.
GetSignedLong(index As Integer) As Integer: Retrieves the integer located at the specified long-word
index of the byte array. Note that this method cannot accept a byte index as its parameter.
IsLittleEndianCPU() As Boolean: Returns True if the CPU architecture is little-endian.

12

roDouble, roIntrinsicDouble
Interfaces: ifDouble
The ifDouble interface provides the following:
GetDouble() As Double
SetDouble(a As Double)

13

roFunction
Interfaces: ifFunction
• GetSub() As Function
• SetSub(value As Function)

14

roGlobal
This object provides a set of standard, module-scope functions that are stored in the global object. If one of these global
functions is referenced, the compiler directs the runtime to call the appropriate global object member.
Note: Global trigonometric functions accept and return values in radians, not degrees.
Interfaces: ifGlobal
The ifGlobal interface provides the following:
• CreateObject(name As String) As Object: Creates a BrightScript object corresponding to the specified
class name. This method returns invalid if object creation fails. Some objects have optional parameters in their
constructor, which must be passed after the class name.
Example:

sw = CreateObject("roGpioControlPort")

serial = CreateObject("roSerialPort", 0, 9600)

•
•
•
•
•

•

RestartScript(): Exits the current script. The system then scans for a valid autorun file to run.
RestartApplication(): Restarts the BrightSign application.
Sleep(milliseconds As Integer): Instructs the script to pause for a specified amount of time without
wasting CPU cycles. The sleep interval is specified in milliseconds.
asc(letter As String) As Integer: Returns the ASCII code for the first character of the specified string. A
null-string argument will cause an error.
chr(character As Integer) As String: Returns a one-character string containing a character reflected by
the specified ASCII or control. For example, because quotation marks are normally used as string delimiters, you
can pass ASCII code 34 to this function to add quotes to a string.
len(target_string As String) As Integer: Returns the number of characters in a string.
15

•

•

•

•
•
•
•
•
•
•
•

•
•

str(value As Double) As String: Converts a specified float value to a string. This method also returns a
string equal to the character representation of a value. For example, if "A" is assigned a value of 58.5, then calling
str(A) will return "58.5" as a string.
strI(value As Integer) As String: Converts a specified integer value to a string. This method also
returns a string equal to the character representation of a value. For example, if "A" is assigned a value of 58.5,
then calling stri(A) will return "58" as a string.

val(target_string As String) As Double: Returns a number represented by the characters in the string
argument. This is the opposite of the str() function. For example, if "A" is assigned the string "58", and "B" is
assigned the string "5", then calling val(A+"."+B) will return the float value 58.5.

abs(x As Double) As Double: Returns the absoule vale of the argument x.
atn(x As Double) As Double: Returns the arctangent (in radians) of the argument x (i.e. Atn(x) returns "the
angle whose tangent is x"). To get the arctangent in degrees, multiply Atn(x) by 57.29578.

csng(x As Integer) As Float: Returns a single-percision float representation of the argument x.
cdbl(x As Integer) As Double: Returns a double-percision float representation of the argument x.
cint(x As Double) As Integer: Returns an integer representation of the argument x by rounding to the
nearest whole number.
cos(x As Double) As Double: Returns the cosine of the arugment x. The argument must be in radians. To
obtain the cosine of x when x is in degrees, use Cos(x*.01745329).

exp(x As Double) As Double: Returns the natural exponential of x. This is the inverse of the log() function.
fix(x As Double) As Integer: Returns a truncated representation of the argument x. All digits to the right of
the decimal point are removed so that the resultant value is an integer. For non-negative values of x, fix(x) is
equal to int(x). For negative values of x, fix(x) is equal to int(x)+1.
int(x As Double) As Integer: Returns an integer representation of the argument x using the largest whole
number that is not greater than the argument. For example, int(2.2) returns 2, while fix(-2.5) returns -3.

log(x As Double) As Double: Returns the natural logarithm of the argument x(i.e. loge(x)). This is the inverse
of the exp() function. To find the logarithm of a number to a base b, use the following formula:
logb(x) = loge(x)/loge(b).

16

•
•
•
•
•
•
•
•
•
•

•

•

sgn(x As Double) As Integer: Returns an integer representing how the float argument x is signed: -1 for
negative, 0 for zero, and 1 for positive.
sgnI(x As Integer) As Integer: Returns an integer representing how the integer argument x is signed: -1
for negative, 0 for zero, and 1 for positive.
sin(x As Double) As Double: Returns the sine of the argument x. The argument must be in radians. To
obtain the sine of x when x is in degrees, use sin(x*.01745329).
tan(x As Double) As Double: Returns the tangent of the argument x. The argument must be in radians. To
obtain the tangent of x when x is in degrees, use tan(x*.01745329).

sqr(x As Double) As Double: Returns the square root of the argument x. This function is the same as x^(1/2),
but calculates the result faster.
Left(target_string As String, n As Integer) As String: Returns the first n characters of the
specified string.
Right(target_string As String, n As Integer) As String: Returns the last n characters of the
specified string.
StringI(n As Integer, character As Integer) As String: Returns a string composed of a character
symbol repeated n times. The character symbol is passed to the method as an ASCII code integer.
String(n As Integer, character As String) As String: Returns a string composed of a character
symbol repeated n times. The character symbol is passed to the method as a string.
Mid(target_string As String, start_position As Integer, length As Integer) As String:
Returns a substring of the target string. The first integer passed to the method specifies the starting position of the
substring, and the second integer specifies the length of the substring. The start position of a string begins with 1.
instr(start_position As Integer, search_text As String, substring_to_find As String)
As Integer: Returns the position of a substring within a string. This function is case sensitive and returns 0 if the
specified substring is not found. The start position of a string begins with 1.
GetInterface(object As Object, ifname As String) As Interface: Returns a value of the type
Interface. All objects have one or more interfaces. In most cases, you can skip interface specification when calling
an object component. This will not cause problems as long as the method names within a function are unique.

17

•

Wait(timeout As Integer, port As Object) As Object: Instructs the script to wait on an object that
has an ifMessagePort interface. This method will return the event object that was posted to the message port. If the
timeout is specified as zero, Wait() will wait indefinitely; otherwise, Wait() will return Invalid after the specified

number of milliseconds if no messages have been received.
Example:
p =

sw =

CreateObject("roMessagePort")

CreateObject("roGpioControlPort")

sw.SetPort(p)

msg=wait(0, p)

print type(msg)

print msg.GetInt()

' should be roGpioButton
' button number

ReadAsciiFile(file_path As String) As String: Reads the specified text file and returns it as a string.
WriteAsciiFile(file_path As String, buffer As String) As Boolean: Creates a text file at the
specified file path. The text of the file is passed as the second parameter. This method cannot be used to edit files:
A preexisting text file will be overwritten if it has the same name and directory path as the one being created.
Note: The roCreateFile object provides more flexibility if you need to create or edit files.
• ListDir(path As String) As Object: Returns an roList object containing the contents of the specified
directory path. File names are converted to all lowercase.
• MatchFiles(path As String, pattern_in As String) As Object: Takes a directory to look in (it can
be as simple as "." or "/") and a pattern to be matched and then returns an roList containing the results. Each listed
result contains only the part of the filename that is matched against the pattern, not the full path. The match is only
applied in the specified directory; you will get no results if the pattern contains a directory separator. The pattern is
a case insensitive wildmat expression. It may contain the following special characters:
o ? -- Matches any single character.
o * -- Matches zero or more arbitrary characters.
•
•

18

o […]-- Matches any single character specified within the brackets. The closing bracket is treated as a

•
•
•
•

•
•
•
•
•

•

member of the character class if it immediately follows the opening bracket (i.e. "[]]" matches a single closed
bracket). Within this class, "-" can be used to specify a range unless it is the first or last character (e.g. "[ACf-h"] is equivalent to "[ABCfgh]"). A character class may be negated by specifying "^" as the first character.
To match a literal of this character, place it elsewhere in the class.
Note: The special characters "?", "*", and "[" lose their function if preceded by a single "\", and a single "\" can
be matched using "\\".
LCase(target_string As String) As String: Converts the specified string to all lower case.
UCase(target_string As String) As String: Converts the specified string to all upper case.
DeleteFile(file_path As String) As Boolean: Deletes the file at the specified file path. This method
returns False if the delete operation fails or if the file does not exist.
DeleteDirectory(diretory As String) As Boolean: Deletes the specified directory. This method will
recursively delete any files and directories that are necessary for removing the specified directory. This method
returns False if it fails to delete the directory, but it may still delete some of the nested files or directories.
CreateDirectory(directory As String) As Boolean: Creates the specified directory. Only one directory
can be created at a time. This method returns True upon success and False upon failure.
RebootSystem(): Causes a soft reboot.
ShutdownSystem()
UpTime(dummy As Integer) As Double: Returns the uptime of the system (in seconds) since the last reboot.
FormatDrive(drive As String, fs_type As String) As Boolean: Formats the specified drive using
one of the file systems listed below. This function returns True upon success and False upon failure:
o vfat (DOS/Windows file system): Readable and writable by Windows, Linux, and MacOS.
o ext2 (Linux file system): Writable by Linux and readable by Windows and MacOS with additional software.
o ext3 (Linux file system): Writable by Linux and readable by Windows and MacOS with additional software.
This file system uses journaling for additional reliability.
EjectDrive(drive As String) As Boolean: Ejects the specified drive (e.g. "SD:") and returns True if
successful. If the script is currently accessing files from the specified drive, the ejection process will fail.

19

CopyFile(source As String, destination As String) As Boolean: Copies the file at the specified
source file-path name to the specified destination file-path name. The function returns True if successful and False
in the event of failure.
• MoveFile(a As String, b As String) As Boolean: Moves the specified source file to the specified
destination. The function returns True if successful and False in the event of failure.
Note: Both path names must be on the same drive.
• strtoi(target_string As String) As Integer: Converts the target string to an integer. Any non-integer
characters (including decimal points and spaces), and any numbers to the right of a non-integer character, will not
be part of the integer output.
• rnd(a As Dynamic) As Dynamic
• RunGarbageCollector() As roAssociativeArray: Destroys objects that are currently in a state of circular
reference counting. BrightScript normally removes any objects that become unreferenced as part of its automated
garbage collection algorithm. However, objects that reference each other will never reach a reference count of zero,
and will need to be destroyed manually using this method. This method is useful when destroying old presentation
data structures and generating a new presentation. This method returns an associative array outlining the results of
the garbage-collection process.
• GetDefaultDrive() As String: Returns the current default drive complete with a trailing slash. When running
autorun.brs, the drive containing the autorun is designated as the current default.
•

•

•
•
•
•

SetDefaultDrive(a As String): Sets the current default drive, which does not need to include a trailing
slash. This method does not fail; however, if the specified default drive does not exist, it will not be possible to
retrieve anything.
EnableZoneSupport(enable As Boolean): Allows for display of multiple video, HTML, image, and text
zones. As of firmware 6.0.x, zone support is enabled by default.
EnableAudioMixer(a As Boolean)
Pi() As Double: Returns the value of pi as a double-precision floating-point number.
ParseJson(json_string As String) As Object: Parses a string formatted according to the RFC4627
standard and returns an equivalent BrightScript object, which can consist of the following: Booleans, integers,

20

floating point numbers, strings, roArray objects, and roAssociativeArray objects. The ParseJson() method has
the following properties:
o Invalid will be returned if the string is not syntactically correct.
o Any roAssociativeArray objects that are returned will be case sensitive.
o An error will be returned if an roArray or roAssociativeArray is nested more than 256 levels deep.

Example: The following script demonstrates how to use ParseJson() to process a JSON object containing the
titles and URLs of a set of images.
JSON Script
{

"photos" : [
{

},
{

},
{

}

]

}

"title" : "View from the hotel",

"url" : "http://example.com/images/00012.jpg"

"title" : "Relaxing at the beach",

"url" : "http://example.com/images/00222.jpg"

"title" : "Flat tire",

"url" : "http://example.com/images/00314.jpg"

BrightScript

21

searchRequest = CreateObject("roUrlTransfer")

searchRequest.SetURL("http://api.example.com/services/rest/getPhotos")
response = ParseJson(searchRequest.GetToString())
For Each photo In response.photos
End For

•

GetImage(photo.title, photo.url)

FormatJson(json As roAssociativeArray, flags As Integer) As String: Converts an associative

array to a JSON string (i.e. formatted according to the RFC4627 standard). The following are supported data types:
Boolean, Integer, Float, String, roArray, and roAssociativeArray. If the flags parameter is set to 0 or not specified,

non-ASCII characters are escaped in the output string as “\uXXXX”, where “XXXX” is the hexadecimal

representation of the Unicode character value. If the flags parameter is set to 1, non-ASCII characters are not
escaped. If arrays or associative arrays are nested more than 256 levels deep, an error will occur. If an error
occurs, an empty string will be returned.

22

roInt, roFloat, roString
The intrinsic types roInt32, roFloat, and roString have an object and interface equivalent. These are useful in the following
situations:
An object is needed instead of a typed value. For example, roList maintains a list of objects.
If any object exposes the ifInt, ifFloat, or ifString interfaces, that object can be used in any expression that expects
a typed value. For example, an roTouchEvent can be used as an integer whose value is the userid of the
roTouchEvent.
Note: If "o" is an roInt, then these statements have the following effects:
o print o: Prints o.GetInt()
o i%=o: Assigns the integer i% the value of o.GetInt()
o k=o: Presumably k is typeOmatic, so it becomes another reference to the roInt o
o o=5: This is NOT the same as o.SetInt(5). Instead it releases o, changes the type of o to roINT32 (o is
typeOmatic), and assigns it to 5.
•
•

When a function that expects a BrightScript Object as a parameter is passed an int, float, or string, BrightScript
automatically creates the equivalent object.
Interfaces: ifInt, ifIntOps, ifFloat, ifString, ifStringOps
roInt contains the ifInt interface, which provides the following:
• GetInt() As Integer
• SetInt(value As Integer) As Void

23

roInt also contains the ifIntOps interface, which provides the following:
• ToStr() As String
roFloat contains the ifFloat interface, which provides the following:
• GetFloat() As Float
• SetFloat(value As Float) As Void
roString contains the ifString interface, which provides the following:
• GetString() As String
• SetString(value As String) As Void
roString also contains the ifStringOps interface, which provides the following:
Note: The function indexes of ifStringOps methods start at zero, while the function indexes of global methods start at
one.
• SetString(str As String, str_len As Integer): Sets the string using the specified string and stringlength values.
• AppendString(str As String, str_len As Integer): Appends the string using the specified string and
string-length values. This method modifies itself—this can cause unexpected results when you pass an intrinsic
string type, rather than a string object.
Example:
x="string"

x.ifstringops.appendstring("ddd",3)
print x

'will print 'string'

y=box("string")

y.ifstringops.appendstring("ddd",3)
print y 'will print 'stringddd'

24

•
•
•
•
•
•
•
•
•
•
•
•

Len() As Integer
GetEntityEncode() As String
Tokenize(delim As String) As Object
Trim() As String
ToInt() As Integer
ToFloat() As Float
Left(chars As Integer) As String
Right(chars As Integer) As String
Mid(start_index As Integer) As String
Mid(start_index As Integer, chars As Integer) As String
Instr(substring As String) As Integer
Instr(start_index As Integer, substring As String) As Integer

Example:
BrightScript> o=CreateObject("roInt")
BrightScript> o.SetInt(555)
BrightScript> print o
555

BrightScript> print o.GetInt()
555

BrightScript> print o-55
500

25

Example: An integer value of 5 is converted to type roInt automatically because the AddTail() method expects a

BrightScript Object as its parameter.

BrightScript> list=CreateObject("roList")
BrightScript> list.AddTail(5)

BrightScript> print type(list.GetTail())

Example: Here the ListDir() method returns an roList object containing roString objects:
BrightScript> l=ListDir("/")

BrightScript> for i=1 to l.Count():print l.RemoveHead():next
test_movie_3.vob
test_movie_4.vob
test_movie_1.vob
test_movie_2.vob

26

roList
This object functions as a general-purpose, doubly linked list. It can be used as a container for arbitrary-length lists of
BrightSign Objects. The array operator [ ] can be used to access any element in an ordered list.
Interfaces: ifList, ifEnum, ifArray, ifArrayGet, ifArraySet
The ifList interface provides the following:
• Count() As Integer: Returns the number of elements in the list.
• ResetIndex() As Boolean: Resets the current index or position in the list to the head element.
• AddTail(obj As Object) As Void: Adds a typed value to the tail of the list.
• AddHead(obj As Object) As Void: Adds a typed value to the head of the list.
• RemoveIndex() As Object: Removes an entry from the list at the current index or position and increments the
index or position in the list. It returns Invalid when the end of the list is reached.
• GetIndex() As Object: Retrieves an entry from the list at the current index or position and increments the
index or position in the list. It returns Invalid when the end of the list is reached.
• RemoveTail() As Object: Removes the entry at the tail of the list.
• RemoveHead() As Object: Removes the entry at the head of the list.
• GetTail() As Object: Retrieves the entry at the tail of the list and keeps the entry in the list.
• GetHead() As Object: Retrieves the entry at the head of the list and keeps the entry in the list.
• Clear(): Removes all elements from the list.
The ifEnum interface provides the following:
• Reset(): Resets the position to the first element of enumeration.
• Next() As Dynamic: Returns the typed value at the current position and increment position.
• IsNext() As Boolean: Returns True if there is a next element.
• IsEmpty() As Boolean: Returns True if there is not a next element.
27

The ifArray interface provides the following:
• Peek() As Dynamic: Returns the last (highest index) array entry without removing it.
• Pop() As Dynamic: Returns the last (highest index) entry and removes it from the array.
• Push(a As Dynamic): Adds a new highest index entry to the end of the array
• Shift() As Dynamic: Removes index zero from the array and shifts all other entries down by one unit.
• Unshift(a As Dynamic): Adds a new index zero to the array and shifts all other entries up by one unit.
• Delete(a As Integer) As Boolean: Deletes the indicated array entry and shifts all above entries down by
one unit.
• Count() As Integer Returns the index of the highest entry in the array plus one (i.e. the length of the array).
• Clear(): Deletes every entry in the array.
• Append(a As Object): Appends one roArray to another. If the passed roArray contains entries that were never
set to a value, they are not appended.
Note: The two appended objects must be of the same type.
The ifArrayGet interface provides the following:
• GetEntry(a As Integer) As Dynamic: Returns an array entry of a given index. Entries start at zero. If an
entry that has not been set is fetched, Invalid is returned.
The ifArraySet interface provides the following:
•

SetEntry(a As Integer, b As Dynamic): Sets an entry of a given index to the passed type value.

Example:
list = CreateObject(“roList”)
list.AddTail(“a”)
list.AddTail(“b”)
list.AddTail(“c”)

28

list.AddTail(“d”)
list.ResetIndex()

x= list.GetIndex()
while x <> invalid
print x

x = list.GetIndex()

end while

print list[2]

29

roRegex
This object allows the implementation of the regular-expression processing provided by the PCRE library.
This object is created with a string to represent the "matching-pattern" and a string to indicate flags that modify the
behavior of one or more matching operations:
CreateObject("roRegex", "[a-z]+", "i")
The match string (in the example above, "[a-z]+", which matches all lowercase letters) can include most Perl

compatible regular expressions found in the PCRE documentation.

This object supports any combination of the following behavior flags (in the example above, "i", which can be modified to
match both uppercase and lowercase letters):
• "i": Case-insensitive match mode.
• "m": Multiline mode. The start-line ("^") and end-line ("$") constructs match immediately before or after any
newline in the subject string. They also match at the absolute beginning or end of a string.
•
•

"s": Dot-all mode, which includes a newline in the ".*" regular expression. This modifier is equivalent to "/s" in
Perl.
"x": Extended mode, which ignores whitespace characters except when escaped or inside a character class. This
modifier is equivalent to "/x" in Perl.

Interfaces: ifRegex
The ifRegex interface provides the following:
• IsMatch(a As String) As Boolean: Returns True if the string is consistent with the matching pattern.

30

•

Match(a As String) As roArray: Returns an roArray of matched substrings from the string. The entire
match is returned in the form array[0].This will be the only entry in the array if there are no parenthetical

substrings. If the matching pattern contains parenthetical substrings, the relevant substrings will be returned as an
array of length n+1, where array[0] is the entire match and each additional entry in the array is the match for
•

•
•

the corresponding parenthetical expression.
Replace(a As String, b As String) As String: Replaces the first occurrence of a match to the
matching pattern in the string with the subset. The subset may contain numbered back-references to parenthetical
substrings.
ReplaceAll(a As String, b As String) As String: Performs a global search and replace.
Split(a As String) As roList: Uses the matching pattern as a delimiter and splits the string on the
delimiter boundaries. The function returns an roList of strings that were separated by the matching pattern in the
original string.

31

roXMLElement
This object is used to contain an XML tree.
The roXMLElement object is created with no parameters:
CreateObject("roXMLElement")
The following examples illustrate how XML elements are parsed in BrightScript:
This is example text

Name = tag1
Attributes = Invalid
Body = roString containing "This is example text"


Name = tag2
Attributes = roAssociativeArray with one entry, {caveman, barney}
Body = Invalid
If the tag contains other tags, the body will be of the type roXMLList.
Example: To generate XML content, create an roXMLElement and call the SetBody() and SetName() methods to
build it, then call the GenXML() method to generate it.
32

root.SetName("myroot")

root.AddAttribute("key1","value1")
root.AddAttribute("key2","value2")
ne=root.AddBodyElement()
ne.SetName("sub")

ne.SetBody("this is the sub1 text")
ne=root.AddBodyElement()

ne.SetName("subelement2")

ne.SetBody("more sub text")
ne.AddAttribute("k","v")

ne=root.AddElement("subelement3")
ne.SetBody("more sub text 3")

root.AddElementWithBody("sub","another sub (#4)")
PrintXML(root, 0)

print root.GenXML(false)

Interfaces: ifXMLElement
The ifXMLElement interface provides the following:
• GetBody() As Object
• GetAttributes() As Object
• GetName() As String
• GetText() As String
• GetChildElements() As Object
• GetNamedElements(a As String) As Object
• GetNamedElementsCi(a As String) As Object
33

•
•
•
•
•
•
•

•
•
•
•
•
•

SetBody(a As Object): Generates an roXMLList for the body if needed. The method then adds the passed
item (which should be an roXMLElement tag).
AddBodyElement() As Object
AddElement(a As String) As Object
AddElementWithBody(a As String, b As Object) As Object
AddAttribute(a As String, b As String)
SetName(a As String)
Parse(a As String) As Boolean: Parses the XML content passed to it. In the event of failure, this method
returns False. However, it also populates roXMLElement with whatever text could be successfully parsed. To avoid
passing along erroneous strings, it is always best to have the script check the return value of Parse() before
using them.
GenXML(a As Object) As String: Generates XML content. This method takes a single Boolean parameter,
indicating whether or not the XML should have an  tag at the top.

Clear()
GenXMLHdr(a As String) As String
IsName(a As String) As Boolean
HasAttribute(a As String) As Boolean
ParseFile(a As String) As Boolean

Example: The following is an example subroutine to print out the contents of an roXMLElement tree:
PrintXML(root, 0)
Sub PrintXML(element As Object, depth As Integer)

print tab(depth*3);"Name: ";element.GetName()

if not element.GetAttributes().IsEmpty() then
print tab(depth*3);"Attributes: ";

for each a in element.GetAttributes()

34

print a;"=";left(element.GetAttributes()[a], 20);

if element.GetAttributes().IsNext() then print ", ";

end for
print

end if

if element.GetText()<>invalid then

print tab(depth*3);"Contains Text: ";left(element.GetText(), 40)

end if

if element.GetChildElements()<>invalid

print tab(depth*3);"Contains roXMLList:"

for each e in element.GetChildElements()
PrintXML(e, depth+1)

end for

end if
print

end sub

35

roXMLList
Interfaces: ifList, ifEnum, ifArray, ifArrayGet, ifArraySet, ifXMLList
The ifList interface provides the following:
• GetHead() As Dynamic: Retrieves the entry at the head of the list and keeps the entry in the list.
• GetTail() As Dynamic: Retrieves the entry at the tail of the list and keeps the entry in the list.
• RemoveHead() As Dynamic: Removes the entry at the head of the list.
• RemoveTail() As Dynamic: Removes the entry at the tail of the list.
• GetIndex() As Dynamic: Retrieves an entry from the list at the current index or position and increments the
index or position in the list. It returns Invalid when the end of the list is reached.
• RemoveIndex() As Dynamic: Removes an entry from the list at the current index or position and increments
the index or position in the list. It returns Invalid when the end of the list is reached.
• AddHead(a As Dynamic): Adds a typed value to the head of the list.
• AddTail(a As Dynamic): Adds a typed value to the tail of the list.
• ResetIndex() As Boolean: Resets the current index or position in the list to the head element.
• Count() As Integer: Returns the number of elements in the list.
• Clear(): Removes all elements from the list.
The ifEnum interface provides the following:
• Reset(): Resets the position to the first element of enumeration.
• Next() As Dynamic: Returns the typed value at the current position and increment position.
• IsNext() As Boolean: Returns True if there is a next element.
• IsEmpty() As Boolean: Returns True if there is not a next element.

36

The ifArray interface provides the following:
• Peek() As Dynamic: Returns the last (highest index) array entry without removing it.
• Pop() As Dynamic: Returns the last (highest index) entry and removes it from the array.
• Push(a As Dynamic): Adds a new highest index entry to the end of the array
• Shift() As Dynamic: Removes index zero from the array and shifts all other entries down by one unit.
• Unshift(a As Dynamic): Adds a new index zero to the array and shifts all other entries up by one unit.
• Delete(a As Integer) As Boolean: Deletes the indicated array entry and shifts all above entries down by
one unit.
• Count() As Integer Returns the index of the highest entry in the array plus one (i.e. the length of the array).
• Clear(): Deletes every entry in the array.
• Append(a As Object): Appends one roArray to another. If the passed roArray contains entries that were never
set to a value, they are not appended.
Note: The two appended objects must be of the same type.
The ifArrayGet interface provides the following:
• GetEntry(a As Integer) As Dynamic: Returns an array entry of a given index. Entries start at zero. If an
entry that has not been set is fetched, Invalid is returned.
The ifArraySet interface provides the following:
•

SetEntry(a As Integer, b As Dynamic): Sets an entry of a given index to the passed type value.

The ifXMLList interface provides the following:
• GetAttributes() As Object
• GetText() As String
• GetChildElements() As Object

37

•
•
•

GetNamedElements(a As String) As Object: Returns a new XMLList that contains all roXmlElements that
match the name of the passed element. This action is the same as using the dot operator on an roXmlList.
GetNamedElementsCi(a As String) As Object
Simplify() As Object: Returns an roXmlElement if the list contains exactly one element. Otherwise, it will
return itself.

38

PRESENTATION AND WIDGET OBJECTS
roAudioEventMx
The roAudioPlayerMx object can generate roAudioEventMx messages with the following values:
• 8 EVENT_MEDIAENDED
• 14 EVENT_OVERLAY_MEDIAENDED
• 16 EVENT_MEDIAERROR
• 17 EVENT_OVERLAY_MEDIAERROR
"Media ended" events are sent when a track finishes and there are no more queued tracks for the player, while "Media
error" events are sent when a queued file is not found (e.g. when it does not exist).
Interfaces: ifInt, ifSourceIdentity, ifAudioUserData
The ifInt interface provides the following:
• GetInt() As Integer
• SetInt(a As Integer)
The ifSourceIdentity interface provides the following:
• GetSourceIdentity() As Integer
• SetSourceIdentity() As Integer
The ifAudioUserData interface provides the following:
• GetSourceIdentity() As Integer
• SetSourceIdentity() As Integer
39

roAudioOutput
This object allows individual control of audio outputs on the player.
Object Creation: The roAudioOutput object requires a single output parameter upon creation.
CreateObject("roAudioOutput", output As String)
The audio output parameter can take the following strings:
• Analog
• SPDIF
• HDMI
• USB
• NONE
These strings can be extended if future BrightSign players have multiple channels of the same type of audio output. For
example, Analog could be extended to Analog:1 or Analog:0-2.
You can create any number of roAudioOutput objects. There can be multiple instances of this object that represent the
same audio output, but in these cases one object will override another.
Interfaces: ifAudioOutput

40

The ifAudioOuput interface provides the following:
• SetVolume(a As Integer) As Boolean: Sets the volume of the specified output as a percentage
represented by an integer between 0 and 100.
• SetTone(treble As Integer, bass As Integer) As Boolean: Sets the treble and bass of the specified
output. The treble and bass integers can range from -1000 to 1000, with 0 indicating no modification to the audio
signal. Each increment represents a change of 0.01db.
• SetMute(a As Boolean) As Boolean: Mutes the specified output if True. This method is set to False by
default.
• GetOutput() As String: Returns the string with which the roAudioOutput object was created.
• SetAudioDelay(delay_in_milliseconds As Integer) As Boolean: Delays the audio for a specific
audio ouput by lagging decoded samples before they reach that output. Delays are limited to 150ms or less.
Currently, the system software only supports positive delays; therefore, if you need to set the audio ahead of the
video, you will need to use SetVideoDelay() instead.
The SetVolume and SetMute methods work in conjunction with the volume and mute functionality offered by

roAudioPlayer. The roAudioPlayer volume settings affect the audio decoder volume. The audio stream is then sent to the
assigned outputs, which have an additional level of volume control enabled by roAudioOutput.
Note: To control which audio outputs connect to audio player outputs generated by roAudioOutput, use the
SetPcmAudioOutputs and SetCompressedAudioOutputs methods, which can be used for roVideoPlayer and
roAudioPlayer. See the roAudioPlayer entry for further explanation of these methods.

The roAudioOutput object affects the absolute volume (as well as mute settings) for an audio output. If two players are
streaming to the same output, both will be affected by any settings implemented through roAudioOutput.

41

roAudioPlayer
An audio player is used to play back audio files using the generic ifMediaTransport interface. If the message port is set,
the object will send events of the type roAudioEvent. All object calls are asynchronous. In other words, audio playback is
handled in a different thread from the script. The script may continue to run while audio is playing.
Interfaces: ifIdentity, ifMessagePort, ifUserData, ifMediaTransport, ifAudioControl.
The ifIdentity interface provides the following:
• GetIdentity() As Integer
The ifMessagePort interface provides the following:
• SetPort(As Object) As Void
• SetPort(a As Object)
The ifUserData interface provides the following:
• 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.
See roVideoPlayer for a description of ifMediaTransport.
The ifAudioControl interface provides the following:
• SetPcmAudioOutputs(outputs As roArray) As Boolean: Specifies which audio connectors should
output PCM audio. This method accepts one or more outputs in the form of an roArray of roAudioOutput instances.

42

SetCompressedAudioOutputs(outputs As roArray) As Boolean: Specifies which audio connectors
should output compressed audio (e.g. Dolby AC3 encoded audio). This method accepts one or more outputs in the
form of an roArray of roAudioOutput instances.
Note: When one or both of the above output methods are called, they will override the settings of the following
ifAudioControl methods: SetAudioOutput(), MapStereoOutput(), SetUsbAudioPort(),

•

MapDigitalOutput().
• SetMultichannelAudioOutputs(array As Object) As Boolean:
• SetAudioOutput(audio_output As Integer) As Boolean
• SetAudioMode(audio_mode As Integer) As Boolean
• MapStereoOutput(mapping As Integer) As Boolean
• MapDigitalOutput(mapping As Integer) As Boolean
Note: MapDigitalOutput is not available on the HD2000.
•

•
•
•
•
•
•
•
•
•

SetVolume(volume As Dynamic) As Boolean: Specifies the volume of the audio output as either a
percentage or decibel amount. To use a percentage measurement, pass an integer value between 0 and 100. To
use a decibel measurement, pass an roAssociativeArray containing a single {db:}

parameter. The decibel measurement is an absolute value: passing 0 specifies no change to the audio output, and
the effective range of measurements is from aprroximately -80 to 20 decibels.
SetChannelVolumes(channel_mask As Integer, volume As Integer) As Boolean
SetUsbAudioPort(a As Integer) As Boolean
SetSpdifMute(a As Boolean) As Boolean
StoreEncryptionKey(a As String, b As String) As Boolean
StoreObfuscatedEncryptionKey(a As String, b As String) As Boolean
SetStereoMappingSpan(a As Integer) As Boolean
ConfigureAudioResources() As Boolean
SetAudioStream(stream_index As Integer) As Boolean
SetAudioDelay(delay_in_milliseconds As Integer) As Boolean: Adds a presentation time stamp
(PTS) offset to the audio. This makes it possible to adjust for file multiplexing differences. Delays are limited to
43

150ms or less. Currently, the system software only supports positive delays; therefore, if you need to set the audio
ahead of the video, you will need to use SetVideoDelay() instead.

SetVideoDelay(delay_in_milliseconds As Integer) As Boolean: Adds a presentation time stamp
(PTS) offset to the video. This makes it possible to adjust for file multiplexing differences. Delays are limited to
150ms or less.
Note: The following "Aux" functions are implemented only on the HD2000
• SetAudioOutputAux(audio_output As Integer) As Boolean
• SetAudioModeAux(audio_mode As Integer) As Boolean
• MapStereoOutputAux(mapping As Integer) As BooleanSetVolumeAux(volume As Integer) As
Boolean
•

•
•

SetChannelVolumesAux(channel_mask As Integer, volume As Integer) As Boolean
SetAudioStreamAux(stream_index As Integer) As Boolean

If a video file is playing or has played, you need to call roVideoPlayer.Stop() before changing the audio output.
Example: This example shows how to use the SetPcmAudioOutputs and SetCompressedAudioOutputs methods in

conjunction with roAudioOutput. The video player is configured to output decoded audio to the analog output or
compressed audio to the HDMI and SPDIF outputs.
ao1=CreateObject("roAudioOutput", "Analog")
ao2=CreateObject("roAudioOutput", "HDMI")

ao3=CreateObject("roAudioOutput", "SPDIF")
v1=CreateObject("roVideoPlayer")
v1.SetPcmAudioOutputs(ao1)

--or-44

ar = CreateObject("roArray", 2, true)
ar[0] = ao2
ar[1] = ao3

v1.SetCompressedAudioOutputs(ar)

Note: In most cases, rerouting audio outputs during audio/video playback will cause playback to stop. The system
software will still be responsive, so you can use commands to exit playback during or following an audio output
modification.
audio_output values
0 – Analog audio
1 – USB audio
2 – Digital audio, stereo PCM
3 – Digital audio, raw AC3
4 – Onboard analog audio with HDMI mirroring raw AC3
digital audio values
0 – Onboard HDMI
1 – SPDIF from expansion module
audio_mode values: Options 0 and 1 only apply to video files; while 2 applies to all audio sources.
0 – AC3 Surround
1 – AC3 mixed down to stereo
2 – No audio
3 – Left

45

4 – Right
mapping values: Used to select which analog output to use if audio_output is set to 0.
0 – Stereo audio is mapped to onboard analog output
1 – Stereo audio is mapped to expansion module leftmost output
2 – Stereo audio is mapped to expansion module middle output
3 – Stereo audio is mapped to expansion module rightmost output
set_volume: Volume functions as a percentage and therefore takes a value between 0-100. The volume value is clipped
prior to use (i.e. SetVoume(101) will set the volume to 100 and return True). The volume is the same for all mapped
outputs and USB/SPDIF/analog.
Note: Separate volume levels are stored for roAudioPlayer and roVideoPlayer.
set_channel_volumes: You can control the volume of individual audio channels. This volume command takes a hex
channel mask, which determines the channels to apply the volume to, and a level, which is a percentage of the full scale.
The volume control works according to audio channel rather than the output. The channel mask is a bit mask with the
following bits for MP3 output:
•
•
•

&H01 Left
&H02 Right
&H03 Both left and right

Example: This code sets audio output to the rightmost expansion moduleaudio port.
video = CreateObject("roVideoPlayer")
video.SetAudioOutput(0)

video.MapStereoOutput(3)

46

Example: This code sets the volume level for individual channels.
audio = CreateObject("roAudioPlayer")

audio.SetChannelVolumes(&H01, 60) ‘left channel to 60%

audio.SetChannelVolumes(&H02, 75) ‘right channel to 75%

audio.SetChannelVolumes(&H03, 65) ‘all channels to 65%

Playing Multiple Audio Files Simultaneously
Multiple MP3 files, as well as the audio track of a video file, can be played to any combination of the following:
•
•
•

Analog outputs
SPDIF / HDMI
USB

Only a single file can be sent to an output at any given time. For example, two roAudioPlayers cannot simultaneously play
to the SPDIF output. The second one to attempt a PlayFile will get an error. To free an output, the audio or video stream
must be stopped (using the ifMediaTransport Stop or StopClear calls).
Notes on multiple audio-file functionality:
•

The onboard analog audio output and HDMI output are clocked by the same sample-rate clock. Therefore, if
different content is being played out of each, the content must have the same sample rate.

•
•

Currently, only a single set of USB speakers is supported.
Each audio and video stream played consumes some of the finite CPU resources. The amount consumed depends
on the bitrates of the streams. Testing is the only way to determine whether a given set of audio files can be played
47

at the same time as a video. The maximum recommended usage is a 16Mbps video file with three simultaneous
MP3 160kbps streams.
Example: This code plays a video with audio over HDMI and an MP3 file to the onboard analog port.
video=CreateObject("roVideoPlayer")
video.SetAudioOutput(3)

video.PlayFile("video.mpg")
audio=CreateObject("roAudioPlayer")
audio.MapStereoOutput(0)

audio.PlayFile("audio.mp3")

48

roAudioPlayerMx
This object allows you to mix audio files, as well as HLS audio streams. Each roAudioPlayerMx object conatins two

internal audio players: The main audio playlist consists of queued audio tracks that play sequentially, while the audio
overlay plays files on top of the main playlist. A fade will not occur if it is called while an overlay is playing, but the next
audio track will start playing as expected.
Tracks are queued to PlayFile with their fade parameters specified in an associative array. These are the parameters
you can pass to PlayFile:
•
•
•

•
•

•

•
•
•
•

Filename: The filename of the track
FrontPorch: The length (in milliseconds) to skip from the start of the track. This value is 0 by default.
FadeOutLocation: The location (in milliseconds) of the fade out relative to the value of the FrontPorch. If the
FrontPorch value is 0 (which is the default setting), and the FadeOutLength value is non-zero, then the fade

out is calculated back from the end of the file.
FadeOutLength: The length of the fade out (in milliseconds). This value is 0 by default.
SegueLocation: The location (in milliseconds) of the event that triggers the next audio file to play. This location is
relative to the first audio file that is played. If the SegueLocation parameter is not included, the value defaults to
the FadeOutLocation.
BackPorchLocation: The location (in milliseconds) of the termination point for the audio track. This location is
relative to the first audio file that is played. If the BackPorchLocation parameter is not included, the audio file

plays to the end. The value is 0 by default, which disables the back porch.
TrackVolume: The relative volume of of the audio track, measured as a percentage. Specify the percentage using
values between 0 and 100.
EventID: The ID for an audio event.
EventTimeStamp: The timestamp for the audio event. There can only be one event per audio file.
QueueNext: The queuing of an audio track. Set the parameter value to 1 to queue an audio file to play after the
current track.
49

•

Overlay: The overlay specification of an audio track. Set the parameter value to 1 to fade down the main audio
playlist while playing the audio track as an overaly. Overlays have additional parameters:
o AudioBedLevel: The volume-level percentage of the main audio playlist while the overlay is playing.

Specify the percentage using values between 0 and 100.
o AudioBedFadeOutLength: The fade-out length of the main audio playlist.
o AudioBedFadeInLength: The fade-in lenth for the length of the underlying audio track once the segue is

•
•
•

triggered.
FadeCurrentPlayNext: A fade command. Set the parameter value to 1 to fade out the current main audio
playlist track and fade in the designated audio file.
CrossfadeCurrentPlayNext: A crossfade command. Set the parameter value to 1 to force an immediate
crossfade between the current main audio playlist track and the designated audio file.
UserString: A string that can be set to a unique value for each roAudioPlayerMx instance. This string is returned
with every event generated by the instance. Since all current platforms can support multiple roAudioPlayerMx
instances running at the same time, the UserString allows the script to distinguish between event returns.

The following diagram illustrates how some of these timing parameters work together:

50

Example: The following example illustrates a simple crossfade between audio tracks.
a = CreateObject("roAudioPlayerMx")
track1 = CreateObject("roAssociativeArray")
track1["Filename"] = "file1.mp3"
track1["FadeInLength"] = 4000

track1["FadeOutLength"] = 4000
track1["QueueNext"] = 1

track2 = CreateObject("roAssociativeArray")
track2["Filename"] = "file2.mp3"
track2["FadeInLength"] = 4000

track2["FadeOutLength"] = 4000
track2["QueueNext"] = 1
a.PlayFile(track1)
a.PlayFile(track2)

Interfaces: ifMediaTransport, ifSetMessagePort, ifAudioControl, ifAudioControlMx
The ifMediaTransport interface provides the following:
• PlayFile(a As Object) As Boolean
• Stop() As Boolean
• Play() As Boolean
• Pause() As Boolean
51

•
•
•

Resume() As Boolean
SetLoopMode(a As Boolean) As Boolean
GetPlaybackStatus() As Object

The ifSetMessagePort interface provides the following:
• SetPort(a As Object)
The ifAudioControl interface provides the following:
• MapStereoOutput(a As Integer) As Boolean
• SetVolume(a As Integer) As Boolean
• SetChannelVolumes(a As Integer, b As Integer) As Boolean
• SetAudioOutput(a As Integer) As Boolean
• SetAudioMode(a As Integer) As Boolean
• SetAudioStream(a As Integer) As Boolean
• SetUsbAudioPort(a As Integer) As Boolean
• SetSpdifMute(a As Boolean) As Boolean
• MapDigitalOutput(a As Integer) As Boolean
• StoreEncryptionKey(a As String, b As String) As Boolean
• StoreObfuscatedEncryptionKey(a As String, b As String) As Boolean
• SetStereoMappingSpan(a As Integer) As Boolean
• ConfigureAudioResources() As Boolean
• SetPcmAudioOutputs(a As Object) As Boolean
• SetCompressedAudioOutputs(a As Object) As Boolean
The ifIdentity interface provides the following:
• GetIdentity() As Integer

52

The ifAudioControlMx interface provides the following:
• SetDecoderCount(a As Integer) As Boolean

53

roCanvasWidget
This object composites background color, text, and images into a single rectangle, allowing you to layer images on a zaxis.
Object Creation: Like other widgets, roCanvasWidget is created with an roRectangle to set its size and position on the
screen.
CreateObject ("roCanvasWidget", r As roRectangle) As Object
Interfaces: ifCanvasWidget
The ifCanvasWidget interface provides the following:
•

Hide() As Boolean: Hides the widget.

•

Show() As Boolean: Shows the widget.

•

SetRectangle(r As roRectangle) As Boolean: Changes the size and positioning of the widget rectangle
using the passed roRectangle object.

•

SetLayer(content As Object, z-level As Integer) As Boolean: Sets the contents of a layer within
the widget. The lowest z-level is drawn first, and the highest z-level is drawn last. The object content is described
below.

•

ClearLayer(int z-level) As Boolean: Clears the specified layer.

•

Clear() As Boolean: Clears all of the layers.

•

EnableAutoRedraw(enable As Boolean) As Boolean: Enables or disables the automatic redrawing of the
widget.

54

o When this function is enabled, each call to SetLayer, ClearLayer, or Clear results in a redraw. If you
need to change multiple layers, then you should disable auto redraw while calling the SetLayer function.
o SetLayer enables or disables redrawing of the widget when layer content is changed. When auto-redraw is
enabled, each call to SetLayer, ClearLayer, or Clear results in a redraw. To batch multiple updates
together, you should first suspend drawing using EnableAutoRedraw(false), then make the changes to
the content, and finally re-enable drawing using EnableAutoRedraw(true). The redraw happens in a
separate thread, so EnableAutoRedraw returns almost immediately.

Object Content
The content specified in each layer can consist of one or more objects. Each object is defined by an roAssociativeArray. If
there is more than one object, then each is placed into an roArray prior to passing to the SetLayer function. Currently,
there are four object types:
1. Background color
•

color: The #[aa]rrggbb hex value of the background color

•

targetRect: A target rectangle, which is another roAssociativeArray consisting of x, y, w, and h values. These
values are relative to the top left corner of the widget.

2. Text
•

text: A string of text to display

•

targetRect: The rectangle in which the text is displayed

•

textAttrs: An roAssociativeArray containing attributes to be applied to the text. The attributes can be any of the
following:
55

o font: Small/medium/large/huge
o fontSize: A point size that is used directly when creating the font. If the value is set to 0, then the font
automatically resizes to fit the targetRect.
o fontfile: The filename for a non-system font to use
o hAlign: The left/center/right alignment of the text on a line
o vAlign: The top/center/bottom alignment of the text perpendicular to the line
o rotation: The 0/90/180/270 degree rotation of the text
o color: The #[aa]rrggbb hex value of the text
3. Image
•
•
•

filename: The filename of the image

encryptionalgorithm: The file-encryption algorithm. Currently the options are "AesCtr" and "AesCtrHmac".
encryptionkey: The key to decrypt the image file. This is a byte array consisting of 128 bits of key, followed by
128 bits of IV.

Note: See the Image Decryption section in the roImagePlayer entry for details on displaying encrypted images.
•

targetRect: The rectangle in which the image is displayed. The image will be automatically resized to fit into the
target area.

•

sourceRect: The source rectangle to clip from a source image

•

compositionMode: Enter either source or source_over. The latter alpha blends with underlying objects. The
former replaces the underlying values completely.

4. QR Codes

56

Note: QR (quick response) codes appear as squares of black dots on a white background. They are used to encode
URLs, email addresses, etc, and they can be scanned using readily available software for smart phones. Although the
codes usually appear as black on white, you can, in theory, use any two contrasting colors.
•

targetRect: The rectangle in which the QR code is displayed
o Regardless of the aspect ratio of this rectangle, the QR code itself will always be squared with the
background color that fills the gaps.

•

QrCode (simple form): Contains the string to encode into the QR code.

•

QrCode (complex form): Contains an array of parameters for the QR code. The parameters can be any of the
following:
o color: The foreground color in the QR code (the default is black)
o backgroundColor: The background color in the QR code (the default is white)
o rotation: 0/90/180/270 degree rotation of the code. The code will scan regardless of rotation.
o qrText: Contains the text to encode into the QR code.

Example: This code contains most of the roCanvasWidget features outlined above:
rect=CreateObject("roRectangle", 0, 0, 1920, 1080)
cw=CreateObject("roCanvasWidget", rect)
aa=CreateObject("roAssociativeArray")
aa["text"] = "Primal Scream"

aa["targetRect"] = { x: 280, y: 180, w: 500, h: 30 }

aa["textAttrs"] = { Color:"#AAAAAA", font:"Medium", HAlign:"Left", VAlign:"Top"}
aa1=CreateObject("roAssociativeArray")

57

aa1["text"] = "Movin' on up, followed by something else, followed by something else, followed by
something else, followed by something else"

aa1["targetRect"] = { x: 282, y: 215, w: 80, h: 500 }

aa1["textAttrs"] = { Color:"#ffffff", font:"Large", fontfile:"usb1:/GiddyupStd.otf",
HAlign:"Left", VAlign:"Top", rotation:"90"}
array=CreateObject("roArray", 10, false)
array.Push({ color: "5c5d5f" })

array.Push({ filename: "transparent-balls.png" })
array.Push(aa)

aa2=CreateObject("roAssociativeArray")

aa2["filename"] = "transparent-balls.png"
aa2["CompositionMode"] = "source_over"

aa2["targetRect"] = { x: 400, y: 200, w: 200, h: 200 }
aa3=CreateObject("roAssociativeArray")
aa3["QrCode"] = "www.brightsign.biz"
aa3["targetRect"] = { x: 100,

y: 100,

w: 400, h: 400

}

aa4=CreateObject("roAssociativeArray")

aa4["QrCode"] = { qrText:"www.brightsign.biz", rotation:"90" }
aa4["targetRect"] = { x: 1200,

y: 100,

w: 400, h: 600

}

aa5=CreateObject("roAssociativeArray")

aa5["QrCode"] = { color:"#964969", backgroundColor:"#FFFF77", qrText:"www.brightsign.biz",
rotation:"180" }

58

aa5["targetRect"] = { x: 100,

y: 600,

w: 400, h: 400

}

cw.Show()

cw.EnableAutoRedraw(0)
cw.SetLayer(array, 0)
cw.SetLayer(aa1, 1)
cw.SetLayer(aa1, 2)
cw.SetLayer(aa3, 3)
cw.SetLayer(aa4, 4)
cw.SetLayer(aa5, 5)

cw.EnableAutoRedraw(1)
cw.ClearLayer(0)

59

roClockWidget
This object places a clock on the screen. It has no extra interface, only construction arguments.
Interfaces: ifTextWidget, ifWidget
Object creation: The roClockWidget object is created with several parameters.
CreateObject("roClockWidget", rect As roRectangle, res As roResourceManager, display_type
As Integer)
•
•
•

rect: The rectangle in which the clock is displayed. The widget picks a font based on the size of the rectangle.
res: A resources.txt file that allows localization via the roResourceManager object (see below for further details).
display_type: Use 0 for date only, and 1 for clock only. To show both on the screen, you need to create two
widgets.

Example:
rect=CreateObject("roRectangle", 0, 0, 300, 60)

res=CreateObject("roResourceManager", "resources.txt")
c=CreateObject("roClockWidget", rect, res, 1)
c.Show()

The resource manager is passed into the widget, which uses the following resources within the resources.txt file to display
the time and date correctly. Here are the "eng" entries:
[CLOCK_DATE_FORMAT]
eng "%A, %B %e, %Y"
[CLOCK_TIME_FORMAT]
eng "%l:%M"
60

[CLOCK_TIME_AM]
eng "AM"

[CLOCK_TIME_PM]
eng "PM"
[CLOCK_DATE_SHORT_MONTH]
eng "Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec"
[CLOCK_DATE_LONG_MONTH]
eng
"January|February|March|April|May|June|July|August|September|October|November|December"
[CLOCK_DATE_SHORT_DAY]
eng "Sun|Mon|Tue|Wed|Thu|Fri|Sat"
[CLOCK_DATE_LONG_DAY]
eng "Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday"
The following are the control characters for the date/time format strings:
//
//
//
//
//
//
//
//
//
//
//

Date format
%a
%A
%b
%B
%d
%e
%m
%n
%y

Abbreviated weekday name
Long weekday name
Abbreviated month name
Full month name
Day of the month as decimal 01 to 31
Like %d, the day of the month as a decimal number, but without leading zero
Month name as a decimal 01 to 12
Like %m, the month as a decimal number, but without leading zero
Two digit year
61

// %Y Four digit year
//
//
//
//
//
//
//
//

Time format
%H
%I
%k
%l
%M
%S

The hour using
The hour using
The hour using
The hour using
Minutes (00 to
Seconds (00 to

24-hour
12-hour
24-hour
12-hour
59)
59)

clock
clock
clock
clock

(00 to 23)
(01 to 12)
(0 to 23); single digits are preceded by a blank.
(1 to 12); single digits are preceded by a blank.

The ifWidget interface provides the following:
• SetForegroundColor(color As Integer) As Boolean: Sets the foreground color in ARGB format.
• SetBackgroundColor(color As Integer) As Boolean: Sets the background color in ARGB format.
• SetFont(font_filename As String) As Boolean: Sets the font_filename using a TrueType font (for
example, SD:/Arial.ttf).
•

•

SetBackgroundBitmap(bitmap_filename As String, stretch As Boolean) As Boolean: Sets the
background bitmap image. If stretch is True, then the image is stretched to the size of the window.

SetBackgroundBitmap(parameters As roAssociativeArray, stretch As Boolean) As Boolean:
Sets the background bitmap image. If stretch is True, then the image is stretched to the size of the window. The
associative array can contain the following parameters:
o Filename: The name of the image file
o EncryptionAlgorithm: The file-encryption algorithm. Currently the options are "AesCtr" and
"AesCtrHmac".
o EncryptionKey: The key to decrypt the image file. This is a byte array consisting of 128 bits of key,

followed by 128 bits of IV.
Note: See the Image Decryption section in the roImagePlayer entry for details on displaying encrypted images.
62

•
•
•
•
•

SetSafeTextRegion(region As roRectangle) As Boolean: Specifies the rectangle within the widget
where the text can be drawn safely.
Show() As Boolean: Displays the widget. After creation, the widget is hidden until Show() is called.
Hide() As Boolean: Hides the widget.
GetFailureReason() As String: Yields additional useful information if a function return indicates an error.

SetRectangle(r As roRectangle) As Boolean: Changes the size and positioning of the widget rectangle
using the passed roRectangle object.

63

roHdmiInputChanged, roHdmiOutputChanged
The roVideoMode object generates an roHdmiInputChanged or roHdmiOutputChanged event object whenever the
hotplug status of the HDMI input or output changes.
At least one roHdmiOutputChanged event object will always be generated for a hotplug event, even for very quick
disconnect/connect hotplug events. In most cases, a disconnect/connect hotplug event will generate two event objects.
Interfaces: ifInt, ifIntOps
The ifInt interface provides the following:
• GetInt() As Integer
• SetInt(a As Integer)

64

roHtmlWidget
This object embeds the WebKit HTML renderer. You can use multiple instances of roHtmlWidget at the same time.
Object creation: Like other widgets, an roHtmlWidget is created with an roRectangle, which specifies the size and
positioning of the widget on the screen.
CreateObject("roHtmlWidget", rect As roRectangle)
Interfaces: ifHtmlWidget, ifMessagePort, ifUserData
The ifHtmlWidget interface provides the following:
• GetFailureReason() As String: : Gives more information when a member function returns False.
• Hide() As Boolean: Hides the widget.
• Show() As Boolean: Shows the widget.
•

SetRectangle(r As roRectangle) As Boolean: Changes the size and positioning of the widget rectangle
using the passed roRectangle object.

• SetURL(URL As String) As Boolean: Displays content from the specified URL.
Note:
When using SetUrl to retrieve content from local storage, you do not need to specify the full file path:
SetUrl("file:/example.html"). If the content is located somewhere other than the current storage device, you
can specify it within the string itself. For example, you can use the following syntax to retrieve content from a storage
device inserted into the USB port when the current device is an SD card:
SetUrl("file:///USB1:/example.html").
•

MapFilesFromAssetPool(asset_pool As roAssetPool, asset_collection As
roAssetCollection, pool_prefix As String, uri_prefix As String) As Boolean: Sets the
mapping between the URL space and the pool files.

65

•
•
•
•
•
•
•

•
•

•

SetZoomLevel(scale_factor as Float): Adjusts the scale factor for the displayed page (the default equals
1.0).
EnableSecurity(a As Boolean) As Boolean: Enables security checks by the Webkit. Setting this method
to False disables security checks.
EnableMouseEvents() As Boolean: Enables response to button presses if True. Setting this method to False
(the default) disables this feature.
SetPortrait(portrait_mode As Boolean) As Boolean: Sets the screen orientation to portrait if True. If
this method is False (the default), the screen is oriented as a landscape.
SetAlpha(alpha As Integer) As Boolean: Sets the overall alpha level for the widget (the default equals
255).
EnableScrollbars(scrollbars As Boolean) As Boolean: Enables automatic scrollbars for content that
does not fit into the viewport if True. Setting this method to False (the default) disables this feature.
AddFont(filename As String) As Boolean: Makes a font available for text rendering. The AddFont()
method can be used to supply additional or custom typefaces for the WebKit renderer. These should be supplied in
the form of TTF files, and the filename should be passed as the argument to AddFont().
SetHWZDefault(default As String): Sets the default HWZ mode for HTML video. Normally, HWZ must be
enabled in each 

Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.4
Linearized                      : Yes
Tagged PDF                      : Yes
XMP Toolkit                     : Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:08:04
Modify Date                     : 2015:12:11 09:39:28-08:00
Create Date                     : 2015:12:11 09:34:36-08:00
Metadata Date                   : 2015:12:11 09:39:28-08:00
Creator Tool                    : Acrobat PDFMaker 9.1 for Word
Document ID                     : uuid:4f281d3a-bf51-4b38-b5e4-fdcdd02d973a
Instance ID                     : uuid:8cb14f9f-6cca-43ad-a9f9-2752197a8b09
Format                          : application/pdf
Title                           : 
Creator                         : 
Producer                        : Adobe PDF Library 9.0
Page Layout                     : OneColumn
Page Count                      : 376
Author                          : 
EXIF Metadata provided by EXIF.tools

Navigation menu