vwas6

1.0.0 • Public • Published

Introduction

VWAS is module for working with VWAS, a Video Wall Administration System. You can send commands and receive responses over LAN-TCP in human friendly form.

Main features

  • connect using LAN-TCP
  • human friendly commands
  • decode responses into JS values
  • command queue and time management
  • events driven
  • different schemas for connect-disconnect cycle

Usage

const VWAS = require('vwas6');
//send-receive data using TCP socket
const dev = new VWAS({host: '192.168.4.90'});
dev.emitter.on('responseFromDevice', data => console.log(data));
dev.process('startAllEngines'); //On all display wall cubes
/* expected response
{
  dev: 'VWAS',
  id: '',
  raw: <Buffer bb bb bb bb 00 00 00 02 03 00 dd dd dd dd>,
  status: 'SUCCESS',
  req: 'startAllEngines',
  value: undefined
}
*/
dev.process('getModes'); //get modes (layouts/presets) defined in VWAS
/* expected response
{
  dev: 'VWAS',
  id: '',
  raw: <Buffer bb bb bb bb 00 00 00 67 06 00 00 00 00 05 00 00 00 16 56 57 41 53 5f 44 45 46 41 55 4c 54 5f 43 4c 45 41 52 57 41 4c 4c 00 00 00 15 56 57 41 53 5f 44 ... 61 more bytes>,
  status: 'SUCCESS',
  req: 'getModes',
  value: [
    'VWAS_DEFAULT_CLEARWALL',
    'VWAS_DEFAULT_POWEROFF',
    'VWAS_DEFAULT_POWERON',
    'mode1',
    'test_mode'
  ]
}
*/

VWAS Object

The primary exported object is VWAS. It uses RAW object from raw-device as its prototype.

Constructor new VWAS(AddressObject, OptionsObject)

  • AddressObject <Object> - required.
    • name <string> - default 'VWAS'
    • id <string> - cube id (CID), it is used if command refers to single module engine. It consist of 2 numbers separated by -(minus). First number is row number (starting from 0), second one is column number (also starting from 0). Id '0-0' is upper left module in a wall, then numbers go right and down.
    • host <string> - required. Use valid IP address
    • port <number> - default 5999. Port must match [Amx Settings] tab in VWAS Panel
  • OptionsObject <Object> - optional, default is {encoding: null, duration: 1000, disconnect: true, splitter: {delimiter: Buffer.from('DDDDDDDD', 'hex')}}
    • encoding <string>
    • duration <number> - Inter-command period [ms]. A time for device to process command and 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.
    • splitter <Object> Used to merge incoming data chunks and split it into valid messages.

Method process(...commands)

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

Supported commands are:

  • selectWall - select defined wall if more than one exist, param wall name <string>
  • getWalls - get defined walls, return wall names [<string>]
  • startEngine - start wall module engine, param CID <string>
  • stopEngine - stop wall module engine, param CID <string>
  • startAllEngines
  • stopAllEngines
  • getModes - get modes (layouts/presets) defined for wall, return array of names [<string>]
  • callMode - call/apply mode, param mode name <string>
  • getCubeStatus - get cube/engine status, param CID <string>, return as object consisting of param: value
  • getOpticsModeIndex - get current engine optics mode, return index <number> 0-10
  • setOpticsModeIndex - set engine optics mode, param index <number> 0-10. 0 is default

Internal commands

There are some internal commands which start with #. They are not sent to VWAS, but are processed by software itself.

  • #pause duration - Append additional pause between neighboring commands as number of miliseconds.

Examples:

  • process('getCubeStatus 0-0') - get cube/engine status of upper left module
  • process('callMode preset1') - apply wall mode1
  • process('stopAllEngines') - suspend all wall cubes/engines

Event: commandForDevice

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

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

Event: responseFromDevice

Emited when response from VWAS is properly decoded.

  • response <Object>
    • dev <string> - name
    • id <string> - CID, if response is related to single cube
    • raw <string> - not decoded response
    • status <string> - response status. If command is executed OK, returned status is 'SUCCESS'
    • value <string|[string]|Object> - decoded response value. Returned type depends on request id (req).
    • req <string> - command, for which response is for

Event: connectionData

A RAW data which comes directly from VWAS. Not decoded, merged or chopped by splitter

  • data <Buffer>

Event: connectionStatus

Emited when VWAS connection status changes.

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

Readme

Keywords

Package Sidebar

Install

npm i vwas6

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

15 kB

Total Files

4

Last publish

Collaborators

  • mmagik