2013-10-25 05:25:42 +08:00
|
|
|
/*
|
|
|
|
* adaptor
|
|
|
|
* cylonjs.com
|
|
|
|
*
|
2014-02-28 01:38:38 +08:00
|
|
|
* Copyright (c) 2013-2014 The Hybrid Group
|
2013-10-25 05:25:42 +08:00
|
|
|
* Licensed under the Apache 2.0 license.
|
|
|
|
*/
|
|
|
|
|
2014-02-28 01:38:38 +08:00
|
|
|
"use strict";
|
2013-10-25 05:25:42 +08:00
|
|
|
|
2014-02-28 01:38:38 +08:00
|
|
|
require('./basestar');
|
|
|
|
var namespace = require('node-namespace');
|
2013-10-25 05:25:42 +08:00
|
|
|
|
2014-02-28 01:38:38 +08:00
|
|
|
namespace("Cylon", function() {
|
|
|
|
this.Adaptor = (function(klass) {
|
|
|
|
subclass(Adaptor, klass);
|
2013-10-25 05:25:42 +08:00
|
|
|
|
2014-02-28 01:38:38 +08:00
|
|
|
function Adaptor(opts) {
|
|
|
|
if (opts == null) {
|
|
|
|
opts = {};
|
2013-11-12 00:28:37 +08:00
|
|
|
}
|
2014-02-28 01:38:38 +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);
|
|
|
|
});
|