var visaPort = require("./build/visaport/v0.0.0/Release/node-v11-win32-x64/visaport");

var parsers = require('./parsers');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var fs = require('fs');
var stream = require('stream');
var path = require('path');

// console.log(visaPort);

console.log('---------');

/*
visaPort.list(function (err, ports) {
	if (err) {
		console.log(err);
	} else {
	  ports.forEach(function(port) {
		console.log(port.path + " " + port.idn);
	  });
	}
}); */

visaPort.open("USB0::0x1AB1::0x04B0::DS2A152801724::INSTR", function (err) {
	if (err) {
		console.log("ERROR:");
		console.log(err);
	}else {
	  console.log("opened");
		visaPort.query("*IDN?", function (err, result) {
			if (err) {
				console.log(err);
			} else {
			  console.log(result);
			}
		}); 
		visaPort.write(1, new Buffer(buffer), function(err, results) {
		  console.log('err ' + err);
		  console.log('results ' + results);
		});
	}
});



console.log('End');
var visaPort = require("./build/visaport/v0.0.0/Release/node-v11-win32-x64/visaport");

var parsers = require('./parsers');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var fs = require('fs');
var stream = require('stream');
var path = require('path');

// console.log(visaPort);

console.log('---------');

/*
visaPort.list(function (err, ports) {
	if (err) {
		console.log(err);
	} else {
	  ports.forEach(function(port) {
		console.log(port.path + " " + port.idn);
	  });
	}
}); */

visaPort.open("USB0::0x1AB1::0x04B0::DS2A152801724::INSTR", function (err) {
	if (err) {
		console.log("ERROR:");
		console.log(err);
	} else {
	    console.log("opened");
		visaPort.query("*IDN?", function (err, result) {
			if (err) {
				console.log(err);
			} else {
			  console.log(result);
			}
		}); /*
		visaPort.write(1, new Buffer(buffer), function(err, results) {
		  console.log('err ' + err);
		  console.log('results ' + results);
		});*/
	}
});



console.log('End');
work on query