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

wallcontrol10

v1.0.0

Published

Send WallControl 10 commands to wall controller and decode responses to JS values

Downloads

2

Readme

Introduction

wallcontrol10 is module for working with WallControll 10 command line interface over LAN-TCP. Decode responses from Wall Control 10 into JS values.

Main features

  • connect over LAN-TCP
  • execute native WallControl 10 commands
  • decode responses into JS values
  • command queue and time management
  • events driven
  • different schemas for connect-disconnect cycle

Usage

const WC10 = require('wallcontrol10');
//send-receive data using TCP socket
const dev = new WC10({host: '192.168.4.111'});
dev.emitter.on('responseFromDevice', data => console.log(data));
dev.process('wcmd -layouts'); //ask for layouts for default wall
dev.process('wcmd -layout="layout 1"'); //apply 'layout 1' for default wall

WC10cli Object

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

Constructor new WC10cli(AddressObject, OptionsObject)

  • AddressObject <Object> - required.
    • name <string> - default 'WC10'
    • id <string> - default 'blueprint'
    • host <string> - required. Use valid IP address
    • port <number> - default 23
  • OptionsObject <Object> - optional, default is {encoding: 'ASCII', duration: 1400, disconnect: true, splitter: {timeout: 1200}}
    • encoding <string> - default 'ASCII'
    • duration <number> - default 1400 ms. Inter-command period [ms]. A time for device to process command and to prepare and send a response.
    • disconnect <boolean|number> - default true. 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 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. Default is {timeout: 1200}
      • delimiter <string> - use @serialport/parser-delimiter with string delimiter
      • regex <Regex> - use @serialport/parser-regex with regex
      • timeout <number> - use @serialport/parser-inter-byte-timeout with timeout. Response is completed if inter-byte time is longer then timeout. Please consider that timeout must be shorter than duration (inter-command period) and disconnect time (if disconnect use timeout scheme)

Method process(...commands)

Encode and send commands to controler. Commands will be queued and executed FIFO. You can use multiple commands in single call. Commands must be native WallControl 10 CLI commands as described in WallControl 10 Help/Tools/Command Line Interface or WallControl 10 User Guide. The most commonly used commands are:

  • wcmd [-wall=wall_name] -layouts - Get layout names for given wall
  • wcmd [-wall=wall_name] -layout=layout_name - Apply layout for wall
  • wcmd [-wall=wall_name] -layout - Get current layout name for given wall
  • wcmd -inputs - Get list of sources
  • wcmd [-wall=wall_name] -openwindows - Get list of opened windows with their properties
  • wcmd -wallstate - Get list of defined walls with their properties

Internal commands

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

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

Event: responseFromDevice

Emited when response from controller is properly decoded.

  • response <Object>
    • dev <string> - controler name
    • id <string> - wall name
    • 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> - request id, used to identify response value. Currently following request are implemented:
      • req:'layouts' (available layouts), response for wcmd -layouts command
      • req:'layout' (current layout), response for wcmd -layout
      • req:'inputs' (available inputs), response for wcmd -inputs
      • req:'providers' (installed source providers), response for wcmd -providers
      • req:'windows' (opened windows), response for wcmd -openwindows
      • req:'walls' (available walls), response for wcmd -wallstate
      • req:'favourities' (available favourities), response for wcmd -favourities

Event: commandForDevice

Emited when command is properly encoded and sent to controler. Of course only encoded property is sent to controler 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: connectionData

A data which comes directly from controler port "as is". Not decoded, merged or chopped by splitter

  • data <Buffer>

Event: connectionStatus

Emited when device 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