The BrightScript language, which is interpreted and not compiled, has two available CLIs:
The BrightSign shell which allows you to start scripts and some other device management tasks (see BrightSign Shell Commands)
The BrightScript debugger which is used to examine and manipulate a running BrightScript process
This page describes how to access these CLIs and the BrightScript debugger tool set.
Connecting to the BrightScript Interpreter
To access both of these interfaces, you need to associate a terminal session from your local machine with the input and output of the BrightScript interpreter process. In a standard operating environment, the only interaction possible with the BrightScript interpreter is monitoring it’s output, since it will not accept input including interrupts.
To interact with either CLI, you must first set script debug on
, which can be done in multiple ways. For example, in the DWS Registry tab, enter registry write brightscript debug 1
(which is equivalent to the BrightSign shell command script debug on
). When a physical connection to the player is available, these interfaces can be accessed via the primary serial port by using a terminal program and a null-modem cable (see this page).
The BrightSign shell and debugger interfaces can also be routed over Telnet or SSH.
Accessing the Debugger
If you haven’t turned on script debug, any interruption to the BrightScript interpreter execution will not give access to the debugger but will instead reboot the player to attempt a clean execution.
Automatic Access
If, while a script is running, a runtime error occurs or a STOP
statement is encountered, the BrightSign application will enter the BrightScript debug console.
Access at Bootup
You can also access the debug console at bootup:
Power off the device.
Power on the device and wait between 5 and 15 seconds.
Press and hold the SVC button on the side of the player.
If you are using Telnet, you will need to restart Telnet by running
telnet {{your player IP address}} 23
on the command line.Wait until the
BrightSign>
prompt appears in the serial/Telnet/SSH terminal (which indicates that you are in the BrightSign Shell). You can now release the SVC button.Enter
script
at the prompt while in the BrightSign Shell. This will take you to the BrightScript debug console.
Access if the Player doesn’t have an Autorun.brs
The BrightSign OS does not register the SVC button event if there is no autorun.brs
on the storage device. If this is the case, one of the following methods can be used to access the BrightSign prompt or BrightScript Debugger:
If the serial console has been enabled (either temporarily or persistently), a
Starting BrightSign Application...
message will appear after the player reboots (which can take up to 30 seconds). Press and hold the SVC button until the BrightSign prompt displays.Put an
autorun.brs
that only containsend
on the storage device. A single line ofend
is sufficient. The script will execute and when it ends as instructed you’ll be left at the BrightSign shell prompt.If you have removable storage such as a microSD card, eject it. Reboot the player and press the SVC button. If you are accessing the player through Telnet, you will have to restart the Telnet connection after the player reboots using the
telnet {{your player IP address}} 23
command.
BrightScript Console
The BrightScript console should only be used in development environments when writing software or debugging your player’s application software. It should be disabled for production deployments.
When the BrightScript debug console is enabled, if a runtime error is encountered from a BrightScript script, the BrightSign OS breaks on the line of the runtime error, allowing you to step through the file.
Console Scope
The console scope is set to the function that was running when the BrightScript debugger is invoked, either by choice or automatically. While in the console, you can type in any BrightScript statement; it will then be compiled and executed in the current context. If the interpreter has exited the running script, you can instead use the BrightSign shell command set.
Commands
The following console commands are currently available in the BrightScript debug console:
Command | Description |
---|---|
| Print a backtrace of call-function context frames. |
| List all public classes. |
| Continue script execution. |
| List count of BrightScript Component instances. |
| Show disassembly and bytecode for this function. |
| Move one position down the function context chain. |
| Exit the debug shell. |
| Run the garbage collector and show collection statistics. |
| Print the internal hash-table histograms. |
| Show the last line that executed. |
| List methods provided by specified class. |
| List methods provided by the specified interface or class. |
| List the current source of the current function. |
| Show line data (source records) |
| Show the next line to execute. |
| List all allocated BrightScript Component instances. |
| Show statistics. |
| Step one program statement. |
| Step one statement and show each executed opcode. |
| Move one function up the context chain. |
| Display local variables and their types/values. |
| Print variable value or expression.* |
*BrightScript print
messages are routed to the BrightSign application console, which is accessible via the primary serial port or Telnet/SSH, as noted above.