UNPKG

@shuttle-lib/core

Version:

NPM package to interact with the Shuttle devices

48 lines 1.92 kB
/// <reference types="node" /> import { EventEmitter } from 'events'; import { ButtonStates, ShuttleEvents, ShuttleInfo } from './api'; import { HIDDevice } from './genericHIDDevice'; export declare interface Shuttle { on<U extends keyof ShuttleEvents>(event: U, listener: ShuttleEvents[U]): this; emit<U extends keyof ShuttleEvents>(event: U, ...args: Parameters<ShuttleEvents[U]>): boolean; } export declare class Shuttle extends EventEmitter { private _device; private _deviceInfo; private _devicePath; private product; private _buttonStates; private _shuttleState; private _jogState; private _initialized; private _disconnected; /** Vendor ids for the Shuttle devices */ static get vendorIds(): number[]; constructor(_device: HIDDevice, _deviceInfo: DeviceInfo, _devicePath: string | undefined); private _setupDevice; /** Initialize the device. This ensures that the essential information from the device about its state has been received. */ init(): Promise<void>; /** Closes the device. Subsequent commands will raise errors. */ close(): Promise<void>; /** Various information about the device and its capabilities */ get info(): ShuttleInfo; /** * Returns an object with current Button states */ getButtons(): ButtonStates; private _triggerHandleDeviceDisconnected; /** (Internal function) Called when there has been detected that the device has been disconnected */ _handleDeviceDisconnected(): Promise<void>; get hidDevice(): HIDDevice; get deviceInfo(): DeviceInfo; get devicePath(): string | undefined; /** Check that the .init() function has run, throw otherwise */ private ensureInitialized; } export interface DeviceInfo { product: string | undefined; vendorId: number; productId: number; interface: number | null; } //# sourceMappingURL=Shuttle.d.ts.map