New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

evolution-drone

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

evolution-drone

evolution-drone is a node JS library for interfacing with Evolution Controller's Drone gamepad

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

evolution-drone

evolution-drone is a node JS library for interfacing with Evolution Controller's Drone gamepad.

This library provides a basic DeviceManager that continuously scans for Drone devices. Once a device is detected, an event will be dispatched that contains the new Device instance. You can then use this instance to connect to the Drone controller.

After you connect to a Device, that instance will then emit DeviceDataEvents that contain details of how the controller is being used.

This library is a work in progress and a side hobby of mine. If you have interest in contributing or specific requests, please feel free to open up an issue on github and I will get back to you.

Latest Version 0.0.3

NOTE: This documentation is still being written. If you click on a link and it doesn't go anywhere, it's likely because that portion of the docs hasn't been written yet. If there are parts of the docs you'd like us to focus on, feel free to ask!

Quick Examples

Using DeviceManager

var evolution  = require('evolution-drone');

var DeviceManager   = evolution.DeviceManager;

var myDeviceManager = new DeviceManager();
myDeviceManager.addEventListener(DeviceManager.EventTypes.DEVICE_DETECTED, function(event) {
    var device = event.getData().device;

    // Use device!
});

myDeviceManager.addEventListener(DeviceManager.EventTypes.DEVICE_LOST, function(event) {
    var device = event.getData().device;

    // Device was lost, do what you must....
});

myDeviceManager.startScanningForDevices();

Connecting to a Device and listening for DeviceDataEvents

var evolution       = require('evolution-drone');
var DeviceDataEvent = evolution.DeviceDataEvent;
var DeviceManager   = evolution.DeviceManager;


var myDeviceManager = new DeviceManager();
myDeviceManager.addEventListener(DeviceManager.EventTypes.DEVICE_DETECTED, function(event) {
    var device = event.getData().device;
    device.addEventListener(DeviceDataEvent.EventTypes.DATA, function(event) {
        console.log(event.getData());
    });
    device.connectToDevice();
});
myDeviceManager.startScanningForDevices();

Dependencies

evolution-drone is dependent upon the following libraries

Download Source

The source is available for download from GitHub

Install

For node js, you can install using Node Package Manager npm

npm install evolution-drone

Usage

In node js:

npm will install the bugcore, bugpack, and node-hide dependencies

var drone = require('evolution-drone');


Documentation

Classes


Device

Class used to represent a detected Drone device.

Class

/**
 * @class
 * @extends {EventDispatcher}
 */
