tvcontroller
The tvcontroller object provides a communication interface between televisions and BrightSign built-in products. This object is available as of BOS 9.0.168.
Multiple instances of tvcontroller can access the television from multiple domains (user node application, user HTML application, etc.), or you can use multiple instances of the JavaScript object. They all access the same television hardware and they all get notified with an event when the television sends a message.
tvcontroller IDL
@brightsign/tvcontroller
[Exposed=Window]
interface TvController {
Promise<void> send(Array data);
attribute EventHandler onreceive;
};
[Exposed=Window]
interface ReceiveEvent : Event {
readonly attribute Array data;
};
ON THIS PAGE
Â
Object Creation
To create a tvcontroller object, load the brightsign/tvcontroller
module using the require()
method and then create an instance of the tvcontroller:
let tv_controller_class = require("@brightsign/tvcontroller");
let tv_controller = new tv_controller_class();
TvController
Use this interface to access a television (for example, to send messages)
send()
Promise<void> send(Array data)
Attribute
onreceive
EventHandler:
ReceiveEvent
Use this interface to get notified with an event when the television sends a message
Attribute
data
Array: This is a read-only attribute
Messages
Messages are defined in the Protobuf format. BrightSign firmware includes the JavaScript bindings of the protocol buffer messages in the firmware image. To load the messages, load the following module:
A single Protobuf file is used for both television to BrightSign Built-In and BrightSign Built-In to television messages, because the same messages are used both for verification and update notifications. When BrightSign updates a field (for example, to set up the volume), the television sends the same message back to BrightSign that the volume is updated. The volume can be updated with the television user interface, via remote control. BrightSign also gets that as an event from the television.
There are some exceptions:
Brightsign Built-In doesn’t send messages back to the television to confirm acknowledgement of receipt of the request message, it only sends the requested information.
Both sides can send
PowerSettings
message to each other. To prevent confusion with receiving a command and a acknowledgement, we havePowerSettings
andPowerSettingsAck
message types.PowerSettingsAck
is sent when device gets aPowerSettings
message and switches to the requested power mode.
This is the Proto file for the communication interface:
Â
Usage Examples
Set the TV Gamma Value
In this one way communication, BrightSign makes the request and the television updates and returns the gamma value.
Send
takes a JavaScript array, but serializeBinary
returns Uint8Array
. Uint8Array
should be converted to Array
using Array.from()
before calling send
.
deserializeBinary
also expects a Uint8Array
, but receive
event returns Array
. Array
should be converted to Uint8Array
before calling deserializeBinary
using Uint8Array.from()
.
Â
Send BrightSign Device Information
In the following example, the tv_controller is set up to send a device info, when the television requests it. The application sets up a receive event listener and waits for a request event.
Only one request, DEVICE_INFO
, is currently available (anything else will error). A DEVICE_INFO
request fills the required fields and sends a message back.