cylon/lib/adaptor.js

46 lines
978 B
JavaScript
Raw Normal View History

2013-10-25 05:25:42 +08:00
/*
* adaptor
* cylonjs.com
*
* Copyright (c) 2013-2014 The Hybrid Group
2013-10-25 05:25:42 +08:00
* Licensed under the Apache 2.0 license.
*/
"use strict";
2013-10-25 05:25:42 +08:00
require('./basestar');
var namespace = require('node-namespace');
2013-10-25 05:25:42 +08:00
namespace("Cylon", function() {
this.Adaptor = (function(klass) {
subclass(Adaptor, klass);
2013-10-25 05:25:42 +08:00
function Adaptor(opts) {
if (opts == null) {
opts = {};
2013-11-12 00:28:37 +08:00
}
this.self = this;
this.name = opts.name;
this.connection = opts.connection;
this.commandList = [];
}
Adaptor.prototype.commands = function() {
return this.commandList;
};
Adaptor.prototype.connect = function(callback) {
Logger.info("Connecting to adaptor '" + this.name + "'...");
callback(null);
return this.connection.emit('connect');
};
Adaptor.prototype.disconnect = function() {
return Logger.info("Disconnecting from adaptor '" + this.name + "'...");
};
return Adaptor;
})(Cylon.Basestar);
});