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

adder-kvm-secure

v1.0.0

Published

Node module to control Adder secure KVM switch and flexi-switch using RS-232 serial connection

Downloads

3

Readme

Introduction

adder-kvm-secure is module to control Adder secure KVM switch and flexi-switch using RS-232 interface. Supportet models are ADDER Secure KVM Switch(AVS 2114, 2214, 4114, 4214) and ADDER Secure Flexi-Switch(AVS 4128). It is NOT suitable for other Adder KVM switches.

Main features

  • human friendly commands,
  • responses decoded to JS objects
  • command queuing and timing management
  • events driven

Usage

const AdderKVM = require('adder-kvm-secure');
let dev = new AdderKVM({path: 'com3'});
dev.emitter.on('responseFromDevice', resp => console.log(resp));
dev.process('switch 2');
/* expected response
{
  dev: 'AdderKVM',
  raw: <Buffer 7e 30 30 40 41 46 50 5f 41 4c 49 56 45 20 4c 45 44 20 46 46 46 46 46 46 46 44 0d 0a>,
  rawStr: '~00@AFP_ALIVE LED FFFFFFFD\r\n',
  req: 'switch',
  value: '2',
  status: 'OK'
}
*/

AdderKVM Object

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

Constructor new AdderKVM(AddressObject, OptionsObject)

  • AddressObject <Object> - required
    • name <string> - default 'AdderKVM'
    • path <string> - required. Use valid serial path available in system.
    • baudRate <number> - default 115200
    • dataBits <number> - default 8
    • parity <string> - default 'none'
    • stopBits <number> - default 1
  • OptionsObject <Object> - Optional, default is {encoding: 'ASCII', duration: 1000, disconnect: true, splitter: {delimiter: '\r\n', includeDelimiter: true}}
    • 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 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.
      • 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 device. You can use multiple commands in single call. Commands will be queued and executed FIFO.

Supported commands are:

  • switch input_name - switch specified input to output. Valid input names are 1-8 and R1-R8 for flexi-switch. Response.req is 'switch'
  • toggleMute - toggle mute on/off. Response.req is 'mute'
  • KMfocus left|right - put keyboard/mouse focus to left o right display. Command valid only for flexi-switch
  • aliveFrequency number - Adder secure KVM reports periodically that he is OK. You can set frequency for this message using alivefrequency command. Number is given in 1/10 seconds (10 means 1sec.). Valid range for number is 1-99. This message from device is decoded also. You can filter the response using response.req=='alive'

Internal commands

There are some internal commands which start with #. They are not sent to device, but are processed by software 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
    • encoded <Buffer> - command encoded as Buffer
    • encodedStr <string> - command encoded as string
    • duration <number> - time [ms] for device to process the command.

Event: responseFromDevice

Emited when response from device is properly decoded.

  • response <Object>
    • dev <string> - name
    • raw <string> - not decoded response
    • status <string> - response status. OK or ERR
    • value <string|boolean> - decoded response value. Returned type depends on request (response.req).
    • req <string> - command, for which response is for. Identifies the response

Event: connectionData

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

  • data <Buffer>