Commit Graph

23 Commits

Author SHA1 Message Date
Andrew Stewart f3efa83643 Correct issue with Robot halting 2015-06-18 14:56:39 -07:00
Andrew Stewart 681e197ed9 Stop giving robots random names, use inc. counter 2015-06-09 11:50:50 -07:00
Andrew Stewart 8adacef282 s/source/lib for loading files for specs 2015-06-09 07:21:03 -07:00
Andrew Stewart 62cbae7cff Switch to ESLint for linting 2015-04-15 08:59:34 -07:00
Andrew Stewart a17c70a18b Bind passed function to Robot by default 2015-03-17 14:22:14 -07:00
Andrew Stewart cb492c0747 Remove deprecated Connection / Device syntaxes
Removes deprecation warnings + support for single-object + array
syntaxes.

The array syntax will likely continue to work due to the `_.each`
abstraction, but since we don't use it anywhere, the requisite specs
have been removed.
2015-03-04 09:27:33 -08:00
Andrew Stewart d56f9bc53f Add better error checking for Robot#halt 2015-01-21 08:56:13 -08:00
Andrew Stewart 754af3b4db Add test for Robot#log 2015-01-20 19:38:48 -08:00
Andrew Stewart 8065644b4e Add support for nested device details inside conn
e.g.
    connections: {
      loopback: {
        adaptor: "loopback",
        devices: {
          ping: { driver: "ping", pin: 1 }
        }
      }
    }

In the event of a name collision between the `devices` hash and a nested
device, the nested device will 'win'.
2015-01-07 10:21:51 -08:00
Andrew Stewart cf0d24f785 Add API event publication
This update gives Cylon support for the latest changes to the CPPP-IO
spec.
2015-01-05 12:20:53 -08:00
Andrew Stewart c9e16fe8c2 Use _.result to get commands from options. 2014-12-17 15:07:03 -08:00
Andrew Stewart 36d1505c2f Add specs for new #connections/#devices behaviour 2014-12-15 13:17:04 -08:00
Andrew Stewart e2bec78de7 Clean up specs for JSHint 2014-12-15 09:37:52 -08:00
Andrew Stewart 7f761c7268 WIP on cleaning up specs 2014-12-14 15:24:49 -08:00
Andrew Stewart 83153664f5 Remove deprecated syntax from robot spec 2014-11-26 09:42:09 -08:00
Andrew Stewart ca8e22f1e2 Fluent #device/#connection update
Now pass name, then object of details

    #device({ name: 'ping', driver: 'ping' });
    // vs
    #device('ping', { driver: 'ping' });
2014-11-26 09:33:19 -08:00
Andrew Stewart 15c9b96333 Extract out Connection/Device initialization
Simple extraction out of Connection/Device initialization code inside
Robot.

This yields an interesting boon, however - this is now a valid Cylon
program:

    var Cylon = require('cylon');

    Cylon
      .robot()
      .connection({ name: 'loopback', adaptor: 'loopback' })
      .device({ name: 'ping', driver: 'ping' })
      .on('ready', function(bot) {
        console.log("Bot working!");

        every(1000, function() {
          console.log(bot.ping.ping());
        })
      });

    Cylon.start();

For those that prefer imperative programs with Cylon, this is a nice
syntax addition.
2014-11-20 08:43:08 -08:00
Andrew Stewart ce87a355f0 Modifications, fix test suite 2014-11-11 11:41:23 -08:00
Andrew Stewart f1b982fedd Support providing connections/devices as an object
Before:

  connections: [
    { name: 'loopback', adaptor: 'loopback', port: 13 }
  ],

Now:

  connections: {
    loopback: { adaptor: 'loopback', port: 13 }
  }

Array syntax still works, but has been marked as deprecated.
2014-11-10 10:52:55 -08:00
Andrew Stewart 1c922f02c1 Address bugs w/ connections 2014-10-31 13:48:05 -07:00
Andrew Stewart 44075a1a30 Hook Repository class up, change-up module loading
Cylon modules were previously styled something like this:

    module.exports = {
      adaptor: function(args) {
        return new Adaptor(args);
      },

      register: function(robot) {
        Cylon.Logger.debug("Registering Firmata adaptor for " + robot.name);
        robot.registerAdaptor('cylon-firmata', 'firmata');

        GPIO.register(robot);
        I2C.register(robot);
      }
    };

Now, they should be something more like this:

    module.exports = {
      adaptors: ['firmata'],
      dependencies: ['cylon-gpio', 'cylon-i2c'],

      adaptor: function(args) {
        return new Adaptor(args);
      },
    };
2014-10-30 13:29:06 -07:00
Andrew Stewart a8b16a3469 Proxy all opts that aren't already used internally 2014-10-27 13:40:38 -07:00
Andrew Stewart bd95f9eb3c Reorganize tests, under 'spec' directory now 2014-10-20 14:55:25 -07:00