lib/swarm.js
function(options) {
  this.ble = noble;

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

  this.targets = membership || options.membership;

  this.peripherals = [];
  this.members = [];
  this.timeout = (options.timeout || 30) * 1000; // in seconds

  //define membership
  if (this.targets && !util.isArray(this.targets)) {
    this.targets = this.targets.split(',');
  } else {
    this.targets = [];
  }

  this.logger = options.logger || debug; //use debug instead of console.log
  this.discovering = false;

  this.active = false;

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

  return this;
}
function(options) {
  this.ble = noble;

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

  this.targets = membership || options.membership;

  this.peripherals = [];
  this.members = [];
  this.timeout = (options.timeout || 30) * 1000; // in seconds

  //define membership
  if (this.targets && !util.isArray(this.targets)) {
    this.targets = this.targets.split(',');
  } else {
    this.targets = [];
  }

  this.logger = options.logger || debug; //use debug instead of console.log
  this.discovering = false;

  this.active = false;

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

  return this;
}
function ( options ) { this . ble = noble ; var membership = ( typeof options === 'string' ? options : undefined ) ; options = options || { } ; this . targets = membership || options . membership ; this . peripherals = [ ] ; this . members = [ ] ; this . timeout = ( options . timeout || 30 ) * 1000 ; // in seconds //define membership if ( this . targets && ! util . isArray ( this . targets ) ) { this . targets = this . targets . split ( ',' ) ; } else { this . targets = [ ] ; } this . logger = options . logger || debug ; //use debug instead of console.log this . discovering = false ; this . active = false ; // handle disconnect gracefully this . ble . on ( 'warning' , function ( message ) { this . onDisconnect ( ) ; } . bind ( this ) ) ; return this ; }
Constructs a new RollingSpider Swarm

@param {Object} options to construct the drone with:
- {String} A comma seperated list (as a string) of UUIDs or names to connect to. This could also be an array of the same items.  If this is omitted then it will add any device with the manufacturer data value for Parrot..
- logger function to call if/when errors occur. If omitted then uses console#log
@constructor
Constructs a new RollingSpider Swarm