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 = ; var DeviceManager = evolutionDeviceManager; var myDeviceManager = ;myDeviceManager; myDeviceManager; myDeviceManager;
Connecting to a Device and listening for DeviceDataEvents
var evolution = ;var DeviceDataEvent = evolutionDeviceDataEvent;var DeviceManager = evolutionDeviceManager; var myDeviceManager = ;myDeviceManager;myDeviceManager;
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 = ;
Documentation
Classes
Device
Class used to represent a detected Drone device.
Class
/** * @class * @extends */var Device = Class
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 |
### 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 */ {
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 = ;var devices = hid;var myDevice = devices0;
### Device#getConnected()
Get whether or not a connection is open with this Device
Method
/** * @return */ {
Parameters
- None
Returns
{boolean}
- Whether or not a connection is open with the Device.
Examples
var myDevice = devices0;myDevice; // 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 */ {
Parameters
- None
Returns
{DeviceConnection}
- The connection open with this Device.
Examples
Device does not have a connection when it is instantiated
var device = ;device; // null
Device does not have a connection when it is first detected
myDeviceManager;
Device has connection after connectToDevice is called
myDeviceManager;
DeviceConnection
Class used to represent a connection to a Drone device.
Class
/** * @class * @extends */var DeviceConnection = Class
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 */var DeviceDataEvent = Class
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