npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

evolution-drone

v0.0.4

Published

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

Downloads

3

Readme

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

Access | Signature --- | --- constructor | Device({{interface: number, manufacturer: string, path: string, product: string, productId: string, release: number, serialNumber: string, vendorId: string}} hidDevice)

Getters and Setters Summary

Access | Signature | Return Type --- | --- | --- public | getConnected() | {boolean} public | getConnection() | {DeviceConnection} public | setConnection({DeviceConnection} deviceConnection) | None public | getInterface() | {number} public | getManufacturer() | {string} public | getPath() | {string} public | getProduct() | {string} public | getProductId() | {string} public | getRelease() | {number} public | getSerialNumber() | {string} public | getVendorId() | {string}

Method Summary

Access | Signature | Return Type --- | --- | --- public | connectToDevice() | None public | disconnectFromDevice() | None

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

Name | Type | Description --- | --- | --- 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]);

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.

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

Access | Signature --- | --- constructor | DeviceConnection({HID} hidConnection)

Getters and Setters Summary

Access | Signature | Return Type --- | --- | --- public | getHidConnection() | {HID}

Method Summary

Access | Signature | Return Type --- | --- | --- public | closeConnection() | None public | destroyConnection() | 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

Access | Signature --- | --- constructor | DeviceDataEvent({string} type, {*} data)

Getters and Setters Summary

Access | Signature | Return Type --- | --- | --- public | getData() | {{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

Access | Signature | Return Type --- | --- | --- public | getLeftStick() | {{ x: number, y: number, pressed: boolean }} public | getLeftStickX() | {number} public | getLeftStickY() | {number} public | getRightStick() | {{ x: number, y: number, pressed: boolean }} public | getRightStickX() | {number} public | getRightStickY() | {number} public | isAButtonPressed() | {boolean} public | isBButtonPressed() | {boolean} public | isDirectionDownPressed() | {boolean} public | isDirectionLeftPressed() | {boolean} public | isDirectionRightPressed() | {boolean} public | isDirectionUpPressed() | {boolean} public | isLeftBumperPressed() | {boolean} public | isLeftStickPressed() | {boolean} public | isLeftTriggerPressed() | {boolean} public | isRightBumperPressed() | {boolean} public | isRightStickPressed() | {boolean} public | isRightTriggerPressed() | {boolean} public | isSelectButtonPressed() | {boolean} public | isStartButtonPressed() | {boolean} public | isXButtonPressed() | {boolean} public | isYButtonPressed() | {boolean}

DeviceManager

TODO

DeviceService

TODO