Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This controlport object is used to configure output levels on the I/O connector and monitor inputs and provides support for the BP200/BP900 USB button boards and GPIO ports. Typically, LEDs and buttons are attached to the GPIO connector on the BrightSign player or the BrightSign Expansion Module.

Code Block
languagejs
titlecontrolport IDL
    Constructor(String port)
] interface ControlPort {
    void SetOutputValue(unsigned param);
    void SetOutputValues(unsigned p1, unsigned p2, unsigned p3, unsigned p4);
    void SetPinValue(unsigned pin, unsigned param);
    bool GetPinValue(unsigned pin);
    void ConfigureAsInput(unsigned pin);
    void ConfigureAsOutput(unsigned pin);
    void Close()
};



Panel
borderColor#3D3D3D
bgColor#F4F4F4
titleColor#3D3D3D
borderWidth0
titleBGColor#3D3D3D
borderStylesolid

ON THIS PAGE

Table of Contents
indent20px



Object Creation

To create an controlport object, use the require() method:

Code Block
languagejs
let control_port_class = require("@brightsign/legacy/controlport")
let control_port = new control_port_class("TouchBoard-0-GPIO");

The controlport object is created with a parameter that specifies the port being used (TouchBoard-0-GPIO in the example above). The port parameter can be one of the following:

  • BrightSign: Specifies the onboard GPIO connector (including the SVC (GPIO12) button).
  • Expander-GPIO: Specifies the DB-25 connector on the BrightSign Expansion Module. If no BrightSign Expansion module is attached, then object creation will fail and Invalid will be returned.
  • Expander-<n>-GPIO: Specifies a USB-to-GPIO device connected to the player. Multiple USB-to-GPIO devices can be controlled using separate roControlPort instances: The first device corresponds to "Expander-0-GPIO", the second to "Expander-1-GPIO", etc.
  • Expander-DIP: Specifies the eight DIP switches on the BrightSign Expansion Module. If no BrightSign Expansion module is attached, then object creation will fail and Invalid will be returned. Note that hot plugging the BrightSign Expansion Module is not supported.
  • Touchboard-<n>-GPIO: Retrieves events from the specified BP200/BP900 button board. Events are handled in the same manner as events from the BrightSign port.
  • Touchboard-<n>-LED-SETUP: Sets various LED output options for the specified BP200/BP900 button board.
  • Touchboard-<n>-LED: Sets the bits for each button on the specified BP200/BP900 button board. The bits indicate whether the associated LED should be on or off.


Note
titleNote

Since multiple BP200/BP900 button boards can be connected to a player simultaneously, the <n> value specifies the port enumeration of each board. The ordering of multiple attached boards is dependent on the order they appear in the data structure returned by roDeviceInfo.GetUSBTopology(). An unspecified enumeration value is synonymous with a button board with an enumeration value of 0 (e.g. Touchboard-GPIO and Touchboard-0-GPIO are identical).



ControlPort

SetOutputValue()
Code Block
languagejs
void SetOutputValue(unsigned param)

Specifies the desired state of all outputs attached to the control port as bits in an integer. The output of the specified pin can be either "off" (0) or "on" (1). If the button is not configured as an output, the resulting level is undefined. This method can also be used to configure LED output behavior on BP200/B900 button boards; see BP200/BP900 Setup for more details.

The parameter is an 8-bit integer and each bit represents an output.

SetOutputValues()
Code Block
languagejs
void SetOutputValues(unsigned p1, unsigned p2, unsigned p3, unsigned p4)

Configures Specifies the desired state of all outputs attached to the control port as bits in an integer (for example, it can configure buttons on a BP200/BP900 button board). This method can only be used when the controlport object is instantiated with the Touchboard-<n>-LED-SETUP or Touchboard-<n>-LED parameter. See BP200/BP900 Setup for more details.

SetPinValue()
Code Block
languagejs
void SetPinValue(unsigned pin, unsigned param)

Configures the output of the specified button, which can be either low (0) or high (1). If the button is not configured as an output, the resulting level is undefined. This method can also be used to configure LED output behavior on BP200/B900 button boards.

bool GetPinValue()

Returns true if the specified input pin is active (low). Returns false if the pin is inactive (not connected or high).

ConfigureAsInput()
Code Block
languagejs
void ConfigureAsInput(unsigned pin)
Marks the specified button as an input. Input buttons are tri-stated and can be driven high or low externally.
ConfigureAsOutput()
Code Block
languagejs
void ConfigureAsOutput(unsigned pin)
Marks the specified button as an output. The output will be driven high or low depending on the current output state of the pin.
Close()
Code Block
languagejs
void Close()
Shuts down the controlport instance to prevent it from consuming further resources. If this method is not called, garbage collection determines when the instance will be destroyed.

Events

Button presses are returned as oncontroldown and oncontrolup.

These events are available on the controlport object:

  • oncontroldown
  • oncontrolup
  • oncontrolevent