/** * * User: Martin Donnelly * Date: 2016-07-06 * Time: 13:37 * */ var spawn = require('child_process').spawn; var EventEmitter = require('events'); var busEmitter = new EventEmitter(); var util = require('util'); var logger = require('log4js').getLogger(); var bluetest = module.exports = function(options) { 'use strict'; var core = {}; core.init = function(options) { var _mac; var tool_path = ''; var hcidev = 'hvi0'; //if () if (typeof options.mac !== 'undefined') { _mac = options.mac; } else{ console.log('You need to pass a mac address.'); process.exit(1); } logger.info('Working with:' , options); var hciconfig = spawn(tool_path + 'hciconfig', [hcidev, 'up']); hciconfig.on('exit', function(code) { logger.debug('code',code); }); }; core.init(options); }; util.inherits(bluetest, EventEmitter);