Commit Graph

96 Commits

Author SHA1 Message Date
Andrew Stewart bad414be39 Correctly avoid labelling 'work' as a command 2014-08-07 14:00:30 -07:00
Andrew Stewart e6c567a090 Add new command structure 2014-08-07 12:24:29 -07:00
Andrew Stewart 026d3777e6 Simplify coercion of Robot to JSON 2014-07-29 18:49:35 -07:00
Ron Evans 8762820d0c Merge pull request #213 from hybridgroup/refactor/threepio
Threepio Support
2014-07-19 01:08:19 +02:00
Andrew Stewart d7987f959e Fix typo 2014-07-15 11:54:16 -07:00
Adrian Zankich 0184efb4cd Merge pull request #211 from hybridgroup/fix/require-connection
Require a connection if a robot has any devices
2014-07-14 07:57:20 -10:00
Andrew Stewart 1c8e84cfb2 Clean up robot initialization 2014-07-12 10:48:57 -07:00
Andrew Stewart 4dd7e013ed Require a connection if a robot has any devices 2014-07-11 10:46:22 -07:00
Andrew Stewart f0d8b0360b Remove `self` references in favor of #bind 2014-07-03 09:35:24 -07:00
Andrew Stewart 5acfd4aed4 Remove Utils#bind in preference of built-in fn
We were re-implementing Function.prototype.bind, so let's just use that.
2014-06-17 19:35:07 -07:00
Andrew Stewart 6de922f2fc Make halting on SIGINT async
This change gives adaptors/drivers more flexibility in halting. Additionally,
now, by default, all Adaptors/Drivers will remove all their event listeners
before halting, which should prevent some additional commands from being sent to
the adaptor during shutdown.
2014-06-12 15:31:49 -07:00
Andrew Stewart 9c60700c0f Clean up declaration of default work block 2014-06-10 18:38:55 -07:00
Andrew Stewart b66a1d3fee Remove unused param for #start callback 2014-06-10 18:38:00 -07:00
Andrew Stewart 594c73dc60 Declare missingModuleError before it's used 2014-06-10 18:37:19 -07:00
Andrew Stewart 1832e20e17 Expose commands as array, instead of function
For appropriate classes, #commands is now an array, instead of a function that
returns the same array.
2014-06-10 12:29:44 -07:00
Andrew Stewart 3672a1b712 General cleanup of single-line statements 2014-06-09 14:02:06 -07:00
Andrew Stewart dd553a55f2 Clean up #start to use Async.series 2014-06-09 13:55:44 -07:00
Andrew Stewart 4e43483e9d Slightly refactor constructor 2014-06-09 13:41:46 -07:00
Andrew Stewart dbde3d5b7d Remove circular reference from Robot 2014-06-09 13:24:42 -07:00
Ron Evans 3717c4dc31 Merge pull request #195 from hybridgroup/refactor/robots-collection
Refactor Robots collection
2014-06-06 18:36:19 -04:00
Andrew Stewart ebdeeccd12 Use implicit object conversion with #toJSON
JSON.stringify, if told to convert an object with a #toJSON method, will instead
stringify the result of the #toJSON method.
2014-06-06 14:15:43 -07:00
Andrew Stewart 81fa260963 Store robots in an dict, rather than array
Also removes the find{Robot,RobotConnection,RobotDevice} methods. Additionally,
stops passing the Master through to the Robot constructor, we can just
require('./cylon') if we need to access anything in there.
2014-06-06 11:36:22 -07:00
Andrew Stewart f91dd7d5c3 Refactor Utils (mostly) out of global namespace
This commit reframes the Utils module to be more self-contained, and now only
the Number prototype methods and the every/after/constantly methods are exposed
globally.

I'm unsure about whether these methods can be more scoped such that people can
turn them off if they want, but that's potentially something to look into in the
future.

This commit also updates most of the other source files in Cylon, requiring the
Utils module rather than assuming the methods are in the global namespace.

A similar batch of commits will need to be made for all other Cylon modules to
make sure they don't explode when they can't find #subclass or something like
that.

To make the previously-global methods available, both in submodules and for
people looking for them, all the utility functions are exported in Cylon.Utils.
2014-06-05 12:17:29 -07:00
Andrew Stewart a5241e57b5 All work and no play makes Jack a dull boy
Robots can now take a break and have #play functions instead of #work.
Internally they're treated the same, but it's a fun easter egg!

Example:

Cylon.robot({
  name: 'Jack',

  connections: [],
  devices: [],

  play: function play(my) {
    every((5).seconds(), function() {
      console.log("All work and no play makes %s a dull boy.", my.name);
    });
  }
});

I sincerely apologize for the repeated reference to The Shining, blame
@deadprogram.

Closes #189.
2014-06-04 16:33:20 -07:00
deadprogram 69cc76b6a6 Ability to pass the name of module to use for an adaptor. Specifically for case where a module contains multiple adaptors 2014-05-23 18:42:29 -07:00
Andrew Stewart c22ef95239 Remove Logger from global namespace 2014-05-13 19:44:40 -07:00
Andrew Stewart c99ce6571f Remove node-namespace from DigitalPin 2014-05-13 18:31:25 -07:00
Andrew Stewart 17a0a5d08f Remove node-namespace from Config 2014-05-13 18:14:36 -07:00
Andrew Stewart f20ae55bf6 Remove node-namespace from Robot 2014-05-08 08:57:20 -07:00
Andrew Stewart 7bab3ff65f Remove node-namespace from Connection 2014-05-07 08:38:06 -07:00
Andrew Stewart f8e546a6e0 Remove node-namespace from Device 2014-05-06 19:18:13 -07:00
edgarsilva de360ba2b3 Add error handler for devices that fail to initialize.
Do not start work if devices fail to initialize and throw err insted.
2014-04-01 17:53:34 -06:00
Andrew Stewart 2563e62de4 Catch MODULE_NOT_FOUND errors, throw others 2014-04-01 10:30:14 -07:00
Andrew Stewart 337074f34f Add friendlier errors when no adaptor/driver found 2014-03-26 14:32:52 -07:00
Andrew Stewart f9537d9af8 Rename #stop to #halt to avoid potential conflicts 2014-03-11 10:44:11 -07:00
Andrew Stewart c0c4ce6958 Small changes to appease JSHint 2014-03-07 23:33:59 -08:00
Andrew Stewart d8de60a02d Clean up var declarations in robot.js 2014-03-03 14:33:29 -08:00
Andrew Stewart ef3aaf6591 Clean up initialization methods for adaptors/drivers 2014-02-28 20:50:45 -08:00
Andrew Stewart 5650ce1d60 Clean up starter and #stop functions 2014-02-28 20:37:23 -08:00
Andrew Stewart 862a3702b7 Refactor device/connection initialization methods 2014-02-28 20:30:12 -08:00
Andrew Stewart 89baebd3c1 Refactor #data method 2014-02-28 12:22:32 -08:00
Andrew Stewart 1ee35f1487 Clean up constructor 2014-02-28 12:13:19 -08:00
Andrew Stewart cdd3f3310a Remove trailing whitespace 2014-02-27 17:39:02 -08:00
xixebombilla 8644399276 210 comments JS 2014-02-27 16:42:33 -06:00
deadprogram 452f07d4ab Refactor port & robot to pure JS style 2014-02-27 11:17:02 -08:00
deadprogram b27756abfc WIP on pure JS revamp 2014-02-27 06:44:53 -08:00