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 🙏

© 2026 – Pkg Stats / Ryan Hefner

instrument-com

v0.1.4

Published

communication with instrument through ethernet or usb

Readme

instrument-com

Support many methods to communication with instrument through ethernet or usb

Now it only support GWINSTE's GDS2000E series

Example

You can direct use known port and ip to create a new instance

var dsoDriver = require('./index.js');

// create a new instance and bind to ethernet interface with ip:172.16.5.68 and port:3000
var dsoCtrl=dsoDriver.DsoNet(3000,'172.16.5.68');

// connect to instrument , connect must be done before any operation.
dsoCtrl.connect().then(dsoCtrl.run);

Or you can browse which one you want to

var dsoDriver = require('./index.js');
var dsoCtrl, i, len ;


/*
 * .showNetDevice use mdsn to browse available device
 * @return (Array Object) [ { name, port, addr } , ...]
 */
var deviceList = dsoDriver.showNetDevice();
len = deviceList.length
for( i = 0; i < len; i += 1 ){
  if(deviceList[i].name === 'GDS2102E-01' ){
    dsoCtrl = deviceList.DsoNet( deviceList[i].port, deviceList[i].addr );
    break;
  }
}

if(dsoCtrl === undefined){
  console.log('GDS2000E not available');
  process.exit(1);
}

dsoCtrl.connect().then(dsoCtrl.run);

API

Show avaiable device

Find all instrument-dso service using mdns. When DSO socket server on, you can use showNetDevice() to count available DSO, and showNetDevice() will return an array object that store dso's name, port and ip like this

[ {name:'GDS2102E-01',port:'3000', addr:'172.16.5.111'}
 ,{name:'GDS2102E-02',port:'3000', addr:'172.16.5.112'} ]

Create new instance via Ethernet

Use DsoNet( port, address ) to create a new instance that contains many methods to control remote DSO via ethernet. Remote DSO has a port and ip address to identify it self, use unique port and ip address to pass to DsoNet() and DsoNet() will return an object to control that remote DSO

var dsoCtrl=dsoDriver.DsoNet(3000,'172.16.5.68');
console.log( dsoCtrl );

Create new instance via USB

You can use one of DsoNet() or dsoUSB() to create a new instance but can't use both.

Methods

When dsoCtrl object was created, you can use many methods to control device.

##.connect Connect to device, create a connection to the device, if return with no error, the other methods can be useed

// create a new instance and bind to ethernet interface with ip:172.16.5.68 and port:3000
var dsoCtrl=dsoDriver.DsoNet(3000,'172.16.5.68');

// connect to instrument , connect must be done before any operation.
dsoCtrl.connect()
  .then(dsoCtrl.run);

##.disconnect Disconnect from device, if nothing else to do, disconnect from the device.

  dsoCtrl.dsiconnect().then(dsoCtrl.closeDev);

##.syncConfig ##.enableCh Turn remote DSO's channel on

//turn channel 1 on
dsoCtrl.connect()
  .then(dsoCtrl.enableCh('ch1'));

##.disableCh Turn remote DSO's channel off

//turn channel 1 off
dsoCtrl.connect()
  .then(dsoCtrl.disableCh('ch1'));

##.getHorizontal Return current remote DSO's horizontal system setting

dsoCtrl.connect()
    .then(function(){
        dsoCtrl.getHorizontal()
            .then(function(res){
                console.log(res);
            });
    });

Console displayed infomation

 { temp: 0,
  position: '0.000E+00',
  zposition: '0.000E+00',
  scale: '1.000000e-04',
  zscale: '1.000E-05',
  mode: 'MAIN',
  expand: 'CENTER',
  prop: { get: [Function], set: [Function] } }

The meaning of the return object

  • temp: never mind
  • position: offset of the waveform trace in time axis
  • scale: a waveform trace can be cut into 10 block, the scale is the time of a block
  • zscale: never mind
  • mode: nerver mind
  • expand: never mind
  • prop: never mind

##.setHorizontal setHorizontal( hor ), setup remote DSO's horizontal system, hor is an object that include position,zposition,scale,zscale,mode,expand. Those parameter have some limitation.

You can pass parameter only you care

dsoCtrl.connect()
    .then(function(){
        dsoCtrl.setHorizontal({ position:'2.000E-04', scale:'2.0E-04'})
            .then(function(){
                console.log('done');
            })
            .catch(function(err){
                console.log('catch error: '+err);
            })
    })
    .then(dsoCtrl.stop)
    .catch(function(){
        console.log('dsoCtrl error');
    });

We set the position to 200us and set the scale to 200us setHor

##.getVertical Return current remote DSO's vertical system setting

dsoCtrl.connect()
    .then(function(){
        dsoCtrl.getVertical('ch1')
            .then(function(res){
                console.log(res)
            });
    })
    .catch(function(){
        console.log('dsoCtrl error');
    });

Console displayed infomation

{ coupling: 'DC',
  impedance: '1E+6',
  invert: 'OFF',
  bandwidth: 'FULL',
  expand: 'GND',
  state: 'ON',
  scale: '1.000E-01',
  position: '0.000E+00',
  deskew: '0.000e+00',
  rawdata: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 60 00 00 03 01 00 00 00 78 00 00 03 01 00 00 00 90 00 00 03 01 00 00 00 01 00 00 00 00 00 00 00 ff ff ... >,
  raw_state: '0',
  probe: { unit: 'VOLTAGE', atten: '1.000000e+00' },
  dataCount: 0,
  recCount: 0,
  id: 'ch1',
  prop: { get: [Function], set: [Function] } }

##.setVertical Setup remote DSO's vertical system ##.getEdgeTrig Retrun current remote DSO's edge trigger setting ##.setEdgeTrig Setup remote DSO's edge trigger ##.getSnaphot Return an RLE buffer that store screen data displayed on remote DSO

dsoCtrl.connect()
    .then(function(){
        dsoCtrl.getSnapshot()
            .then(function(res){
                console.log(res)
            });
    })
    .catch(function(){
        console.log('dsoCtrl error');
    });

##.getRawdata Return sampled value, each two int8 bytes encodes the vertical data of a data point, and store in big endian format ##.getMeas Return measurement value for selected measurement source ##.supportedMeasType Return suppoted measurement type ##.setMeas Setup measurement type for selected measurement source ##.statisticOn Turn statistic measure on for all measurement source ##.statisticOff Turn statistic measure off for all measurement source ##.statisticWeight Setup statistic weighting ##.run Turn remote DSO into run state ##.stop Turn remote DSO into stop state ##.single Turn remote DSO into single state ##.autoset Turn remote DSO into autoset state ##.force Turn remote DSO into force state ##.closeDev Close opened device

#Error Message You can use promise catch method to catch error message

dsoCtrl.connect()
    .then(function(){
        dsoCtrl.setHorizontal({ position:'-1E7',
                                scale:'2.0E-04'
                            })
            .then(function(){
                console.log('done');
            })
            .catch(function(err){
                console.log(err);
            })
    })

Console displayed information

[ '-500',
  '\'-1e+7\' argument does not accept, set to near one -5.000E+01\n' ]

Array[0] show error type

  • -100 : Parameter Error
  • -200 : Execution Error
  • -300 : Device-specific Error
  • -400 : Query Error
  • -500 : Parameter Not Accept

Array[1] show error message