cylon/dist/cli/connect-to-serial.js

25 lines
561 B
JavaScript
Raw Normal View History

(function() {
var connectToSerial, os;
2014-02-05 03:31:17 +08:00
require("./process");
os = require('os');
connectToSerial = function(dev, address) {
2014-02-05 05:38:29 +08:00
var platform, process;
process = new Cylon.Process;
platform = os.platform();
switch (platform) {
case 'linux':
2014-02-05 05:38:29 +08:00
return process.spawn('sudo', ['rfcomm', 'connect', dev, address, '1']);
case 'darwin':
2014-02-05 05:38:29 +08:00
return console.log("OS X manages binding itself.");
default:
2014-02-05 05:38:29 +08:00
return console.log("OS not yet supported");
}
};
module.exports = connectToSerial;
}).call(this);