npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

extron-mvc

v1.0.0

Published

A Node module to control Extron MVC 121 Plus audio mixer using RS-232 with JS and human friendly commands

Downloads

1

Readme

Introduction

extron-mvc is Node module to control Extron MVC 121 Plus audio mixer using RS-232 with JS and human friendly commands

Main features

  • simple to use
  • events driven
  • command queuing and timing management
  • different schemas of connect-disconnect cycle

Usage

const Extron = require('extron-mvc');

//process commands using RS-232
const dev = new Extron({name: 'mvc121p', path: 'com4'});
dev.emitter.on('responseFromDevice', data => console.log(data));
dev.process('volume+', 'inputGain 2,5'); //increase variable output by 1, set input2 gain to 5 dB
dev.process('temperature?')// get device temperature in Celsius
/* expected response
{
  name: 'mvc121p',
  raw: 'Vol71',
  req: 'volume',
  value: '71',
  status: 'OK'
}
{
  name: 'mvc121p',
  raw: 'In2 Aud5',
  req: 'inputGain',
  value: { input: '2', audio: '5' },
  status: 'OK'
}
{
  name: 'mvc121p',
  raw: 'Sts20*34',
  req: 'temperature',
  value: '34',
  status: 'OK'
}
*/

Extron Object

The primary exported object is Extron. It uses RAW object from raw-device module as its prototype. Data neccesery to process commands can be found in mvc121plus-sis.js file.

Constructor new Extron(AddressObject, OptionsObject)

  • AddressObject <Object> - required. Use only properties associated with the desired mode (serial, stream)
    • name <string> - default 'ExtronDev'. This name is included in response object for easy identification
      //serial mode
    • path <string> - required. Use valid serial path available in system.
    • baudRate <number> - default 38400
    • dataBits <number> - default 8
    • parity <string> - default 'none'
    • stopBits <number> - default 1
      //stream mode
    • stream <Stream> - required. The stream must be opened read/write Node stream. Extron object does not care about the stream. You have to maintain stream yourself (open, close, error handling).
  • OptionsObject <Object> - optional, default is {wDuration: 500, rDuration: 500, disconnect: false, splitter: {delimiter: '\r\n'}}
    • wDuration <number> - Inter-command period [ms] for set commands. A time for device to process command and to prepare and send a response.
    • rDuration <number> - Inter-command period [ms] for get commands. A time for device to prepare and send a response.
    • disconnect <boolean|number> - Connecion cycle scheme. Use true, false or timeout[ms]. True means close connection when command queue is empty, false means do not close connection, number means close connection after some ms. of connection inactivity. If is set to false, the object won't exit event loop.
    • splitter <Object> Used to select one among three supported transform streams which merge incoming data chunks and split it into valid messages. Only single property from delimiter, regex, timeout can be used. For more details see raw-device module docs.

Method process(...commands)

Encode and send commands to device. You can use multiple commands in single call. Commands will be queued and executed FIFO.

Regular commands

Commands are based on Extron's Simple Instruction Set (SIS). Commands are strings in human friendly form command[?+-] [parameter(s)]. If command needs multiple parameters, they are separated by commas. Some examples:
volume+ - increase variable volume output by 1
inputGain 2,5 - set input 2 gain to 5 dB
temperature? - get device temperature
Not all SIS commands are implemented. The most usefull ones were selected. All implemented commands and their usage are listed in mvc121plus-sis.js file. You can also use native SIS commands which are not defined in this file. In this case commands will be send and executed but response will not be decoded.
NOTE: Fot maximum module usability, set device verbose mode to 3. If you are not sure which verbose mode the device is, just send 'verbose 3' command as first one.

Internal commands

There are some internal commands which start with #. They are not sent to device, but are processed by Extron object itself.

  • #pause duration - append additional pause between neighboring commands as number of miliseconds.
  • #connect - force to open connection to device.
  • #close - force to close connection to device.

Event: commandForDevice

Emited when command is properly encoded and sent to device. Of course only encoded property is sent to device itself.

  • command <Object>
    • name <string> - device name
    • command <string> - a command itself, not parsed or encoded
    • encodedStr <string> - command encoded as string
    • encoded <Buffer> - command encoded as Buffer
    • duration <number> - time [ms] for device to process the command.

Event: responseFromDevice

Emited when valid response from device is detected.

  • response <Object>
    • name <string> - device name
    • raw <Buffer> - not decoded raw response
    • req <string> - Used to identify the response. It is just decoded command name.
    • value <string|Object> - decoded(or not) response value. Return type depends on command. See mvc121plus-sis.js. It can also contain error message in case of error response.
    • status <'OK'|'ERR'|'RAW'> - response status. 'RAW' means valid, but not decoded response

Event: connectionData

A data which comes directly from device port "as is". Not decoded, merged or chopped by splitter. Event is not emited in stream mode.

  • dataObj <Object>
    • name <string> - device name
    • address <string> - device address as string
    • data <Buffer> - data itself

Event: connectionStatus

Emited when device connection status changes. Event is not emited in stream mode.

  • statusObj <Object>
    • name <string> - device name
    • dev <string> - obsolete, same as name
    • address <string> - device address as string
    • status <string> - connection status
    • more <string|Object> - additional status information