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

cambridge-sound-qtpro

v0.2.1

Published

Node package for communicating with Cambridge Sound Qt series sound masking systems through their telnet-based command line interface

Downloads

1

Readme

cambridge-sound-qtpro

Node package for communicating with Cambridge Sound Qt series sound masking systems through their telnet-based command line interface.

Tested with QtPro 300 but should work with any Qt series sound masking system that implements the telnet command line interface.

Basic testing has been done but there are likely to be uncaught edge cases. Issues and pull requests are welcome.

Install

npm install cambridge-sound-qtpro

Quick start

const QTPro = require('cambridge-sound-qtpro');

const params = {
    ip: '172.16.10.141', 
    model: 'QT300',
    port: 23, // default
    reconnect: true // default
};

const qtpro = new QTPro(params);

qtpro.on('ready', () => {
    const getSystemArgs = {
        parameter: 'ip_address'
    };
    qtpro.getSystemParam(getSystemArgs, (res) => {
        console.log(`The IP address of this Qt Pro unit is ${res[getSystemArgs.parameter]}`);
    });

    const getZoneArgs = {
        zone: 1, // 0-indexed zone number, so this is asking for Zone 2
        parameter: 'masking_max'
    };
    qtpro.getZoneParam(getZoneArgs, (res) => {
        console.log(`The maximum masking level for Zone 2 of this Qt Pro unit is ${res[getZoneArgs.parameter]}`);
    });

    const setSystemArgs = {
        parameter: 'unit_name',
        value: 'CommLink Integration Corp HQ'
    };
    qtpro.setSystemParam(setSystemArgs, (res) => {
        console.log(`The unit name was ${res ? '' : 'not'} set to ${setSystemArgs.value}`);
    });

    const setZoneArgs = {
        zone: 1,
        parameter: 'masking_min',
        value: 12
    };
    qtpro.setZoneParam(setZoneArgs, (res) => {
        console.log(`The minimum masking level for Zone 2 was ${res ? '' : 'not'} set to ${setZoneArgs.value}`);
    });

    qtpro.getAllSystemParams((res) => {
        console.log(`The system parameters are ${res}`);
    });

    qtpro.getAllZoneParams({zone: 0}, (res) => {
        console.log(`Zone 1 parameters are ${res}`);
    });
});

Classes

Typedefs

QTPro

Kind: global class

new QTPro(params)

Create a QTPro unit.

| Param | Type | Default | Description | | --- | --- | --- | --- | | params | Object | | | | params.ip | string | | The IP address of the unit | | params.model | string | | The model of QTPro connecting to, options are 'QT300' or 'QT600' | | [params.port] | number | 23 | The port number the unit is listening on | | [params.reconnect] | boolean | true | If the connection should attempt to re-establish after closing |

qtPro.connect()

Attempts to connect to the Qt Pro unit. This is run automatically on class instantiation but can be used manually to reconnect if reconnect is set to false in the constructor params

Kind: instance method of QTPro

qtPro.reset([cb])

Sends a software reset command to the QtPro unit. If reconnect is set to false in the constructor params, the Qt Pro connection will be lost and not recovered

Kind: instance method of QTPro

| Param | Type | Description | | --- | --- | --- | | [cb] | setCallback | The callback to run against the response |

qtPro.getAllSystemParams([cb])

A special request to get all of the system parameters for a Qt Pro unit

Kind: instance method of QTPro

| Param | Type | Description | | --- | --- | --- | | [cb] | getAllCallback | The callback to run against the response |

qtPro.getSystemParam(parameter, [cb])

Sends a get command to the QtPro unit and returns a parsed response object

Kind: instance method of QTPro

| Param | Type | Description | | --- | --- | --- | | parameter | string | The parameter to get. Valid values are in api.system.get | | [cb] | getOneCallback | The callback to run against the response |

qtPro.setSystemParam(parameter, value, [cb])

Sends a set command to the QtPro unit

Kind: instance method of QTPro

| Param | Type | Description | | --- | --- | --- | | parameter | string | The parameter to set. Valid values are in api.system.set | | value | string | The value the parameter will be set to | | [cb] | setCallback | The callback to run against the response |

qtPro.getAllZoneParams(zone, [cb])

A special request to get all of the parameters for a specific zone

Kind: instance method of QTPro

| Param | Type | Description | | --- | --- | --- | | zone | Number | The zone to get all parameters for | | [cb] | getAllCallback | The callback to run against the response |

qtPro.getZoneParam(zone, parameter, [cb])

Sends a get command to the QtPro unit and returns a parsed response object

Kind: instance method of QTPro

| Param | Type | Description | | --- | --- | --- | | zone | Number | The 0-indexed zone number the parameter will be set for | | parameter | string | The parameter to get. Valid values are in api.zone.get | | [cb] | getOneCallback | The callback to run against the response |

qtPro.setZoneParam(zone, parameter, value, [cb])

Sends a set command to the QtPro unit

Kind: instance method of QTPro

| Param | Type | Description | | --- | --- | --- | | zone | Number | The 0-indexed zone number the parameter will be set for | | parameter | string | The parameter to set. Valid values are in api.zone.set | | value | string | The value the parameter will be set to | | [cb] | setCallback | The callback to run against the response |

getOneCallback : function

Callback for requesting one system or zone parameter

Kind: global typedef

| Param | Type | Description | | --- | --- | --- | | res | object | an object with a single property, the value of the parameter property passed to the get* method, and it's current value according the QTPro unit |

getAllCallback : function

Callback for requesting all system or zone parameters

Kind: global typedef

| Param | Type | Description | | --- | --- | --- | | res | object | an object with a property for every system or zone entry in ./api.js and it's current value |

setCallback : function

Callback for setting one system or zone parameter

Kind: global typedef

| Param | Type | Description | | --- | --- | --- | | res | boolean | true if the set was successful, false otherwise |

Authors

See also the list of contributors who participated in this project.

License

MIT License