hybridgroup/cylon — pull request #239 by stewart (2014-11-11 21:42:33+00:00)
Title: Remove Connection and Device classes

This PR removes the Connection and Device classes.

Instead, they are now replaced with Connection and Device functions, that return a specific Adaptor/Driver respectively.

This eliminates the 'buffer' issues resulting from having an intermediate class between the Robot and the hardware it's communicating with.

I've tested this setup with modified versions of `cylon-leapmotion` and `cylon-firmata`, and all seems to work in use.

The module refactors for this changeset is a bit more involved, but there are some simple rules to describe the changes:

- in Adaptor subclasses, where you would refer to `this.connection`, now refer to `this`.
- in Driver subclasses, where you would refer to `this.connection`, now refer to `this.adaptor`.
- in Driver subclasses, where you would refer to `this.device`, now refer to `this`.

The utility functions on Basestar (proxying methods) have been updated for these changes, as have the appropriate API methods.

The Device and Connection functions currently share enough common code that they can possibly be merged at some point.