buttplug 3.1.0 → 3.2.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 +13 -8
- package/CHANGELOG.md +24 -0
- package/README.md +24 -25
- package/dist/main/src/client/ButtplugBrowserWebsocketClientConnector.d.ts +13 -16
- package/dist/main/src/client/ButtplugBrowserWebsocketClientConnector.js +23 -57
- package/dist/main/src/client/ButtplugBrowserWebsocketClientConnector.js.map +1 -1
- package/dist/main/src/client/ButtplugClientConnectorException.d.ts +11 -11
- package/dist/main/src/client/ButtplugClientConnectorException.js +41 -41
- package/dist/main/src/client/ButtplugClientDevice.d.ts +67 -68
- package/dist/main/src/client/ButtplugClientDevice.js +324 -324
- package/dist/main/src/client/ButtplugClientDevice.js.map +1 -1
- package/dist/main/src/client/ButtplugNodeWebsocketClientConnector.d.ts +18 -19
- package/dist/main/src/client/ButtplugNodeWebsocketClientConnector.js +19 -21
- package/dist/main/src/client/ButtplugNodeWebsocketClientConnector.js.map +1 -1
- package/dist/main/src/client/Client.d.ts +41 -41
- package/dist/main/src/client/Client.js +240 -235
- package/dist/main/src/client/Client.js.map +1 -1
- package/dist/main/src/client/IButtplugClientConnector.d.ts +16 -17
- package/dist/main/src/client/IButtplugClientConnector.js +9 -9
- package/dist/main/src/core/Exceptions.d.ts +36 -36
- package/dist/main/src/core/Exceptions.js +106 -106
- package/dist/main/src/core/Logging.d.ts +112 -113
- package/dist/main/src/core/Logging.js +170 -170
- package/dist/main/src/core/Logging.js.map +1 -1
- package/dist/main/src/core/MessageUtils.d.ts +9 -9
- package/dist/main/src/core/MessageUtils.js +58 -58
- package/dist/main/src/core/Messages.d.ts +275 -275
- package/dist/main/src/core/Messages.js +429 -429
- package/dist/main/src/core/Messages.js.map +1 -1
- package/dist/main/src/index.d.ts +18 -18
- package/dist/main/src/index.js +34 -34
- package/dist/main/src/utils/ButtplugBrowserWebsocketConnector.d.ts +22 -24
- package/dist/main/src/utils/ButtplugBrowserWebsocketConnector.js +95 -102
- package/dist/main/src/utils/ButtplugBrowserWebsocketConnector.js.map +1 -1
- package/dist/main/src/utils/ButtplugMessageSorter.d.ts +19 -19
- package/dist/main/src/utils/ButtplugMessageSorter.js +81 -81
- package/dist/main/src/utils/Utils.d.ts +1 -1
- package/dist/main/src/utils/Utils.js +7 -7
- package/dist/web/buttplug.js +38 -7616
- package/dist/web/buttplug.mjs +2254 -0
- package/dist/web/client/ButtplugBrowserWebsocketClientConnector.d.ts +13 -0
- package/dist/web/client/ButtplugClientConnectorException.d.ts +11 -0
- package/dist/web/client/ButtplugClientDevice.d.ts +67 -0
- package/dist/web/client/ButtplugNodeWebsocketClientConnector.d.ts +18 -0
- package/dist/web/client/Client.d.ts +41 -0
- package/dist/web/client/IButtplugClientConnector.d.ts +16 -0
- package/dist/web/core/Exceptions.d.ts +36 -0
- package/dist/web/core/Logging.d.ts +112 -0
- package/dist/web/core/MessageUtils.d.ts +9 -0
- package/dist/web/core/Messages.d.ts +274 -0
- package/dist/web/index.d.ts +18 -0
- package/dist/web/utils/ButtplugBrowserWebsocketConnector.d.ts +22 -0
- package/dist/web/utils/ButtplugMessageSorter.d.ts +19 -0
- package/dist/web/utils/Utils.d.ts +1 -0
- package/node-test.ts +5 -0
- package/package.json +23 -53
- package/src/client/ButtplugBrowserWebsocketClientConnector.ts +2 -28
- package/src/client/ButtplugClientDevice.ts +2 -2
- package/src/client/ButtplugNodeWebsocketClientConnector.ts +0 -2
- package/src/client/Client.ts +13 -7
- package/src/client/IButtplugClientConnector.ts +5 -5
- package/src/core/Logging.ts +1 -1
- package/src/core/MessageUtils.ts +1 -1
- package/src/utils/ButtplugBrowserWebsocketConnector.ts +14 -20
- package/vite.config.ts +26 -0
- package/.github/FUNDING.yml +0 -5
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -17
- package/.github/workflows/docs.yaml +0 -29
- package/azure-pipelines.yml +0 -19
- package/dist/web/buttplug.min.js +0 -3
- package/dist/web/buttplug.min.js.LICENSE.txt +0 -31
- package/dist/web/buttplug.min.js.map +0 -1
- package/jest-puppeteer.config.js +0 -5
- package/rollup.config.js +0 -55
package/.eslintrc.js
CHANGED
|
@@ -5,16 +5,21 @@ module.exports = {
|
|
|
5
5
|
node: true,
|
|
6
6
|
},
|
|
7
7
|
extends: [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
'eslint:recommended',
|
|
9
|
+
'plugin:@typescript-eslint/recommended',
|
|
10
|
+
'./node_modules/gts',
|
|
11
11
|
],
|
|
12
12
|
overrides: [],
|
|
13
|
-
parser:
|
|
13
|
+
parser: '@typescript-eslint/parser',
|
|
14
14
|
parserOptions: {
|
|
15
|
-
ecmaVersion:
|
|
16
|
-
sourceType:
|
|
15
|
+
ecmaVersion: 'latest',
|
|
16
|
+
sourceType: 'module',
|
|
17
|
+
},
|
|
18
|
+
plugins: ['@typescript-eslint'],
|
|
19
|
+
rules: {
|
|
20
|
+
'node/no-unsupported-features/es-syntax': [
|
|
21
|
+
'error',
|
|
22
|
+
{ ignores: ['modules'] },
|
|
23
|
+
],
|
|
17
24
|
},
|
|
18
|
-
plugins: ["@typescript-eslint"],
|
|
19
|
-
rules: {},
|
|
20
25
|
};
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
# v3.2.0 (2023/09/23)
|
|
2
|
+
|
|
3
|
+
## Features
|
|
4
|
+
|
|
5
|
+
- Web package building now uses vite instead of webpack
|
|
6
|
+
- Long live vite. May I never have to fucking deal with webpack ever again.
|
|
7
|
+
|
|
8
|
+
## Bugfixes
|
|
9
|
+
|
|
10
|
+
- Cleaned up naming conventions
|
|
11
|
+
- Changed connector interface (this is technically a breaking change but afaik no one else
|
|
12
|
+
implements their own connector)
|
|
13
|
+
- Fix linear attribute enumeration
|
|
14
|
+
|
|
15
|
+
# v3.1.1 (2023/02/18)
|
|
16
|
+
|
|
17
|
+
## Bugfixes
|
|
18
|
+
|
|
19
|
+
- Replace events with eventemitter3
|
|
20
|
+
- API Compatible and easier for building across web/node
|
|
21
|
+
- Remove blob reading from websocket connectors
|
|
22
|
+
- We never use binary messages on websockets, and the extra filereader dep for node was
|
|
23
|
+
causing issues with web builds.
|
|
24
|
+
|
|
1
25
|
# v3.1.0 (2023/02/11)
|
|
2
26
|
|
|
3
27
|
## Features
|
package/README.md
CHANGED
|
@@ -7,41 +7,40 @@
|
|
|
7
7
|
[](https://discord.buttplug.io)
|
|
8
8
|
[](https://twitter.com/buttplugio)
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(GUI)](https://intiface.com/central)
|
|
13
|
-
(CLI)](https://github.com/intiface/intiface-engine)
|
|
10
|
+
A implementation of the Buttplug Client in Typescript/Javascript, implementing the Version 3
|
|
11
|
+
Buttplug Spec. It is expected to run from a browser against either [Intiface Central
|
|
12
|
+
(GUI)](https://intiface.com/central), [Initface Engine
|
|
13
|
+
(CLI)](https://github.com/intiface/intiface-engine), or [the Buttplug WASM Server](https://github.com/buttplugio/buttplug-js).
|
|
14
14
|
|
|
15
|
+
## Compilation information
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
buttplug-js builds to 3 different types of library:
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
- CommonJS for node
|
|
20
|
+
- UMD and ES Modules for the web
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
For node, simply include the package as you would any other package.
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
For inclusion in web projects, the UMD project can be found at dist/web/buttplug.js, and the es6 module at dist/web/buttplug.mjs.
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
## Using buttplug-js with Node
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
buttplug-js works with both pure web builds, as well as node applications. To use buttplug-js with
|
|
29
|
+
node, use the `ButtplugNodeWebsocketClientConnector` class instead of the
|
|
30
|
+
`ButtplugBrowserWebsocketClientConnector` class. That should be the only change needed, all of the
|
|
31
|
+
API stays the same. See the Documentation section for more info.
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
Typescript/Javascript implementation. From 2017 to 2020, it was a reference version of the Buttplug
|
|
30
|
-
Intimate Haptics Control Standard.
|
|
33
|
+
(The WASM Server *does not work* with pure node applications. It requires a browser environment in order to run. See the WASM project README for more info.)
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
on
|
|
35
|
-
|
|
35
|
+
## Documentation and Examples
|
|
36
|
+
|
|
37
|
+
Documentation on how to use Buttplug in general, as well as examples for buttplug-js, can be found in the [Buttplug Developer Guide](https://docs.buttplug.io/docs/dev-guide).
|
|
38
|
+
|
|
39
|
+
API documentation for buttplug-js can be found at https://buttplugio.github.io/buttplug-js.
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
If you would like to see a demo of using Buttplug in a pure web context, check out the following glitch project, which shows how to pull the Buttplug libraries from a CDN and use them in a pure HTML/JS context without node:
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
library (C/C++/Java/etc...), for managed langauges like Javascript and C#, requiring both the client
|
|
41
|
-
and server to use the FFI was overkill, and caused many extremely difficult-to-debug issues. With
|
|
42
|
-
that in mind, the Typescript implementation in this repo is being turned into a Client only. The
|
|
43
|
-
WASM server and Embedded Connector will stay in the FFI repo, but will be another NPM package that
|
|
44
|
-
will be optional.
|
|
43
|
+
https://glitch.com/edit/#!/how-to-buttplug
|
|
45
44
|
|
|
46
45
|
## Contributing
|
|
47
46
|
|
|
@@ -69,7 +68,7 @@ This project is BSD 3-Clause licensed.
|
|
|
69
68
|
|
|
70
69
|
```text
|
|
71
70
|
|
|
72
|
-
Copyright (c) 2016-2023, Nonpolynomial, LLC
|
|
71
|
+
Copyright (c) 2016-2023, Nonpolynomial Labs, LLC
|
|
73
72
|
All rights reserved.
|
|
74
73
|
|
|
75
74
|
Redistribution and use in source and binary forms, with or without
|
|
@@ -1,16 +1,13 @@
|
|
|
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
|
-
import { IButtplugClientConnector } from './IButtplugClientConnector';
|
|
9
|
-
import { ButtplugMessage } from '../core/Messages';
|
|
10
|
-
import { ButtplugBrowserWebsocketConnector } from '../utils/ButtplugBrowserWebsocketConnector';
|
|
11
|
-
export declare class ButtplugBrowserWebsocketClientConnector extends ButtplugBrowserWebsocketConnector implements IButtplugClientConnector {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
protected ParseIncomingMessage: (event: MessageEvent) => void;
|
|
15
|
-
protected OnReaderLoad(event: Event): void;
|
|
16
|
-
}
|
|
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
|
+
import { IButtplugClientConnector } from './IButtplugClientConnector';
|
|
9
|
+
import { ButtplugMessage } from '../core/Messages';
|
|
10
|
+
import { ButtplugBrowserWebsocketConnector } from '../utils/ButtplugBrowserWebsocketConnector';
|
|
11
|
+
export declare class ButtplugBrowserWebsocketClientConnector extends ButtplugBrowserWebsocketConnector implements IButtplugClientConnector {
|
|
12
|
+
send: (msg: ButtplugMessage) => void;
|
|
13
|
+
}
|
|
@@ -1,58 +1,24 @@
|
|
|
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
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
constructor() {
|
|
25
|
-
super(...arguments);
|
|
26
|
-
this._sorter = new ButtplugMessageSorter_1.ButtplugMessageSorter(true);
|
|
27
|
-
this.Send = (msg) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
if (!this.Connected) {
|
|
29
|
-
throw new Error('ButtplugClient not connected');
|
|
30
|
-
}
|
|
31
|
-
const p = this._sorter.PrepareOutgoingMessage(msg);
|
|
32
|
-
this.SendMessage(msg);
|
|
33
|
-
return yield p;
|
|
34
|
-
});
|
|
35
|
-
this.ParseIncomingMessage = (event) => {
|
|
36
|
-
var _a;
|
|
37
|
-
if (typeof event.data === 'string') {
|
|
38
|
-
const msgs = (0, MessageUtils_1.FromJSON)(event.data);
|
|
39
|
-
const emitMsgs = this._sorter.ParseIncomingMessages(msgs);
|
|
40
|
-
this.emit('message', emitMsgs);
|
|
41
|
-
}
|
|
42
|
-
else if (event.data instanceof Blob) {
|
|
43
|
-
const reader = new ((_a = this._filereaderConstructor) !== null && _a !== void 0 ? _a : FileReader)();
|
|
44
|
-
reader.addEventListener('load', (ev) => {
|
|
45
|
-
this.OnReaderLoad(ev);
|
|
46
|
-
});
|
|
47
|
-
reader.readAsText(event.data);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
OnReaderLoad(event) {
|
|
52
|
-
const msgs = (0, MessageUtils_1.FromJSON)(event.target.result);
|
|
53
|
-
const emitMsgs = this._sorter.ParseIncomingMessages(msgs);
|
|
54
|
-
this.emit('message', emitMsgs);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.ButtplugBrowserWebsocketClientConnector = ButtplugBrowserWebsocketClientConnector;
|
|
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
|
+
'use strict';
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ButtplugBrowserWebsocketClientConnector = void 0;
|
|
11
|
+
const ButtplugBrowserWebsocketConnector_1 = require("../utils/ButtplugBrowserWebsocketConnector");
|
|
12
|
+
class ButtplugBrowserWebsocketClientConnector extends ButtplugBrowserWebsocketConnector_1.ButtplugBrowserWebsocketConnector {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.send = (msg) => {
|
|
16
|
+
if (!this.Connected) {
|
|
17
|
+
throw new Error('ButtplugClient not connected');
|
|
18
|
+
}
|
|
19
|
+
this.sendMessage(msg);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ButtplugBrowserWebsocketClientConnector = ButtplugBrowserWebsocketClientConnector;
|
|
58
24
|
//# sourceMappingURL=ButtplugBrowserWebsocketClientConnector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtplugBrowserWebsocketClientConnector.js","sourceRoot":"","sources":["../../../../src/client/ButtplugBrowserWebsocketClientConnector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"ButtplugBrowserWebsocketClientConnector.js","sourceRoot":"","sources":["../../../../src/client/ButtplugBrowserWebsocketClientConnector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,CAAC;;;AAIb,kGAA+F;AAE/F,MAAa,uCACX,SAAQ,qEAAiC;IAD3C;;QAIS,SAAI,GAAG,CAAC,GAAoB,EAAQ,EAAE;YAC3C,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACnB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;aACjD;YACD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC;CAAA;AAVD,0FAUC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
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
|
-
import { ButtplugError } from '../core/Exceptions';
|
|
9
|
-
export declare class ButtplugClientConnectorException extends ButtplugError {
|
|
10
|
-
constructor(message: string);
|
|
11
|
-
}
|
|
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
|
+
import { ButtplugError } from '../core/Exceptions';
|
|
9
|
+
export declare class ButtplugClientConnectorException extends ButtplugError {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Buttplug JS Source Code File - Visit https://buttplug.io for more info about
|
|
4
|
-
* the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
|
|
5
|
-
* project root for full license information.
|
|
6
|
-
*
|
|
7
|
-
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
8
|
-
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
-
if (mod && mod.__esModule) return mod;
|
|
27
|
-
var result = {};
|
|
28
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
-
__setModuleDefault(result, mod);
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.ButtplugClientConnectorException = void 0;
|
|
34
|
-
const Exceptions_1 = require("../core/Exceptions");
|
|
35
|
-
const Messages = __importStar(require("../core/Messages"));
|
|
36
|
-
class ButtplugClientConnectorException extends Exceptions_1.ButtplugError {
|
|
37
|
-
constructor(message) {
|
|
38
|
-
super(message, Messages.ErrorClass.ERROR_UNKNOWN);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.ButtplugClientConnectorException = ButtplugClientConnectorException;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Buttplug JS Source Code File - Visit https://buttplug.io for more info about
|
|
4
|
+
* the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
|
|
5
|
+
* project root for full license information.
|
|
6
|
+
*
|
|
7
|
+
* @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.ButtplugClientConnectorException = void 0;
|
|
34
|
+
const Exceptions_1 = require("../core/Exceptions");
|
|
35
|
+
const Messages = __importStar(require("../core/Messages"));
|
|
36
|
+
class ButtplugClientConnectorException extends Exceptions_1.ButtplugError {
|
|
37
|
+
constructor(message) {
|
|
38
|
+
super(message, Messages.ErrorClass.ERROR_UNKNOWN);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ButtplugClientConnectorException = ButtplugClientConnectorException;
|
|
42
42
|
//# sourceMappingURL=ButtplugClientConnectorException.js.map
|
|
@@ -1,68 +1,67 @@
|
|
|
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
|
-
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
private
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
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
|
+
import * as Messages from '../core/Messages';
|
|
9
|
+
import { EventEmitter } from 'eventemitter3';
|
|
10
|
+
/**
|
|
11
|
+
* Represents an abstract device, capable of taking certain kinds of messages.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ButtplugClientDevice extends EventEmitter {
|
|
14
|
+
private _deviceInfo;
|
|
15
|
+
private _sendClosure;
|
|
16
|
+
/**
|
|
17
|
+
* Return the name of the device.
|
|
18
|
+
*/
|
|
19
|
+
get name(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Return the user set name of the device.
|
|
22
|
+
*/
|
|
23
|
+
get displayName(): string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Return the index of the device.
|
|
26
|
+
*/
|
|
27
|
+
get index(): number;
|
|
28
|
+
/**
|
|
29
|
+
* Return the index of the device.
|
|
30
|
+
*/
|
|
31
|
+
get messageTimingGap(): number | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Return a list of message types the device accepts.
|
|
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;
|
|
38
|
+
/**
|
|
39
|
+
* @param _index Index of the device, as created by the device manager.
|
|
40
|
+
* @param _name Name of the device.
|
|
41
|
+
* @param allowedMsgs Buttplug messages the device can receive.
|
|
42
|
+
*/
|
|
43
|
+
constructor(_deviceInfo: Messages.DeviceInfo, _sendClosure: (device: ButtplugClientDevice, msg: Messages.ButtplugDeviceMessage) => Promise<Messages.ButtplugMessage>);
|
|
44
|
+
send(msg: Messages.ButtplugDeviceMessage): Promise<Messages.ButtplugMessage>;
|
|
45
|
+
sendExpectOk(msg: Messages.ButtplugDeviceMessage): Promise<void>;
|
|
46
|
+
scalar(scalar: Messages.ScalarSubcommand | Messages.ScalarSubcommand[]): Promise<void>;
|
|
47
|
+
private scalarCommandBuilder;
|
|
48
|
+
get vibrateAttributes(): Messages.GenericDeviceMessageAttributes[];
|
|
49
|
+
vibrate(speed: number | number[]): Promise<void>;
|
|
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>;
|
|
65
|
+
stop(): Promise<void>;
|
|
66
|
+
emitDisconnected(): void;
|
|
67
|
+
}
|