From 3d4ccfb1735d6ec1178ddb77cfde4a0516e6bc48 Mon Sep 17 00:00:00 2001 From: edgarsilva Date: Fri, 14 Feb 2014 13:00:12 -0600 Subject: [PATCH] Added new 'cylon bluetooth scan' command. --- bin/cylon | 14 +++++++++----- dist/cli/bluetooth.js | 7 ++++++- dist/cli/cli-commands.js | 3 ++- src/cli/bluetooth.coffee | 4 ++++ src/cli/cli-commands.coffee | 1 + 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/bin/cylon b/bin/cylon index f340a49..944491d 100755 --- a/bin/cylon +++ b/bin/cylon @@ -22,8 +22,8 @@ Program }); Program - .command("bluetooth
[option]") - .description("Connect bluetooth device to PC (pairs) or establishes serial to bluetooth connection") + .command("bluetooth [address] [option]") + .description("Scan, pair, unpair bluetooth devices to/from the PC, establishes serial to bluetooth connection. Try 'cylon bluetooth help'") .action(function(subcmd, address, option){ switch(subcmd){ case 'pair': @@ -38,11 +38,15 @@ Program option = (option === null || option === undefined) ? '/dev/rfcomm0' : option; CliCommands.connectToSerial(option, address); break; + case 'scan': + CliCommands.bluetooth.scan(); + break; default: console.log("cylon bluetooth argument not recognized, try:\n"); - console.log("1.- cylon bluetooth pair
[hciX]"); - console.log("2.- cylon bluetooth unpair
[hciX]"); - console.log("3.- cylon bluetooth connect
[dev]\n"); + console.log("1.- cylon bluetooth scan"); + console.log("2.- cylon bluetooth pair
[hciX]"); + console.log("3.- cylon bluetooth unpair
[hciX]"); + console.log("4.- cylon bluetooth connect
[dev]\n"); } }); diff --git a/dist/cli/bluetooth.js b/dist/cli/bluetooth.js index e629cc2..d019ead 100644 --- a/dist/cli/bluetooth.js +++ b/dist/cli/bluetooth.js @@ -1,8 +1,10 @@ (function() { - var bluetooth, os; + var bluetooth, os, scan; require("./process"); + scan = require("./scan"); + os = require('os'); bluetooth = { @@ -31,6 +33,9 @@ default: return console.log("OS not yet supported."); } + }, + scan: function() { + return scan('bluetooth'); } }; diff --git a/dist/cli/cli-commands.js b/dist/cli/cli-commands.js index 9a56028..194104f 100644 --- a/dist/cli/cli-commands.js +++ b/dist/cli/cli-commands.js @@ -12,7 +12,8 @@ connectToSerial: connectToSerial, bluetooth: { pair: bluetooth.pair, - unpair: bluetooth.unpair + unpair: bluetooth.unpair, + scan: bluetooth.scan } }; diff --git a/src/cli/bluetooth.coffee b/src/cli/bluetooth.coffee index f1a3202..626261c 100644 --- a/src/cli/bluetooth.coffee +++ b/src/cli/bluetooth.coffee @@ -1,4 +1,5 @@ require "./process" +scan = require "./scan" os = require('os') bluetooth = @@ -30,4 +31,7 @@ bluetooth = else console.log "OS not yet supported." + scan: () -> + scan('bluetooth') + module.exports = bluetooth diff --git a/src/cli/cli-commands.coffee b/src/cli/cli-commands.coffee index 3cfef4f..a0996f0 100644 --- a/src/cli/cli-commands.coffee +++ b/src/cli/cli-commands.coffee @@ -8,5 +8,6 @@ cliCommands = bluetooth: pair: bluetooth.pair unpair: bluetooth.unpair + scan: bluetooth.scan module.exports = cliCommands