0.1.1 • Published 2 years ago

symetrix-control v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

symetrix-control

Implements v7.0 of the Composer Control Protocol from Symetrix

The Composer Control Protocol is a Telnet-style command/response API which is not typically well-suited to Javascript's asynchronous model. This package gets around that by keeping command requests and callbacks in a FIFO buffer and when a response is received from the endpoint, the callback is executed and the next command is sent. This package guarantees that commands are sent in the order in which they are called.

You get Promises as a consumer of this package so every command takes the form of:

symetrix.command()
        .then((data) => {
            console.log(data);
        })
        .catch((err) => console.log(err));

Additional commands can be nested inside returned Promises if desired

Install

npm install symetrix-control

Quick start

const Symetrix = require('symetrix-control');

this.sym = new Symetrix({ host: '172.16.10.200' });

this.sym.on('connected', () => {
    this.sym.on('push', (data) => {
        console.log('Push received from Symetrix', data);
    });

    this.sym
        .pushState(true)
        .then((data) => {
            console.log('push state:', data);
        })
        .catch((err) => console.log(err));

    this.sym
        .controlGet(1000)
        .then((data) => {
            console.log('get:', data);
        })
        .catch((err) => console.log(err));

    this.sym
        .pushRefresh()
        .then((data) => {
            console.log('refresh push:', data);
        })
        .catch((err) => console.log(err));

    this.sym
        .controlGetBlock(1000, 10)
        .then((data) => {
            console.log('get block:', data);
        })
        .catch((err) => console.log(err));

    this.sym
        .flashUnit()
        .then((data) => {
            console.log('flash:', data);
        })
        .catch((err) => console.log(err));
});

Symetrix

Kind: global class

symetrix.controlSet(id, value) ⇒ Promise

Use this command to move a controller position on the currently addressed unit to a new absolute value

Kind: instance method of Symetrix

ParamTypeDescription
idnumberthe control ID to set, between 1 and 10000
valuenumberthe value to set the control ID to, between 0 and 65535

symetrix.controlChange(id, value) ⇒ Promise

Use this command to move a controller to a new relative value. This command will increment or decrement a controller by a specified amount

Kind: instance method of Symetrix

ParamTypeDescription
idnumberthe control ID to set, between 1 and 10000
valuenumberthe value to change the control ID by, between -65535 and 65535

symetrix.controlGet(id) ⇒ Promise

This command will return the controller position (value) associated with a specific controller number

Kind: instance method of Symetrix

ParamTypeDescription
idnumberthe control ID to get, between 1 and 10000

symetrix.controlGetBlock(id, size) ⇒ Promise

This command will return the controller position (value) of a specific range of consecutive controller numbers.

Kind: instance method of Symetrix

ParamTypeDescription
idnumberthe first control ID to get, between 1 and 10000
sizenumberthe number of consecutive control IDs to get, between 1 and 256

symetrix.reboot() ⇒ Promise

This command will instantly reboot the unit

Kind: instance method of Symetrix

symetrix.flashUnit() ⇒ Promise

This command momentarily flashes the front panel LEDs of the unit being addressed

Kind: instance method of Symetrix

symetrix.setSystemString(resource, value) ⇒ Promise

This command sets a system string such as a speed dial name or number. Refer to the Composer Control documentation for details on valid strings and values

Kind: instance method of Symetrix

ParamTypeDescription
resourcestringthe string resource to set
valuestringthe value to set the string resource to

symetrix.getSystemString(resource) ⇒ Promise

This command sets a system string such as a speed dial name or number. Refer to the Composer Control documentation for details on valid strings

Kind: instance method of Symetrix

ParamTypeDescription
resourcestringthe string resource to get

symetrix.getPreset() ⇒ Promise

This command will return the last preset that was loaded

Kind: instance method of Symetrix

symetrix.loadPreset(id) ⇒ Promise

This command will load the specified preset (1-1000) on the currently addressed unit.

Kind: instance method of Symetrix

ParamTypeDescription
idnumberthe preset number to set, between 1 and 1000

symetrix.pushState(enable, low, high) ⇒ Promise

This command enables or disables the push feature for an individual controller or range of controllers. To select an individual controller to enable/disable push on set high equal to low Using the default values will enable or disable pushing for all control IDs

Kind: instance method of Symetrix

ParamTypeDescription
enablebooleanif push should be enabled or disabled
lownumberthe lowest control ID that should be enabled/disabled, defaults to 1
highnumberthe highest control ID that should be enabled/disabled, defaults to 10000

symetrix.getPushEnabled(low, high) ⇒ Promise

This command returns a list of all controllers currently enabled for push on the addressed device. To select an individual controller set high equal to low Using the default values will query all control IDs

Kind: instance method of Symetrix

ParamTypeDescription
lownumberthe lowest control ID that should be queried, defaults to 1
highnumberthe highest control ID that should be queried, defaults to 10000

symetrix.pushRefresh(low, high) ⇒ Promise

This command causes data to be pushed immediately even if it hasn’t changed (assuming push is enabled). To select an individual controller to refresh set high equal to low. Using the default values will refresh all control IDs

Kind: instance method of Symetrix

ParamTypeDescription
lownumberthe lowest control ID that should be refreshed, defaults to 1
highnumberthe highest control ID that should be refreshed, defaults to 10000

symetrix.pushClear(low, high) ⇒ Promise

This command causes previous changes in data to be ignored and not pushed. It may be desirable to issue this command when first enabling push to prevent being swamped by the flood incoming data. To select an individual controller to clear set high equal to low. Using the default values will clear all control IDs

Kind: instance method of Symetrix

ParamTypeDescription
lownumberthe lowest control ID that should be refreshed, defaults to 1
highnumberthe highest control ID that should be refreshed, defaults to 10000

symetrix.pushInterval(value) ⇒ Promise

This command changes the minimum length of time between consecutive pushes of data. At power-up, this value defaults to 100 milliseconds. Interval must be between 20 (20ms) and 30000 (30s)

Kind: instance method of Symetrix

ParamTypeDescription
valuenumberthe new push interval in milliseconds

symetrix.pushThreshold(meter, other) ⇒ Promise

This command changes the push threshold value. The threshold is the amount a value must change from the previous push before it is pushed again. SymNet maintains two thresholds: one for parameter data such as faders and buttons, and another for meters (including LEDs). It may be desirable to use a large threshold for meters to avoid constant pushing of values. The power-on default for both is 1.

Kind: instance method of Symetrix

ParamTypeDescription
meternumberthe threshold for meters, defaults to 1
othernumberthe threshold for everything else, defaults to 1