Merge pull request #128 from hybridgroup/add-stop-to-connection

Add a stop function to the base connection class.
This commit is contained in:
Ron Evans 2014-03-04 08:48:04 -08:00
commit d702d1077a
1 changed files with 13 additions and 0 deletions

View File

@ -102,6 +102,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);