var Device = Class.extend(EventDispatcher, {

    _name: "evolution.Device",

View code

Extends

Constructor Summary

AccessSignature
constructorDevice({{interface: number, manufacturer: string, path: string, product: string, productId: string, release: number, serialNumber: string, vendorId: string}} hidDevice)

Getters and Setters Summary

AccessSignatureReturn Type
publicgetConnected(){boolean}
publicgetConnection(){DeviceConnection}
publicsetConnection({DeviceConnection} deviceConnection)None
publicgetInterface(){number}
publicgetManufacturer(){string}
publicgetPath(){string}
publicgetProduct(){string}
publicgetProductId(){string}
publicgetRelease(){number}
publicgetSerialNumber(){string}
publicgetVendorId(){string}

Method Summary

AccessSignatureReturn Type
publicconnectToDevice()None
publicdisconnectFromDevice()None

------------------------------------------------------------------------------------
### Device(hidDevice)

The constructor for a Device

Method

/**
 * @constructs
 * @param {{
 *      interface: number,
 *      manufacturer: string,
 *      path: string,
 *      product: string,
 *      productId: string,
 *      release: number,
 *      serialNumber: string,
 *      vendorId: string
 * }} hidDevice
 */
_constructor: function(hidDevice) {

Parameters

NameTypeDescription
hidDevice{{interface: number, manufacturer: string, path: string, product: string, productId: string, release: number, serialNumber: string, vendorId: string}}The hid device that was output by node-hid

Examples

Instantiating a Device using node-hid

var hid         = require('node-hid');
var devices     = hid.devices();
var myDevice    = new Device(devices[0]);

------------------------------------------------------------------------------------
### Device#getConnected()

Get whether or not a connection is open with this Device

Method

/**
 * @return {boolean}
 */
getConnected: function() {

Parameters

  • None

Returns

  • {boolean} - Whether or not a connection is open with the Device.

Examples

var myDevice    = new Device(devices[0]);
myDevice.getConnected();    // false, Devices do not automatically have a connection open when they're detected.

------------------------------------------------------------------------------------
### Device#getConnection()

Get the connection open with this Device, if one has been opened.

Method

/**
 * @return {DeviceConnection}
 */
getConnection: function() {

Parameters

  • None

Returns

  • {DeviceConnection} - The connection open with this Device.

Examples

Device does not have a connection when it is instantiated

var device = new Device();
device.getConnection();         // null

Device does not have a connection when it is first detected

myDeviceManager.addEventListener(DeviceManager.EventTypes.DEVICE_DETECTED, function(event) {
    var device = event.getData().device;
    device.getConnection()      // null
});

Device has connection after connectToDevice is called

myDeviceManager.addEventListener(DeviceManager.EventTypes.DEVICE_DETECTED, function(event) {
    var device = event.getData().device;
    device.connectToDevice();
    device.getConnection()      // {DeviceConnection}
});


DeviceConnection

Class used to represent a connection to a Drone device.

Class

/**
 * @class
 * @extends {EventDispatcher}
 */
var DeviceConnection = Class.extend(EventDispatcher, {

    _name: "evolution.DeviceConnection",

View code

Extends

Constructor Summary

AccessSignature
constructorDeviceConnection({HID} hidConnection)

Getters and Setters Summary

AccessSignatureReturn Type
publicgetHidConnection(){HID}

Method Summary

AccessSignatureReturn Type
publiccloseConnection()None
publicdestroyConnection()None

------------------------------------------------------------------------------------


DeviceDataEvent

Class used to represent a data event from the Drone device.

Class

/**
 * @class
 * @extends {Event}
 */
var DeviceDataEvent = Class.extend(Event, /** @lends {DeviceDataEvent.prototype} */{

    _name: "evolution.DeviceDataEvent",

View code

Extends

Constructor Summary

AccessSignature
constructorDeviceDataEvent({string} type, {*} data)

Getters and Setters Summary

AccessSignatureReturn Type
publicgetData(){{a: boolean, b: boolean, x: boolean, y: boolean, lb: boolean, rb: boolean, lt: boolean, rt: boolean, select: boolean, start: boolean, dup: boolean, dleft: boolean, dright: boolean, ddown: boolean, leftStick: { x: number, y: number, pressed: boolean }, rightStick: { x: number, y: number, pressed: boolean }}}

Method Summary

AccessSignatureReturn Type
publicgetLeftStick(){{ x: number, y: number, pressed: boolean }}
publicgetLeftStickX(){number}
publicgetLeftStickY(){number}
publicgetRightStick(){{ x: number, y: number, pressed: boolean }}
publicgetRightStickX(){number}
publicgetRightStickY(){number}
publicisAButtonPressed(){boolean}
publicisBButtonPressed(){boolean}
publicisDirectionDownPressed(){boolean}
publicisDirectionLeftPressed(){boolean}
publicisDirectionRightPressed(){boolean}
publicisDirectionUpPressed(){boolean}
publicisLeftBumperPressed(){boolean}
publicisLeftStickPressed(){boolean}
publicisLeftTriggerPressed(){boolean}
publicisRightBumperPressed(){boolean}
publicisRightStickPressed(){boolean}
publicisRightTriggerPressed(){boolean}
publicisSelectButtonPressed(){boolean}
publicisStartButtonPressed(){boolean}
publicisXButtonPressed(){boolean}
publicisYButtonPressed(){boolean}

------------------------------------------------------------------------------------


DeviceManager

TODO


DeviceService

TODO

FAQs

Package last updated on 13 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc