lib/drone.js
function(options) {
  EventEmitter.call(this);

  var uuid = (typeof options === 'string' ? options : undefined);
  options = options || {};

  this.uuid = null;
  this.targets = uuid || options.uuid;

  if (this.targets && !util.isArray(this.targets)) {
    this.targets = this.targets.split(',');
  }

  this.logger = options.logger || debug; //use debug instead of console.log
  this.forceConnect = options.forceConnect || false;
  this.connected = false;
  this.discovered = false;
  this.ble = noble;
  this.peripheral = null;
  this.takenOff = false;

  this.driveStepsRemaining = 0;
  this.speeds = {
    yaw: 0, // turn
    pitch: 0, // forward/backward
    roll: 0, // left/right
    altitude: 0 // up/down
  };

  /**
   * Used to store the 'counter' that's sent to each characteristic
   */
  this.steps = {
    'fa0a': 0,
    'fa0b': 0,
    'fa0c': 0
  };

  this.status = {
    stateValue: 0,
    flying: false,
    battery: 100
  };


  // handle disconnect gracefully
  this.ble.on('warning', function(message) {
    this.onDisconnect();
  }.bind(this));
}
function(options) {
  EventEmitter.call(this);

  var uuid = (typeof options === 'string' ? options : undefined);
  options = options || {};

  this.uuid = null;
  this.targets = uuid || options.uuid;

  if (this.targets && !util.isArray(this.targets)) {
    this.targets = this.targets.split(',');
  }

  this.logger = options.logger || debug; //use debug instead of console.log
  this.forceConnect = options.forceConnect || false;
  this.connected = false;
  this.discovered = false;
  this.ble = noble;
  this.peripheral = null;
  this.takenOff = false;

  this.driveStepsRemaining = 0;
  this.speeds = {
    yaw: 0, // turn
    pitch: 0, // forward/backward
    roll: 0, // left/right
    altitude: 0 // up/down
  };

  /**
   * Used to store the 'counter' that's sent to each characteristic
   */
  this.steps = {
    'fa0a': 0,
    'fa0b': 0,
    'fa0c': 0
  };

  this.status = {
    stateValue: 0,
    flying: false,
    battery: 100
  };


  // handle disconnect gracefully
  this.ble.on('warning', function(message) {
    this.onDisconnect();
  }.bind(this));
}
function ( options ) { EventEmitter . call ( this ) ; var uuid = ( typeof options === 'string' ? options : undefined ) ; options = options || { } ; this . uuid = null ; this . targets = uuid || options . uuid ; if ( this . targets && ! util . isArray ( this . targets ) ) { this . targets = this . targets . split ( ',' ) ; } this . logger = options . logger || debug ; //use debug instead of console.log this . forceConnect = options . forceConnect || false ; this . connected = false ; this . discovered = false ; this . ble = noble ; this . peripheral = null ; this . takenOff = false ; this . driveStepsRemaining = 0 ; this . speeds = { yaw : 0 , // turn pitch : 0 , // forward/backward roll : 0 , // left/right altitude : 0 // up/down } ; /**
   * Used to store the 'counter' that's sent to each characteristic
   */ this . steps = { 'fa0a' : 0 , 'fa0b' : 0 , 'fa0c' : 0 } ; this . status = { stateValue : 0 , flying : false , battery : 100 } ; // handle disconnect gracefully this . ble . on ( 'warning' , function ( message ) { this . onDisconnect ( ) ; } . bind ( this ) ) ; }
Constructs a new RollingSpider

@param {Object} options to construct the drone with:
- {String} uuid to connect to. If this is omitted then it will connect to the first device starting with 'RS_' as the local name.
- logger function to call if/when errors occur. If omitted then uses console#log
@constructor
Constructs a new RollingSpider