diff --git a/lib/index.js b/lib/index.js index 0b5cd37..912e9ac 100644 --- a/lib/index.js +++ b/lib/index.js @@ -29,7 +29,7 @@ var bluetest = module.exports = function(options) { core.connectGatt = function() { logger.info('trying to connect using gatttool'); - var gatt = fork('gatttool',['-I']); + var gatt = spawn('gatttool',['-I']); var cStr; gatt.on('error', function(err) { logger.error(err); @@ -40,8 +40,8 @@ var bluetest = module.exports = function(options) { }); logger.info('Trying to connect to ', core.mac); - cStr = 'connect ' + core.mac; - gatt.send(cStr); + cStr = 'connect ' + core.mac + '\n'; + gatt.stdin.write(cStr); }; core.init = function(options) {