diff --git a/dist/adaptor.js b/dist/adaptor.js index 52cef10..08d0017 100644 --- a/dist/adaptor.js +++ b/dist/adaptor.js @@ -15,6 +15,8 @@ namespace = require('node-namespace'); + require('./basestar'); + namespace('Cylon.Adaptors', function() { return this.Adaptor = (function(_super) { __extends(Adaptor, _super); @@ -44,6 +46,4 @@ })(Cylon.Basestar); }); - module.exports = Cylon.Adaptors.Adaptor; - }).call(this); diff --git a/dist/cylon.js b/dist/cylon.js index e9715e0..cb450f8 100644 --- a/dist/cylon.js +++ b/dist/cylon.js @@ -19,6 +19,10 @@ require('./api'); + require('./driver'); + + require('./adaptor'); + Logger.setup(); Cylon = (function() { diff --git a/dist/driver.js b/dist/driver.js index ec9595e..fc97e50 100644 --- a/dist/driver.js +++ b/dist/driver.js @@ -15,6 +15,8 @@ namespace = require('node-namespace'); + require('./basestar'); + namespace('Cylon.Drivers', function() { return this.Driver = (function(_super) { __extends(Driver, _super); @@ -25,8 +27,11 @@ this.device = opts.device; } - Driver.prototype.start = function() { - return Logger.info("Driver " + this.name + " started"); + Driver.prototype.start = function(callback) { + Logger.info("Driver " + this.name + " started"); + callback(null); + this.device.emit('start'); + return true; }; Driver.prototype.stop = function() { @@ -42,6 +47,4 @@ })(Cylon.Basestar); }); - module.exports = Cylon.Drivers.Driver; - }).call(this); diff --git a/dist/test/loopback.js b/dist/test/loopback.js index aed3538..c73acb7 100644 --- a/dist/test/loopback.js +++ b/dist/test/loopback.js @@ -29,13 +29,11 @@ }; namespace('Cylon.Adaptors', function() { - var _ref; return this.Loopback = (function(_super) { __extends(Loopback, _super); - function Loopback() { - _ref = Loopback.__super__.constructor.apply(this, arguments); - return _ref; + function Loopback(opts) { + Loopback.__super__.constructor.apply(this, arguments); } Loopback.prototype.commands = function() { @@ -44,7 +42,7 @@ return Loopback; - })(this.Adaptor); + })(Cylon.Adaptors.Adaptor); }); }).call(this); diff --git a/dist/test/ping.js b/dist/test/ping.js index 3968f30..c3ae9f7 100644 --- a/dist/test/ping.js +++ b/dist/test/ping.js @@ -29,13 +29,11 @@ }; namespace('Cylon.Drivers', function() { - var _ref; return this.Ping = (function(_super) { __extends(Ping, _super); - function Ping() { - _ref = Ping.__super__.constructor.apply(this, arguments); - return _ref; + function Ping(opts) { + Ping.__super__.constructor.apply(this, arguments); } Ping.prototype.commands = function() { @@ -48,7 +46,7 @@ return Ping; - })(this.Driver); + })(Cylon.Drivers.Driver); }); }).call(this); diff --git a/package.json b/package.json index 57e3c50..7ef24d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cylon", - "version": "0.7.0", + "version": "0.8.0", "main": "dist/cylon.js", "description": "A JavaScript robotics framework using Node.js", "homepage": "http://cylonjs.com", diff --git a/src/adaptor.coffee b/src/adaptor.coffee index df6ca0f..1bdf8ff 100644 --- a/src/adaptor.coffee +++ b/src/adaptor.coffee @@ -10,6 +10,8 @@ namespace = require 'node-namespace' +require './basestar' + namespace 'Cylon.Adaptors', -> class @Adaptor extends Cylon.Basestar constructor: (opts) -> @@ -28,4 +30,4 @@ namespace 'Cylon.Adaptors', -> disconnect: -> Logger.info "Disconnecting from adaptor '#{@name}'..." -module.exports = Cylon.Adaptors.Adaptor +#module.exports = Cylon.Adaptor diff --git a/src/cylon.coffee b/src/cylon.coffee index a874b77..2e5caf0 100644 --- a/src/cylon.coffee +++ b/src/cylon.coffee @@ -11,6 +11,8 @@ require './utils' require './logger' require './api' +require './driver' +require './adaptor' Logger.setup() diff --git a/src/driver.coffee b/src/driver.coffee index 16b7e5f..1dca710 100644 --- a/src/driver.coffee +++ b/src/driver.coffee @@ -10,6 +10,8 @@ namespace = require 'node-namespace' +require './basestar' + namespace 'Cylon.Drivers', -> class @Driver extends Cylon.Basestar constructor: (opts) -> @@ -17,8 +19,11 @@ namespace 'Cylon.Drivers', -> @name = opts.name @device = opts.device - start: -> + start: (callback) -> Logger.info "Driver #{@name} started" + (callback)(null) + @device.emit 'start' + true stop: -> Logger.info "Driver #{@name} stopped" @@ -26,4 +31,4 @@ namespace 'Cylon.Drivers', -> commands: -> [] -module.exports = Cylon.Drivers.Driver +#module.exports = Cylon.Driver diff --git a/src/test/loopback.coffee b/src/test/loopback.coffee index c43af0b..bec7730 100644 --- a/src/test/loopback.coffee +++ b/src/test/loopback.coffee @@ -15,6 +15,9 @@ module.exports = new Cylon.Adaptors.Loopback(args...) namespace 'Cylon.Adaptors', -> - class @Loopback extends @Adaptor + class @Loopback extends Cylon.Adaptors.Adaptor + constructor: (opts) -> + super + commands: -> ['ping'] diff --git a/src/test/ping.coffee b/src/test/ping.coffee index 5be902e..21e483b 100644 --- a/src/test/ping.coffee +++ b/src/test/ping.coffee @@ -15,7 +15,10 @@ module.exports = new Cylon.Drivers.Ping(args...) namespace 'Cylon.Drivers', -> - class @Ping extends @Driver + class @Ping extends Cylon.Drivers.Driver + constructor: (opts) -> + super + commands: -> ['ping']