Add a stop function to the base connection class.

This commit is contained in:
edgarsilva 2014-03-04 10:45:19 -06:00
parent 1de8ef594d
commit d54c9419af
1 changed files with 13 additions and 0 deletions

View File

@ -101,6 +101,19 @@ namespace("Cylon", function() {
return this.robot.initAdaptor(opts.adaptor, this.self, opts);
};
// Public: Stop the adaptor's connection
//
// Returns nothing
Connection.prototype.stop = function() {
var msg;
msg = "Stopping adaptor '" + this.name + "'";
if (this.port != null) {
msg += " on port '" + (this.port.toString()) + "'";
}
Logger.info(msg);
return this.disconnect();
};
return Connection;
})(EventEmitter);