buttplug 3.2.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +25 -25
- package/.jscsrc +2 -2
- package/.jshintrc +5 -5
- package/.prettierrc.json +3 -3
- package/.yarnrc.yml +5 -1
- package/CHANGELOG.md +577 -571
- package/LICENSE +27 -27
- package/README.md +97 -97
- package/dist/main/src/client/ButtplugBrowserWebsocketClientConnector.js +6 -9
- package/dist/main/src/client/ButtplugBrowserWebsocketClientConnector.js.map +1 -1
- package/dist/main/src/client/{Client.d.ts → ButtplugClient.d.ts} +3 -4
- package/dist/main/src/client/ButtplugClient.js +227 -0
- package/dist/main/src/client/ButtplugClient.js.map +1 -0
- package/dist/main/src/client/ButtplugClientConnectorException.js +17 -7
- package/dist/main/src/client/ButtplugClientConnectorException.js.map +1 -1
- package/dist/main/src/client/ButtplugClientDevice.d.ts +13 -28
- package/dist/main/src/client/ButtplugClientDevice.js +105 -247
- package/dist/main/src/client/ButtplugClientDevice.js.map +1 -1
- package/dist/main/src/client/ButtplugClientDeviceCommand.d.ts +42 -0
- package/dist/main/src/client/ButtplugClientDeviceCommand.js +105 -0
- package/dist/main/src/client/ButtplugClientDeviceCommand.js.map +1 -0
- package/dist/main/src/client/ButtplugClientDeviceFeature.d.ts +18 -0
- package/dist/main/src/client/ButtplugClientDeviceFeature.js +166 -0
- package/dist/main/src/client/ButtplugClientDeviceFeature.js.map +1 -0
- package/dist/main/src/client/ButtplugNodeWebsocketClientConnector.d.ts +1 -8
- package/dist/main/src/client/ButtplugNodeWebsocketClientConnector.js +1 -4
- package/dist/main/src/client/ButtplugNodeWebsocketClientConnector.js.map +1 -1
- package/dist/main/src/core/Exceptions.js +27 -9
- package/dist/main/src/core/Exceptions.js.map +1 -1
- package/dist/main/src/core/Logging.js +12 -6
- package/dist/main/src/core/Logging.js.map +1 -1
- package/dist/main/src/core/Messages.d.ts +118 -228
- package/dist/main/src/core/Messages.js +51 -404
- package/dist/main/src/core/Messages.js.map +1 -1
- package/dist/main/src/index.d.ts +2 -2
- package/dist/main/src/index.js +4 -2
- package/dist/main/src/index.js.map +1 -1
- package/dist/main/src/utils/ButtplugBrowserWebsocketConnector.js +40 -52
- package/dist/main/src/utils/ButtplugBrowserWebsocketConnector.js.map +1 -1
- package/dist/main/src/utils/ButtplugMessageSorter.js +27 -15
- package/dist/main/src/utils/ButtplugMessageSorter.js.map +1 -1
- package/dist/main/src/utils/Utils.js +1 -2
- package/dist/main/src/utils/Utils.js.map +1 -1
- package/dist/web/buttplug.js +1 -38
- package/dist/web/buttplug.mjs +595 -1984
- package/dist/web/client/ButtplugBrowserWebsocketClientConnector.d.ts +0 -7
- package/dist/web/client/{Client.d.ts → ButtplugClient.d.ts} +3 -11
- package/dist/web/client/ButtplugClientConnectorException.d.ts +0 -7
- package/dist/web/client/ButtplugClientDevice.d.ts +14 -29
- package/dist/web/client/ButtplugClientDeviceCommand.d.ts +42 -0
- package/dist/web/client/ButtplugClientDeviceFeature.d.ts +18 -0
- package/dist/web/client/ButtplugNodeWebsocketClientConnector.d.ts +1 -15
- package/dist/web/client/IButtplugClientConnector.d.ts +0 -7
- package/dist/web/core/Exceptions.d.ts +1 -1
- package/dist/web/core/Logging.d.ts +0 -7
- package/dist/web/core/Messages.d.ts +118 -227
- package/dist/web/index.d.ts +2 -2
- package/dist/web/utils/ButtplugBrowserWebsocketConnector.d.ts +0 -7
- package/examples/node/SYNC_MANIFEST.md +105 -0
- package/examples/node/application-example.ts +213 -0
- package/examples/node/async-example.ts +124 -0
- package/examples/node/connection-example.ts +76 -0
- package/examples/node/device-control-example.ts +131 -0
- package/examples/node/device-enumeration-example.ts +86 -0
- package/examples/node/device-info-example.ts +131 -0
- package/examples/node/errors-example.ts +166 -0
- package/examples/node/package-lock.json +281 -0
- package/examples/node/package.json +25 -0
- package/examples/node/remote-connector-example.ts +84 -0
- package/examples/node/tsconfig.json +14 -0
- package/examples/web/application-example.js +197 -0
- package/examples/web/async-example.js +90 -0
- package/examples/web/device-control-example.js +87 -0
- package/examples/web/device-enumeration-example.js +49 -0
- package/examples/web/device-info-example.js +100 -0
- package/examples/web/errors-example.js +110 -0
- package/examples/web/index.html +55 -0
- package/examples/web/logging.js +42 -0
- package/examples/web/ping-timeout-example.js +59 -0
- package/examples/web/remote-connector-example.js +68 -0
- package/node-test.js +24 -0
- package/node-test.ts +23 -5
- package/package.json +85 -87
- package/src/client/ButtplugBrowserWebsocketClientConnector.ts +25 -25
- package/src/client/ButtplugClient.ts +242 -0
- package/src/client/ButtplugClientConnectorException.ts +16 -16
- package/src/client/ButtplugClientDevice.ts +178 -401
- package/src/client/ButtplugClientDeviceCommand.ts +112 -0
- package/src/client/ButtplugClientDeviceFeature.ts +138 -0
- package/src/client/ButtplugNodeWebsocketClientConnector.ts +17 -17
- package/src/client/IButtplugClientConnector.ts +18 -18
- package/src/core/Exceptions.ts +107 -101
- package/src/core/Logging.ts +197 -197
- package/src/core/Messages.ts +209 -480
- package/src/core/index.d.ts +4 -4
- package/src/index.ts +21 -19
- package/src/utils/ButtplugBrowserWebsocketConnector.ts +89 -92
- package/src/utils/ButtplugMessageSorter.ts +66 -65
- package/src/utils/Utils.ts +3 -3
- package/tsconfig.json +22 -22
- package/tsfmt.json +14 -14
- package/tslint.json +27 -27
- package/typedocconfig.js +6 -6
- package/vite.config.ts +26 -26
- package/dist/main/src/client/Client.js +0 -242
- package/dist/main/src/client/Client.js.map +0 -1
- package/dist/main/src/core/MessageUtils.d.ts +0 -10
- package/dist/main/src/core/MessageUtils.js +0 -65
- package/dist/main/src/core/MessageUtils.js.map +0 -1
- package/dist/web/core/MessageUtils.d.ts +0 -10
- package/doc/.nojekyll +0 -1
- package/doc/assets/highlight.css +0 -22
- package/doc/assets/main.js +0 -58
- package/doc/assets/search.js +0 -1
- package/doc/assets/style.css +0 -1280
- package/doc/classes/ButtplugBrowserWebsocketClientConnector.html +0 -234
- package/doc/classes/ButtplugClient.html +0 -331
- package/doc/classes/ButtplugClientConnectorException.html +0 -216
- package/doc/classes/ButtplugClientDevice.html +0 -489
- package/doc/classes/ButtplugDeviceError.html +0 -218
- package/doc/classes/ButtplugDeviceMessage.html +0 -165
- package/doc/classes/ButtplugError.html +0 -220
- package/doc/classes/ButtplugInitError.html +0 -218
- package/doc/classes/ButtplugLogger.html +0 -288
- package/doc/classes/ButtplugMessage.html +0 -147
- package/doc/classes/ButtplugMessageError.html +0 -218
- package/doc/classes/ButtplugMessageSorter.html +0 -128
- package/doc/classes/ButtplugNodeWebsocketClientConnector.html +0 -239
- package/doc/classes/ButtplugPingError.html +0 -218
- package/doc/classes/ButtplugSystemMessage.html +0 -150
- package/doc/classes/ButtplugUnknownError.html +0 -218
- package/doc/classes/DeviceAdded.html +0 -186
- package/doc/classes/DeviceInfo.html +0 -114
- package/doc/classes/DeviceList.html +0 -160
- package/doc/classes/DeviceRemoved.html +0 -158
- package/doc/classes/Error.html +0 -179
- package/doc/classes/GenericDeviceMessageAttributes.html +0 -107
- package/doc/classes/GenericMessageSubcommand.html +0 -90
- package/doc/classes/LinearCmd.html +0 -187
- package/doc/classes/LogMessage.html +0 -134
- package/doc/classes/MessageAttributes.html +0 -160
- package/doc/classes/Ok.html +0 -151
- package/doc/classes/Ping.html +0 -151
- package/doc/classes/RawDeviceMessageAttributes.html +0 -86
- package/doc/classes/RawReadCmd.html +0 -188
- package/doc/classes/RawReading.html +0 -179
- package/doc/classes/RawSubscribeCmd.html +0 -170
- package/doc/classes/RawUnsubscribeCmd.html +0 -170
- package/doc/classes/RawWriteCmd.html +0 -188
- package/doc/classes/RequestDeviceList.html +0 -151
- package/doc/classes/RequestServerInfo.html +0 -169
- package/doc/classes/RotateCmd.html +0 -187
- package/doc/classes/RotateSubcommand.html +0 -108
- package/doc/classes/ScalarCmd.html +0 -170
- package/doc/classes/ScalarSubcommand.html +0 -108
- package/doc/classes/ScanningFinished.html +0 -146
- package/doc/classes/SensorDeviceMessageAttributes.html +0 -107
- package/doc/classes/SensorReadCmd.html +0 -179
- package/doc/classes/SensorReading.html +0 -188
- package/doc/classes/ServerInfo.html +0 -178
- package/doc/classes/StartScanning.html +0 -151
- package/doc/classes/StopAllDevices.html +0 -151
- package/doc/classes/StopDeviceCmd.html +0 -161
- package/doc/classes/StopScanning.html +0 -151
- package/doc/classes/VectorSubcommand.html +0 -108
- package/doc/enums/ActuatorType.html +0 -104
- package/doc/enums/ButtplugLogLevel.html +0 -97
- package/doc/enums/ErrorClass.html +0 -90
- package/doc/enums/SensorType.html +0 -90
- package/doc/functions/FromJSON.html +0 -113
- package/doc/index.html +0 -184
- package/doc/interfaces/IButtplugClientConnector.html +0 -137
- package/doc/modules.html +0 -176
- package/doc/variables/DEFAULT_MESSAGE_ID.html +0 -104
- package/doc/variables/MAX_ID.html +0 -104
- package/doc/variables/MESSAGE_SPEC_VERSION.html +0 -104
- package/doc/variables/SYSTEM_MESSAGE_ID.html +0 -104
- package/src/client/Client.ts +0 -276
- package/src/core/MessageUtils.ts +0 -48
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Buttplug JS Source Code File - Visit https://buttplug.io for more info about
|
|
3
|
-
* the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
|
|
4
|
-
* project root for full license information.
|
|
5
|
-
*
|
|
6
|
-
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
7
|
-
*/
|
|
8
1
|
import { IButtplugClientConnector } from './IButtplugClientConnector';
|
|
9
2
|
import { ButtplugMessage } from '../core/Messages';
|
|
10
3
|
import { ButtplugBrowserWebsocketConnector } from '../utils/ButtplugBrowserWebsocketConnector';
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Buttplug JS Source Code File - Visit https://buttplug.io for more info about
|
|
3
|
-
* the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
|
|
4
|
-
* project root for full license information.
|
|
5
|
-
*
|
|
6
|
-
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
7
|
-
*/
|
|
8
|
-
/// <reference types="node" />
|
|
9
1
|
import { ButtplugLogger } from '../core/Logging';
|
|
10
2
|
import { EventEmitter } from 'eventemitter3';
|
|
11
3
|
import { ButtplugClientDevice } from './ButtplugClientDevice';
|
|
@@ -21,21 +13,21 @@ export declare class ButtplugClient extends EventEmitter {
|
|
|
21
13
|
private _sorter;
|
|
22
14
|
constructor(clientName?: string);
|
|
23
15
|
get connected(): boolean;
|
|
24
|
-
get devices(): ButtplugClientDevice
|
|
16
|
+
get devices(): Map<number, ButtplugClientDevice>;
|
|
25
17
|
get isScanning(): boolean;
|
|
26
18
|
connect: (connector: IButtplugClientConnector) => Promise<void>;
|
|
27
19
|
disconnect: () => Promise<void>;
|
|
28
20
|
startScanning: () => Promise<void>;
|
|
29
21
|
stopScanning: () => Promise<void>;
|
|
30
22
|
stopAllDevices: () => Promise<void>;
|
|
31
|
-
private sendDeviceMessage;
|
|
32
23
|
protected disconnectHandler: () => void;
|
|
33
24
|
protected parseMessages: (msgs: Messages.ButtplugMessage[]) => void;
|
|
34
25
|
protected initializeConnection: () => Promise<boolean>;
|
|
26
|
+
private parseDeviceList;
|
|
35
27
|
protected requestDeviceList: () => Promise<void>;
|
|
36
28
|
protected shutdownConnection: () => Promise<void>;
|
|
37
29
|
protected sendMessage(msg: Messages.ButtplugMessage): Promise<Messages.ButtplugMessage>;
|
|
38
30
|
protected checkConnector(): void;
|
|
39
31
|
protected sendMsgExpectOk: (msg: Messages.ButtplugMessage) => Promise<void>;
|
|
40
|
-
protected
|
|
32
|
+
protected sendMessageClosure: (msg: Messages.ButtplugMessage) => Promise<Messages.ButtplugMessage>;
|
|
41
33
|
}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Buttplug JS Source Code File - Visit https://buttplug.io for more info about
|
|
3
|
-
* the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
|
|
4
|
-
* project root for full license information.
|
|
5
|
-
*
|
|
6
|
-
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
7
|
-
*/
|
|
8
1
|
import { ButtplugError } from '../core/Exceptions';
|
|
9
2
|
export declare class ButtplugClientConnectorException extends ButtplugError {
|
|
10
3
|
constructor(message: string);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { EventEmitter } from 'eventemitter3';
|
|
2
|
+
import { ButtplugClientDeviceFeature } from './ButtplugClientDeviceFeature';
|
|
3
|
+
import { DeviceOutputCommand } from './ButtplugClientDeviceCommand';
|
|
1
4
|
/*!
|
|
2
5
|
* Buttplug JS Source Code File - Visit https://buttplug.io for more info about
|
|
3
6
|
* the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
|
|
@@ -6,13 +9,13 @@
|
|
|
6
9
|
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
7
10
|
*/
|
|
8
11
|
import * as Messages from '../core/Messages';
|
|
9
|
-
import { EventEmitter } from 'eventemitter3';
|
|
10
12
|
/**
|
|
11
13
|
* Represents an abstract device, capable of taking certain kinds of messages.
|
|
12
14
|
*/
|
|
13
15
|
export declare class ButtplugClientDevice extends EventEmitter {
|
|
14
16
|
private _deviceInfo;
|
|
15
17
|
private _sendClosure;
|
|
18
|
+
private _features;
|
|
16
19
|
/**
|
|
17
20
|
* Return the name of the device.
|
|
18
21
|
*/
|
|
@@ -29,39 +32,21 @@ export declare class ButtplugClientDevice extends EventEmitter {
|
|
|
29
32
|
* Return the index of the device.
|
|
30
33
|
*/
|
|
31
34
|
get messageTimingGap(): number | undefined;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*/
|
|
35
|
-
get messageAttributes(): Messages.MessageAttributes;
|
|
36
|
-
static fromMsg(msg: Messages.DeviceInfo, sendClosure: (device: ButtplugClientDevice, msg: Messages.ButtplugDeviceMessage) => Promise<Messages.ButtplugMessage>): ButtplugClientDevice;
|
|
37
|
-
private allowedMsgs;
|
|
35
|
+
get features(): Map<number, ButtplugClientDeviceFeature>;
|
|
36
|
+
static fromMsg(msg: Messages.DeviceInfo, sendClosure: (msg: Messages.ButtplugMessage) => Promise<Messages.ButtplugMessage>): ButtplugClientDevice;
|
|
38
37
|
/**
|
|
39
38
|
* @param _index Index of the device, as created by the device manager.
|
|
40
39
|
* @param _name Name of the device.
|
|
41
40
|
* @param allowedMsgs Buttplug messages the device can receive.
|
|
42
41
|
*/
|
|
43
|
-
constructor(
|
|
44
|
-
send(msg: Messages.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
get oscillateAttributes(): Messages.GenericDeviceMessageAttributes[];
|
|
51
|
-
oscillate(speed: number | number[]): Promise<void>;
|
|
52
|
-
get rotateAttributes(): Messages.GenericDeviceMessageAttributes[];
|
|
53
|
-
rotate(values: number | [number, boolean][], clockwise?: boolean): Promise<void>;
|
|
54
|
-
get linearAttributes(): Messages.GenericDeviceMessageAttributes[];
|
|
55
|
-
linear(values: number | [number, number][], duration?: number): Promise<void>;
|
|
56
|
-
sensorRead(sensorIndex: number, sensorType: Messages.SensorType): Promise<number[]>;
|
|
57
|
-
get hasBattery(): boolean;
|
|
58
|
-
battery(): Promise<number>;
|
|
59
|
-
get hasRssi(): boolean;
|
|
60
|
-
rssi(): Promise<number>;
|
|
61
|
-
rawRead(endpoint: string, expectedLength: number, timeout: number): Promise<Uint8Array>;
|
|
62
|
-
rawWrite(endpoint: string, data: Uint8Array, writeWithResponse: boolean): Promise<void>;
|
|
63
|
-
rawSubscribe(endpoint: string): Promise<void>;
|
|
64
|
-
rawUnsubscribe(endpoint: string): Promise<void>;
|
|
42
|
+
private constructor();
|
|
43
|
+
send(msg: Messages.ButtplugMessage): Promise<Messages.ButtplugMessage>;
|
|
44
|
+
protected sendMsgExpectOk: (msg: Messages.ButtplugMessage) => Promise<void>;
|
|
45
|
+
protected isOutputValid(featureIndex: number, type: Messages.OutputType): void;
|
|
46
|
+
hasOutput(type: Messages.OutputType): boolean;
|
|
47
|
+
hasInput(type: Messages.InputType): boolean;
|
|
48
|
+
runOutput(cmd: DeviceOutputCommand): Promise<void>;
|
|
65
49
|
stop(): Promise<void>;
|
|
50
|
+
battery(): Promise<number>;
|
|
66
51
|
emitDisconnected(): void;
|
|
67
52
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { OutputType } from '../core/Messages';
|
|
2
|
+
declare class PercentOrSteps {
|
|
3
|
+
private _percent;
|
|
4
|
+
private _steps;
|
|
5
|
+
get percent(): number | undefined;
|
|
6
|
+
get steps(): number | undefined;
|
|
7
|
+
static createSteps(s: number): PercentOrSteps;
|
|
8
|
+
static createPercent(p: number): PercentOrSteps;
|
|
9
|
+
}
|
|
10
|
+
export declare class DeviceOutputCommand {
|
|
11
|
+
private _outputType;
|
|
12
|
+
private _value;
|
|
13
|
+
private _duration?;
|
|
14
|
+
constructor(_outputType: OutputType, _value: PercentOrSteps, _duration?: number | undefined);
|
|
15
|
+
get outputType(): OutputType;
|
|
16
|
+
get value(): PercentOrSteps;
|
|
17
|
+
get duration(): number | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare class DeviceOutputValueConstructor {
|
|
20
|
+
private _outputType;
|
|
21
|
+
constructor(_outputType: OutputType);
|
|
22
|
+
steps(steps: number): DeviceOutputCommand;
|
|
23
|
+
percent(percent: number): DeviceOutputCommand;
|
|
24
|
+
}
|
|
25
|
+
export declare class DeviceOutputPositionWithDurationConstructor {
|
|
26
|
+
steps(steps: number, duration: number): DeviceOutputCommand;
|
|
27
|
+
percent(percent: number, duration: number): DeviceOutputCommand;
|
|
28
|
+
}
|
|
29
|
+
export declare class DeviceOutput {
|
|
30
|
+
private constructor();
|
|
31
|
+
static get Vibrate(): DeviceOutputValueConstructor;
|
|
32
|
+
static get Rotate(): DeviceOutputValueConstructor;
|
|
33
|
+
static get Oscillate(): DeviceOutputValueConstructor;
|
|
34
|
+
static get Constrict(): DeviceOutputValueConstructor;
|
|
35
|
+
static get Inflate(): DeviceOutputValueConstructor;
|
|
36
|
+
static get Temperature(): DeviceOutputValueConstructor;
|
|
37
|
+
static get Led(): DeviceOutputValueConstructor;
|
|
38
|
+
static get Spray(): DeviceOutputValueConstructor;
|
|
39
|
+
static get Position(): DeviceOutputValueConstructor;
|
|
40
|
+
static get PositionWithDuration(): DeviceOutputPositionWithDurationConstructor;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DeviceOutputCommand } from './ButtplugClientDeviceCommand';
|
|
2
|
+
import * as Messages from "../core/Messages";
|
|
3
|
+
export declare class ButtplugClientDeviceFeature {
|
|
4
|
+
private _deviceIndex;
|
|
5
|
+
private _deviceName;
|
|
6
|
+
private _feature;
|
|
7
|
+
private _sendClosure;
|
|
8
|
+
constructor(_deviceIndex: number, _deviceName: string, _feature: Messages.DeviceFeature, _sendClosure: (msg: Messages.ButtplugMessage) => Promise<Messages.ButtplugMessage>);
|
|
9
|
+
protected send: (msg: Messages.ButtplugMessage) => Promise<Messages.ButtplugMessage>;
|
|
10
|
+
protected sendMsgExpectOk: (msg: Messages.ButtplugMessage) => Promise<void>;
|
|
11
|
+
protected isOutputValid(type: Messages.OutputType): void;
|
|
12
|
+
protected isInputValid(type: Messages.InputType): void;
|
|
13
|
+
protected sendOutputCmd(command: DeviceOutputCommand): Promise<void>;
|
|
14
|
+
hasOutput(type: Messages.OutputType): boolean;
|
|
15
|
+
hasInput(type: Messages.InputType): boolean;
|
|
16
|
+
runOutput(cmd: DeviceOutputCommand): Promise<void>;
|
|
17
|
+
runInput(inputType: Messages.InputType, inputCommand: Messages.InputCommandType): Promise<Messages.InputReading | undefined>;
|
|
18
|
+
}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Buttplug JS Source Code File - Visit https://buttplug.io for more info about
|
|
3
|
-
* the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
|
|
4
|
-
* project root for full license information.
|
|
5
|
-
*
|
|
6
|
-
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
7
|
-
*/
|
|
8
1
|
import { ButtplugBrowserWebsocketClientConnector } from './ButtplugBrowserWebsocketClientConnector';
|
|
9
2
|
export declare class ButtplugNodeWebsocketClientConnector extends ButtplugBrowserWebsocketClientConnector {
|
|
10
|
-
protected _websocketConstructor:
|
|
11
|
-
new (url: string | URL, protocols?: string | string[] | undefined): WebSocket;
|
|
12
|
-
prototype: WebSocket;
|
|
13
|
-
readonly CONNECTING: 0;
|
|
14
|
-
readonly OPEN: 1;
|
|
15
|
-
readonly CLOSING: 2;
|
|
16
|
-
readonly CLOSED: 3;
|
|
17
|
-
};
|
|
3
|
+
protected _websocketConstructor: typeof WebSocket;
|
|
18
4
|
}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Buttplug JS Source Code File - Visit https://buttplug.io for more info about
|
|
3
|
-
* the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
|
|
4
|
-
* project root for full license information.
|
|
5
|
-
*
|
|
6
|
-
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
7
|
-
*/
|
|
8
1
|
import { ButtplugMessage } from '../core/Messages';
|
|
9
2
|
import { EventEmitter } from 'eventemitter3';
|
|
10
3
|
export interface IButtplugClientConnector extends EventEmitter {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtplugLogger } from './Logging';
|
|
1
2
|
/*!
|
|
2
3
|
* Buttplug JS Source Code File - Visit https://buttplug.io for more info about
|
|
3
4
|
* the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
|
|
@@ -6,7 +7,6 @@
|
|
|
6
7
|
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
7
8
|
*/
|
|
8
9
|
import * as Messages from './Messages';
|
|
9
|
-
import { ButtplugLogger } from './Logging';
|
|
10
10
|
export declare class ButtplugError extends Error {
|
|
11
11
|
get ErrorClass(): Messages.ErrorClass;
|
|
12
12
|
get InnerError(): Error | undefined;
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Buttplug JS Source Code File - Visit https://buttplug.io for more info about
|
|
3
|
-
* the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
|
|
4
|
-
* project root for full license information.
|
|
5
|
-
*
|
|
6
|
-
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
7
|
-
*/
|
|
8
1
|
import { EventEmitter } from 'eventemitter3';
|
|
9
2
|
export declare enum ButtplugLogLevel {
|
|
10
3
|
Off = 0,
|
|
@@ -8,80 +8,32 @@
|
|
|
8
8
|
export declare const SYSTEM_MESSAGE_ID = 0;
|
|
9
9
|
export declare const DEFAULT_MESSAGE_ID = 1;
|
|
10
10
|
export declare const MAX_ID = 4294967295;
|
|
11
|
-
export declare const
|
|
12
|
-
export declare
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
RSSI = "RSSI",
|
|
38
|
-
Button = "Button",
|
|
39
|
-
Pressure = "Pressure"
|
|
40
|
-
}
|
|
41
|
-
export declare class GenericDeviceMessageAttributes {
|
|
42
|
-
FeatureDescriptor: string;
|
|
43
|
-
ActuatorType: ActuatorType;
|
|
44
|
-
StepCount: number;
|
|
45
|
-
Index: number;
|
|
46
|
-
constructor(data: Partial<GenericDeviceMessageAttributes>);
|
|
47
|
-
}
|
|
48
|
-
export declare class RawDeviceMessageAttributes {
|
|
49
|
-
Endpoints: Array<string>;
|
|
50
|
-
constructor(Endpoints: Array<string>);
|
|
51
|
-
}
|
|
52
|
-
export declare class SensorDeviceMessageAttributes {
|
|
53
|
-
FeatureDescriptor: string;
|
|
54
|
-
SensorType: SensorType;
|
|
55
|
-
StepRange: Array<number>;
|
|
56
|
-
Index: number;
|
|
57
|
-
constructor(data: Partial<GenericDeviceMessageAttributes>);
|
|
58
|
-
}
|
|
59
|
-
export declare abstract class ButtplugMessage {
|
|
60
|
-
Id: number;
|
|
61
|
-
constructor(Id: number);
|
|
62
|
-
get Type(): Function;
|
|
63
|
-
toJSON(): string;
|
|
64
|
-
toProtocolFormat(): object;
|
|
65
|
-
update(): void;
|
|
66
|
-
}
|
|
67
|
-
export declare abstract class ButtplugDeviceMessage extends ButtplugMessage {
|
|
68
|
-
DeviceIndex: number;
|
|
69
|
-
Id: number;
|
|
70
|
-
constructor(DeviceIndex: number, Id: number);
|
|
71
|
-
}
|
|
72
|
-
export declare abstract class ButtplugSystemMessage extends ButtplugMessage {
|
|
73
|
-
Id: number;
|
|
74
|
-
constructor(Id?: number);
|
|
75
|
-
}
|
|
76
|
-
export declare class Ok extends ButtplugSystemMessage {
|
|
77
|
-
Id: number;
|
|
78
|
-
static Name: string;
|
|
79
|
-
constructor(Id?: number);
|
|
80
|
-
}
|
|
81
|
-
export declare class Ping extends ButtplugMessage {
|
|
82
|
-
Id: number;
|
|
83
|
-
static Name: string;
|
|
84
|
-
constructor(Id?: number);
|
|
11
|
+
export declare const MESSAGE_SPEC_VERSION_MAJOR = 4;
|
|
12
|
+
export declare const MESSAGE_SPEC_VERSION_MINOR = 0;
|
|
13
|
+
export interface ButtplugMessage {
|
|
14
|
+
Ok?: Ok;
|
|
15
|
+
Ping?: Ping;
|
|
16
|
+
Error?: Error;
|
|
17
|
+
RequestServerInfo?: RequestServerInfo;
|
|
18
|
+
ServerInfo?: ServerInfo;
|
|
19
|
+
RequestDeviceList?: RequestDeviceList;
|
|
20
|
+
StartScanning?: StartScanning;
|
|
21
|
+
StopScanning?: StopScanning;
|
|
22
|
+
StopAllDevices?: StopAllDevices;
|
|
23
|
+
ScanningFinished?: ScanningFinished;
|
|
24
|
+
StopDeviceCmd?: StopDeviceCmd;
|
|
25
|
+
InputCmd?: InputCmd;
|
|
26
|
+
InputReading?: InputReading;
|
|
27
|
+
OutputCmd?: OutputCmd;
|
|
28
|
+
DeviceList?: DeviceList;
|
|
29
|
+
}
|
|
30
|
+
export declare function msgId(msg: ButtplugMessage): number;
|
|
31
|
+
export declare function setMsgId(msg: ButtplugMessage, id: number): void;
|
|
32
|
+
export interface Ok {
|
|
33
|
+
Id: number | undefined;
|
|
34
|
+
}
|
|
35
|
+
export interface Ping {
|
|
36
|
+
Id: number | undefined;
|
|
85
37
|
}
|
|
86
38
|
export declare enum ErrorClass {
|
|
87
39
|
ERROR_UNKNOWN = 0,
|
|
@@ -90,185 +42,124 @@ export declare enum ErrorClass {
|
|
|
90
42
|
ERROR_MSG = 3,
|
|
91
43
|
ERROR_DEVICE = 4
|
|
92
44
|
}
|
|
93
|
-
export
|
|
45
|
+
export interface Error {
|
|
94
46
|
ErrorMessage: string;
|
|
95
47
|
ErrorCode: ErrorClass;
|
|
96
|
-
Id: number;
|
|
97
|
-
static Name: string;
|
|
98
|
-
constructor(ErrorMessage: string, ErrorCode?: ErrorClass, Id?: number);
|
|
99
|
-
get Schemversion(): number;
|
|
100
|
-
}
|
|
101
|
-
export declare class DeviceInfo {
|
|
102
|
-
DeviceIndex: number;
|
|
103
|
-
DeviceName: string;
|
|
104
|
-
DeviceMessages: MessageAttributes;
|
|
105
|
-
DeviceDisplayName?: string;
|
|
106
|
-
DeviceMessageTimingGap?: number;
|
|
107
|
-
constructor(data: Partial<DeviceInfo>);
|
|
108
|
-
}
|
|
109
|
-
export declare class DeviceList extends ButtplugMessage {
|
|
110
|
-
static Name: string;
|
|
111
|
-
Devices: DeviceInfo[];
|
|
112
|
-
Id: number;
|
|
113
|
-
constructor(devices: DeviceInfo[], id?: number);
|
|
114
|
-
update(): void;
|
|
115
|
-
}
|
|
116
|
-
export declare class DeviceAdded extends ButtplugSystemMessage {
|
|
117
|
-
static Name: string;
|
|
118
|
-
DeviceIndex: number;
|
|
119
|
-
DeviceName: string;
|
|
120
|
-
DeviceMessages: MessageAttributes;
|
|
121
|
-
DeviceDisplayName?: string;
|
|
122
|
-
DeviceMessageTimingGap?: number;
|
|
123
|
-
constructor(data: Partial<DeviceAdded>);
|
|
124
|
-
update(): void;
|
|
48
|
+
Id: number | undefined;
|
|
125
49
|
}
|
|
126
|
-
export
|
|
127
|
-
|
|
128
|
-
static Name: string;
|
|
129
|
-
constructor(DeviceIndex: number);
|
|
50
|
+
export interface RequestDeviceList {
|
|
51
|
+
Id: number | undefined;
|
|
130
52
|
}
|
|
131
|
-
export
|
|
132
|
-
Id: number;
|
|
133
|
-
static Name: string;
|
|
134
|
-
constructor(Id?: number);
|
|
53
|
+
export interface StartScanning {
|
|
54
|
+
Id: number | undefined;
|
|
135
55
|
}
|
|
136
|
-
export
|
|
137
|
-
Id: number;
|
|
138
|
-
static Name: string;
|
|
139
|
-
constructor(Id?: number);
|
|
56
|
+
export interface StopScanning {
|
|
57
|
+
Id: number | undefined;
|
|
140
58
|
}
|
|
141
|
-
export
|
|
142
|
-
Id: number;
|
|
143
|
-
static Name: string;
|
|
144
|
-
constructor(Id?: number);
|
|
59
|
+
export interface StopAllDevices {
|
|
60
|
+
Id: number | undefined;
|
|
145
61
|
}
|
|
146
|
-
export
|
|
147
|
-
|
|
148
|
-
constructor();
|
|
62
|
+
export interface ScanningFinished {
|
|
63
|
+
Id: number | undefined;
|
|
149
64
|
}
|
|
150
|
-
export
|
|
65
|
+
export interface RequestServerInfo {
|
|
151
66
|
ClientName: string;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
constructor(ClientName: string, MessageVersion?: number, Id?: number);
|
|
67
|
+
ProtocolVersionMajor: number;
|
|
68
|
+
ProtocolVersionMinor: number;
|
|
69
|
+
Id: number | undefined;
|
|
156
70
|
}
|
|
157
|
-
export
|
|
158
|
-
MessageVersion: number;
|
|
71
|
+
export interface ServerInfo {
|
|
159
72
|
MaxPingTime: number;
|
|
160
73
|
ServerName: string;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
export declare class StopDeviceCmd extends ButtplugDeviceMessage {
|
|
166
|
-
DeviceIndex: number;
|
|
167
|
-
Id: number;
|
|
168
|
-
static Name: string;
|
|
169
|
-
constructor(DeviceIndex?: number, Id?: number);
|
|
170
|
-
}
|
|
171
|
-
export declare class StopAllDevices extends ButtplugMessage {
|
|
172
|
-
Id: number;
|
|
173
|
-
static Name: string;
|
|
174
|
-
constructor(Id?: number);
|
|
74
|
+
ProtocolVersionMajor: number;
|
|
75
|
+
ProtocolVersionMinor: number;
|
|
76
|
+
Id: number | undefined;
|
|
175
77
|
}
|
|
176
|
-
export
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
78
|
+
export interface DeviceFeature {
|
|
79
|
+
FeatureDescriptor: string;
|
|
80
|
+
Output: {
|
|
81
|
+
[key: string]: DeviceFeatureOutput;
|
|
82
|
+
};
|
|
83
|
+
Input: {
|
|
84
|
+
[key: string]: DeviceFeatureInput;
|
|
85
|
+
};
|
|
86
|
+
FeatureIndex: number;
|
|
87
|
+
}
|
|
88
|
+
export interface DeviceInfo {
|
|
187
89
|
DeviceIndex: number;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
90
|
+
DeviceName: string;
|
|
91
|
+
DeviceFeatures: {
|
|
92
|
+
[key: number]: DeviceFeature;
|
|
93
|
+
};
|
|
94
|
+
DeviceDisplayName?: string;
|
|
95
|
+
DeviceMessageTimingGap?: number;
|
|
191
96
|
}
|
|
192
|
-
export
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
97
|
+
export interface DeviceList {
|
|
98
|
+
Devices: {
|
|
99
|
+
[key: number]: DeviceInfo;
|
|
100
|
+
};
|
|
101
|
+
Id: number | undefined;
|
|
196
102
|
}
|
|
197
|
-
export declare
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
103
|
+
export declare enum OutputType {
|
|
104
|
+
Unknown = "Unknown",
|
|
105
|
+
Vibrate = "Vibrate",
|
|
106
|
+
Rotate = "Rotate",
|
|
107
|
+
Oscillate = "Oscillate",
|
|
108
|
+
Constrict = "Constrict",
|
|
109
|
+
Inflate = "Inflate",
|
|
110
|
+
Position = "Position",
|
|
111
|
+
PositionWithDuration = "PositionWithDuration",
|
|
112
|
+
Temperature = "Temperature",
|
|
113
|
+
Spray = "Spray",
|
|
114
|
+
Led = "Led"
|
|
204
115
|
}
|
|
205
|
-
export declare
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
116
|
+
export declare enum InputType {
|
|
117
|
+
Unknown = "Unknown",
|
|
118
|
+
Battery = "Battery",
|
|
119
|
+
RSSI = "RSSI",
|
|
120
|
+
Button = "Button",
|
|
121
|
+
Pressure = "Pressure"
|
|
209
122
|
}
|
|
210
|
-
export declare
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
static Name: string;
|
|
215
|
-
static Create(deviceIndex: number, commands: [number, number][]): LinearCmd;
|
|
216
|
-
constructor(Vectors: VectorSubcommand[], DeviceIndex?: number, Id?: number);
|
|
123
|
+
export declare enum InputCommandType {
|
|
124
|
+
Read = "Read",
|
|
125
|
+
Subscribe = "Subscribe",
|
|
126
|
+
Unsubscribe = "Unsubscribe"
|
|
217
127
|
}
|
|
218
|
-
export
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
SensorType: SensorType;
|
|
222
|
-
Id: number;
|
|
223
|
-
static Name: string;
|
|
224
|
-
constructor(DeviceIndex: number, SensorIndex: number, SensorType: SensorType, Id?: number);
|
|
128
|
+
export interface DeviceFeatureInput {
|
|
129
|
+
Value: number[];
|
|
130
|
+
Command: InputCommandType[];
|
|
225
131
|
}
|
|
226
|
-
export
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
SensorType: SensorType;
|
|
230
|
-
Data: number[];
|
|
231
|
-
Id: number;
|
|
232
|
-
static Name: string;
|
|
233
|
-
constructor(DeviceIndex: number, SensorIndex: number, SensorType: SensorType, Data: number[], Id?: number);
|
|
132
|
+
export interface DeviceFeatureOutput {
|
|
133
|
+
Value: number;
|
|
134
|
+
Duration?: number;
|
|
234
135
|
}
|
|
235
|
-
export
|
|
136
|
+
export interface OutputCmd {
|
|
236
137
|
DeviceIndex: number;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
constructor(DeviceIndex: number, Endpoint: string, ExpectedLength: number, Timeout: number, Id?: number);
|
|
138
|
+
FeatureIndex: number;
|
|
139
|
+
Command: {
|
|
140
|
+
[key: string]: DeviceFeatureOutput;
|
|
141
|
+
};
|
|
142
|
+
Id: number | undefined;
|
|
243
143
|
}
|
|
244
|
-
export
|
|
144
|
+
export interface InputCmd {
|
|
245
145
|
DeviceIndex: number;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
Id: number;
|
|
250
|
-
static Name: string;
|
|
251
|
-
constructor(DeviceIndex: number, Endpoint: string, Data: Uint8Array, WriteWithResponse: boolean, Id?: number);
|
|
146
|
+
FeatureIndex: number;
|
|
147
|
+
Type: InputType;
|
|
148
|
+
Command: InputCommandType;
|
|
149
|
+
Id: number | undefined;
|
|
252
150
|
}
|
|
253
|
-
export
|
|
254
|
-
|
|
255
|
-
Endpoint: string;
|
|
256
|
-
Id: number;
|
|
257
|
-
static Name: string;
|
|
258
|
-
constructor(DeviceIndex: number, Endpoint: string, Id?: number);
|
|
151
|
+
export interface InputValue {
|
|
152
|
+
Value: number;
|
|
259
153
|
}
|
|
260
|
-
export
|
|
154
|
+
export interface InputReading {
|
|
261
155
|
DeviceIndex: number;
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
156
|
+
FeatureIndex: number;
|
|
157
|
+
Reading: {
|
|
158
|
+
[key: string]: InputValue;
|
|
159
|
+
};
|
|
160
|
+
Id: number | undefined;
|
|
161
|
+
}
|
|
162
|
+
export interface StopDeviceCmd {
|
|
163
|
+
Id: number | undefined;
|
|
268
164
|
DeviceIndex: number;
|
|
269
|
-
Endpoint: string;
|
|
270
|
-
Data: number[];
|
|
271
|
-
Id: number;
|
|
272
|
-
static Name: string;
|
|
273
|
-
constructor(DeviceIndex: number, Endpoint: string, Data: number[], Id?: number);
|
|
274
165
|
}
|
package/dist/web/index.d.ts
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
7
7
|
*/
|
|
8
|
-
export * from './client/
|
|
8
|
+
export * from './client/ButtplugClient';
|
|
9
9
|
export * from './client/ButtplugClientDevice';
|
|
10
10
|
export * from './client/ButtplugBrowserWebsocketClientConnector';
|
|
11
11
|
export * from './client/ButtplugNodeWebsocketClientConnector';
|
|
12
12
|
export * from './client/ButtplugClientConnectorException';
|
|
13
13
|
export * from './utils/ButtplugMessageSorter';
|
|
14
|
+
export * from './client/ButtplugClientDeviceCommand';
|
|
14
15
|
export * from './client/IButtplugClientConnector';
|
|
15
16
|
export * from './core/Messages';
|
|
16
|
-
export * from './core/MessageUtils';
|
|
17
17
|
export * from './core/Logging';
|
|
18
18
|
export * from './core/Exceptions';
|