---
title: BSCECTransmitter
slug: develop/bscectransmitter
docTags: 
createdAt: 2025-03-11T07:07:17.199Z
---

For more information about available methods, refer to the [roCecInterface](docId\:ezdh3By8IIBWQKy04obzU) entry. Note that you can only use this JavaScript class to send CEC messages. Use [BSCECReceiver](docId:1wzSjlvArrwoppr9c-dYE) to receive CEC messages.

When possible, JavaScript APIs should be used instead of BrightScript-Javascript Objects. The JavaScript API equivalent to this object is [cec](docId\:sgfokqfxwmjxxOfS13HtK).

## Methods

- `boolean SendRawMessage(in ArrayBuffer data)`
- `boolean SendRawMessage(in ArrayBufferView data)`
- `boolean SendRawMessage(in DOMString data)`
- `void Close()`: Shuts down the instance, preventing it from further consuming resources. If this method is not called, garbage collection determines when the instance will be destroyed.

## Example

The following JavaScript example shows how to send a set of CEC messages:

```javascript
function cecDisplayOn()
    {
        console.log("### cecDisplayOn ###");
        var cec_control = new BSCECTransmitter();
        var buffer = new Uint8Array(2);
        buffer[ 0 ] = 0x40;
        buffer[ 1 ] = 0x0D;
        cec_control.SendRawMessage(buffer);
    }

function cecDisplayOff()
    {
        console.log("### cecDisplayOff ###");
        var cec_control = new BSCECTransmitter();
        var buffer = new Uint8Array(2);
        buffer[ 0 ] = 0x40;
        buffer[ 1 ] = 0x36;
        cec_control.SendRawMessage(buffer);
    }
```

