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
|
@@ -7,129 +7,34 @@
|
|
|
7
7
|
*/
|
|
8
8
|
// tslint:disable:max-classes-per-file
|
|
9
9
|
'use strict';
|
|
10
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
-
};
|
|
16
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
-
};
|
|
19
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
exports.InputCommandType = exports.InputType = exports.OutputType = exports.ErrorClass = exports.MESSAGE_SPEC_VERSION_MINOR = exports.MESSAGE_SPEC_VERSION_MAJOR = exports.MAX_ID = exports.DEFAULT_MESSAGE_ID = exports.SYSTEM_MESSAGE_ID = void 0;
|
|
12
|
+
exports.msgId = msgId;
|
|
13
|
+
exports.setMsgId = setMsgId;
|
|
14
|
+
const Exceptions_1 = require("./Exceptions");
|
|
23
15
|
exports.SYSTEM_MESSAGE_ID = 0;
|
|
24
16
|
exports.DEFAULT_MESSAGE_ID = 1;
|
|
25
17
|
exports.MAX_ID = 4294967295;
|
|
26
|
-
exports.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
(_b = this.RotateCmd) === null || _b === void 0 ? void 0 : _b.forEach((x, i) => (x.Index = i));
|
|
35
|
-
(_c = this.LinearCmd) === null || _c === void 0 ? void 0 : _c.forEach((x, i) => (x.Index = i));
|
|
36
|
-
(_d = this.SensorReadCmd) === null || _d === void 0 ? void 0 : _d.forEach((x, i) => (x.Index = i));
|
|
37
|
-
(_e = this.SensorSubscribeCmd) === null || _e === void 0 ? void 0 : _e.forEach((x, i) => (x.Index = i));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.MessageAttributes = MessageAttributes;
|
|
41
|
-
var ActuatorType;
|
|
42
|
-
(function (ActuatorType) {
|
|
43
|
-
ActuatorType["Unknown"] = "Unknown";
|
|
44
|
-
ActuatorType["Vibrate"] = "Vibrate";
|
|
45
|
-
ActuatorType["Rotate"] = "Rotate";
|
|
46
|
-
ActuatorType["Oscillate"] = "Oscillate";
|
|
47
|
-
ActuatorType["Constrict"] = "Constrict";
|
|
48
|
-
ActuatorType["Inflate"] = "Inflate";
|
|
49
|
-
ActuatorType["Position"] = "Position";
|
|
50
|
-
})(ActuatorType || (exports.ActuatorType = ActuatorType = {}));
|
|
51
|
-
var SensorType;
|
|
52
|
-
(function (SensorType) {
|
|
53
|
-
SensorType["Unknown"] = "Unknown";
|
|
54
|
-
SensorType["Battery"] = "Battery";
|
|
55
|
-
SensorType["RSSI"] = "RSSI";
|
|
56
|
-
SensorType["Button"] = "Button";
|
|
57
|
-
SensorType["Pressure"] = "Pressure";
|
|
58
|
-
// Temperature,
|
|
59
|
-
// Accelerometer,
|
|
60
|
-
// Gyro,
|
|
61
|
-
})(SensorType || (exports.SensorType = SensorType = {}));
|
|
62
|
-
class GenericDeviceMessageAttributes {
|
|
63
|
-
constructor(data) {
|
|
64
|
-
this.Index = 0;
|
|
65
|
-
Object.assign(this, data);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.GenericDeviceMessageAttributes = GenericDeviceMessageAttributes;
|
|
69
|
-
class RawDeviceMessageAttributes {
|
|
70
|
-
constructor(Endpoints) {
|
|
71
|
-
this.Endpoints = Endpoints;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
exports.RawDeviceMessageAttributes = RawDeviceMessageAttributes;
|
|
75
|
-
class SensorDeviceMessageAttributes {
|
|
76
|
-
constructor(data) {
|
|
77
|
-
this.Index = 0;
|
|
78
|
-
Object.assign(this, data);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.SensorDeviceMessageAttributes = SensorDeviceMessageAttributes;
|
|
82
|
-
class ButtplugMessage {
|
|
83
|
-
constructor(Id) {
|
|
84
|
-
this.Id = Id;
|
|
85
|
-
}
|
|
86
|
-
// tslint:disable-next-line:ban-types
|
|
87
|
-
get Type() {
|
|
88
|
-
return this.constructor;
|
|
89
|
-
}
|
|
90
|
-
toJSON() {
|
|
91
|
-
return JSON.stringify(this.toProtocolFormat());
|
|
92
|
-
}
|
|
93
|
-
toProtocolFormat() {
|
|
94
|
-
const jsonObj = {};
|
|
95
|
-
jsonObj[this.constructor.Name] =
|
|
96
|
-
(0, class_transformer_1.instanceToPlain)(this);
|
|
97
|
-
return jsonObj;
|
|
98
|
-
}
|
|
99
|
-
update() { }
|
|
100
|
-
}
|
|
101
|
-
exports.ButtplugMessage = ButtplugMessage;
|
|
102
|
-
class ButtplugDeviceMessage extends ButtplugMessage {
|
|
103
|
-
constructor(DeviceIndex, Id) {
|
|
104
|
-
super(Id);
|
|
105
|
-
this.DeviceIndex = DeviceIndex;
|
|
106
|
-
this.Id = Id;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
exports.ButtplugDeviceMessage = ButtplugDeviceMessage;
|
|
110
|
-
class ButtplugSystemMessage extends ButtplugMessage {
|
|
111
|
-
constructor(Id = exports.SYSTEM_MESSAGE_ID) {
|
|
112
|
-
super(Id);
|
|
113
|
-
this.Id = Id;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
exports.ButtplugSystemMessage = ButtplugSystemMessage;
|
|
117
|
-
class Ok extends ButtplugSystemMessage {
|
|
118
|
-
constructor(Id = exports.DEFAULT_MESSAGE_ID) {
|
|
119
|
-
super(Id);
|
|
120
|
-
this.Id = Id;
|
|
18
|
+
exports.MESSAGE_SPEC_VERSION_MAJOR = 4;
|
|
19
|
+
exports.MESSAGE_SPEC_VERSION_MINOR = 0;
|
|
20
|
+
;
|
|
21
|
+
function msgId(msg) {
|
|
22
|
+
for (let [_, entry] of Object.entries(msg)) {
|
|
23
|
+
if (entry != undefined) {
|
|
24
|
+
return entry.Id;
|
|
25
|
+
}
|
|
121
26
|
}
|
|
27
|
+
throw new Exceptions_1.ButtplugMessageError(`Message ${msg} does not have an ID.`);
|
|
122
28
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
29
|
+
function setMsgId(msg, id) {
|
|
30
|
+
for (let [_, entry] of Object.entries(msg)) {
|
|
31
|
+
if (entry != undefined) {
|
|
32
|
+
entry.Id = id;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
129
35
|
}
|
|
36
|
+
throw new Exceptions_1.ButtplugMessageError(`Message ${msg} does not have an ID.`);
|
|
130
37
|
}
|
|
131
|
-
exports.Ping = Ping;
|
|
132
|
-
Ping.Name = 'Ping';
|
|
133
38
|
var ErrorClass;
|
|
134
39
|
(function (ErrorClass) {
|
|
135
40
|
ErrorClass[ErrorClass["ERROR_UNKNOWN"] = 0] = "ERROR_UNKNOWN";
|
|
@@ -138,293 +43,35 @@ var ErrorClass;
|
|
|
138
43
|
ErrorClass[ErrorClass["ERROR_MSG"] = 3] = "ERROR_MSG";
|
|
139
44
|
ErrorClass[ErrorClass["ERROR_DEVICE"] = 4] = "ERROR_DEVICE";
|
|
140
45
|
})(ErrorClass || (exports.ErrorClass = ErrorClass = {}));
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
device.DeviceMessages.update();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
exports.DeviceList = DeviceList;
|
|
177
|
-
DeviceList.Name = 'DeviceList';
|
|
178
|
-
__decorate([
|
|
179
|
-
(0, class_transformer_1.Type)(() => DeviceInfo),
|
|
180
|
-
__metadata("design:type", Array)
|
|
181
|
-
], DeviceList.prototype, "Devices", void 0);
|
|
182
|
-
class DeviceAdded extends ButtplugSystemMessage {
|
|
183
|
-
constructor(data) {
|
|
184
|
-
super();
|
|
185
|
-
Object.assign(this, data);
|
|
186
|
-
}
|
|
187
|
-
update() {
|
|
188
|
-
this.DeviceMessages.update();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
exports.DeviceAdded = DeviceAdded;
|
|
192
|
-
DeviceAdded.Name = 'DeviceAdded';
|
|
193
|
-
__decorate([
|
|
194
|
-
(0, class_transformer_1.Type)(() => MessageAttributes),
|
|
195
|
-
__metadata("design:type", MessageAttributes)
|
|
196
|
-
], DeviceAdded.prototype, "DeviceMessages", void 0);
|
|
197
|
-
class DeviceRemoved extends ButtplugSystemMessage {
|
|
198
|
-
constructor(DeviceIndex) {
|
|
199
|
-
super();
|
|
200
|
-
this.DeviceIndex = DeviceIndex;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
exports.DeviceRemoved = DeviceRemoved;
|
|
204
|
-
DeviceRemoved.Name = 'DeviceRemoved';
|
|
205
|
-
class RequestDeviceList extends ButtplugMessage {
|
|
206
|
-
constructor(Id = exports.DEFAULT_MESSAGE_ID) {
|
|
207
|
-
super(Id);
|
|
208
|
-
this.Id = Id;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
exports.RequestDeviceList = RequestDeviceList;
|
|
212
|
-
RequestDeviceList.Name = 'RequestDeviceList';
|
|
213
|
-
class StartScanning extends ButtplugMessage {
|
|
214
|
-
constructor(Id = exports.DEFAULT_MESSAGE_ID) {
|
|
215
|
-
super(Id);
|
|
216
|
-
this.Id = Id;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
exports.StartScanning = StartScanning;
|
|
220
|
-
StartScanning.Name = 'StartScanning';
|
|
221
|
-
class StopScanning extends ButtplugMessage {
|
|
222
|
-
constructor(Id = exports.DEFAULT_MESSAGE_ID) {
|
|
223
|
-
super(Id);
|
|
224
|
-
this.Id = Id;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
exports.StopScanning = StopScanning;
|
|
228
|
-
StopScanning.Name = 'StopScanning';
|
|
229
|
-
class ScanningFinished extends ButtplugSystemMessage {
|
|
230
|
-
constructor() {
|
|
231
|
-
super();
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
exports.ScanningFinished = ScanningFinished;
|
|
235
|
-
ScanningFinished.Name = 'ScanningFinished';
|
|
236
|
-
class RequestServerInfo extends ButtplugMessage {
|
|
237
|
-
constructor(ClientName, MessageVersion = 0, Id = exports.DEFAULT_MESSAGE_ID) {
|
|
238
|
-
super(Id);
|
|
239
|
-
this.ClientName = ClientName;
|
|
240
|
-
this.MessageVersion = MessageVersion;
|
|
241
|
-
this.Id = Id;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
exports.RequestServerInfo = RequestServerInfo;
|
|
245
|
-
RequestServerInfo.Name = 'RequestServerInfo';
|
|
246
|
-
class ServerInfo extends ButtplugSystemMessage {
|
|
247
|
-
constructor(MessageVersion, MaxPingTime, ServerName, Id = exports.DEFAULT_MESSAGE_ID) {
|
|
248
|
-
super();
|
|
249
|
-
this.MessageVersion = MessageVersion;
|
|
250
|
-
this.MaxPingTime = MaxPingTime;
|
|
251
|
-
this.ServerName = ServerName;
|
|
252
|
-
this.Id = Id;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
exports.ServerInfo = ServerInfo;
|
|
256
|
-
ServerInfo.Name = 'ServerInfo';
|
|
257
|
-
class StopDeviceCmd extends ButtplugDeviceMessage {
|
|
258
|
-
constructor(DeviceIndex = -1, Id = exports.DEFAULT_MESSAGE_ID) {
|
|
259
|
-
super(DeviceIndex, Id);
|
|
260
|
-
this.DeviceIndex = DeviceIndex;
|
|
261
|
-
this.Id = Id;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
exports.StopDeviceCmd = StopDeviceCmd;
|
|
265
|
-
StopDeviceCmd.Name = 'StopDeviceCmd';
|
|
266
|
-
class StopAllDevices extends ButtplugMessage {
|
|
267
|
-
constructor(Id = exports.DEFAULT_MESSAGE_ID) {
|
|
268
|
-
super(Id);
|
|
269
|
-
this.Id = Id;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
exports.StopAllDevices = StopAllDevices;
|
|
273
|
-
StopAllDevices.Name = 'StopAllDevices';
|
|
274
|
-
class GenericMessageSubcommand {
|
|
275
|
-
constructor(Index) {
|
|
276
|
-
this.Index = Index;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
exports.GenericMessageSubcommand = GenericMessageSubcommand;
|
|
280
|
-
class ScalarSubcommand extends GenericMessageSubcommand {
|
|
281
|
-
constructor(Index, Scalar, ActuatorType) {
|
|
282
|
-
super(Index);
|
|
283
|
-
this.Scalar = Scalar;
|
|
284
|
-
this.ActuatorType = ActuatorType;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
exports.ScalarSubcommand = ScalarSubcommand;
|
|
288
|
-
class ScalarCmd extends ButtplugDeviceMessage {
|
|
289
|
-
constructor(Scalars, DeviceIndex = -1, Id = exports.DEFAULT_MESSAGE_ID) {
|
|
290
|
-
super(DeviceIndex, Id);
|
|
291
|
-
this.Scalars = Scalars;
|
|
292
|
-
this.DeviceIndex = DeviceIndex;
|
|
293
|
-
this.Id = Id;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
exports.ScalarCmd = ScalarCmd;
|
|
297
|
-
ScalarCmd.Name = 'ScalarCmd';
|
|
298
|
-
class RotateSubcommand extends GenericMessageSubcommand {
|
|
299
|
-
constructor(Index, Speed, Clockwise) {
|
|
300
|
-
super(Index);
|
|
301
|
-
this.Speed = Speed;
|
|
302
|
-
this.Clockwise = Clockwise;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
exports.RotateSubcommand = RotateSubcommand;
|
|
306
|
-
class RotateCmd extends ButtplugDeviceMessage {
|
|
307
|
-
static Create(deviceIndex, commands) {
|
|
308
|
-
const cmdList = new Array();
|
|
309
|
-
let i = 0;
|
|
310
|
-
for (const [speed, clockwise] of commands) {
|
|
311
|
-
cmdList.push(new RotateSubcommand(i, speed, clockwise));
|
|
312
|
-
++i;
|
|
313
|
-
}
|
|
314
|
-
return new RotateCmd(cmdList, deviceIndex);
|
|
315
|
-
}
|
|
316
|
-
constructor(Rotations, DeviceIndex = -1, Id = exports.DEFAULT_MESSAGE_ID) {
|
|
317
|
-
super(DeviceIndex, Id);
|
|
318
|
-
this.Rotations = Rotations;
|
|
319
|
-
this.DeviceIndex = DeviceIndex;
|
|
320
|
-
this.Id = Id;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
exports.RotateCmd = RotateCmd;
|
|
324
|
-
RotateCmd.Name = 'RotateCmd';
|
|
325
|
-
class VectorSubcommand extends GenericMessageSubcommand {
|
|
326
|
-
constructor(Index, Position, Duration) {
|
|
327
|
-
super(Index);
|
|
328
|
-
this.Position = Position;
|
|
329
|
-
this.Duration = Duration;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
exports.VectorSubcommand = VectorSubcommand;
|
|
333
|
-
class LinearCmd extends ButtplugDeviceMessage {
|
|
334
|
-
static Create(deviceIndex, commands) {
|
|
335
|
-
const cmdList = new Array();
|
|
336
|
-
let i = 0;
|
|
337
|
-
for (const cmd of commands) {
|
|
338
|
-
cmdList.push(new VectorSubcommand(i, cmd[0], cmd[1]));
|
|
339
|
-
++i;
|
|
340
|
-
}
|
|
341
|
-
return new LinearCmd(cmdList, deviceIndex);
|
|
342
|
-
}
|
|
343
|
-
constructor(Vectors, DeviceIndex = -1, Id = exports.DEFAULT_MESSAGE_ID) {
|
|
344
|
-
super(DeviceIndex, Id);
|
|
345
|
-
this.Vectors = Vectors;
|
|
346
|
-
this.DeviceIndex = DeviceIndex;
|
|
347
|
-
this.Id = Id;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
exports.LinearCmd = LinearCmd;
|
|
351
|
-
LinearCmd.Name = 'LinearCmd';
|
|
352
|
-
class SensorReadCmd extends ButtplugDeviceMessage {
|
|
353
|
-
constructor(DeviceIndex, SensorIndex, SensorType, Id = exports.DEFAULT_MESSAGE_ID) {
|
|
354
|
-
super(DeviceIndex, Id);
|
|
355
|
-
this.DeviceIndex = DeviceIndex;
|
|
356
|
-
this.SensorIndex = SensorIndex;
|
|
357
|
-
this.SensorType = SensorType;
|
|
358
|
-
this.Id = Id;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
exports.SensorReadCmd = SensorReadCmd;
|
|
362
|
-
SensorReadCmd.Name = 'SensorReadCmd';
|
|
363
|
-
class SensorReading extends ButtplugDeviceMessage {
|
|
364
|
-
constructor(DeviceIndex, SensorIndex, SensorType, Data, Id = exports.DEFAULT_MESSAGE_ID) {
|
|
365
|
-
super(DeviceIndex, Id);
|
|
366
|
-
this.DeviceIndex = DeviceIndex;
|
|
367
|
-
this.SensorIndex = SensorIndex;
|
|
368
|
-
this.SensorType = SensorType;
|
|
369
|
-
this.Data = Data;
|
|
370
|
-
this.Id = Id;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
exports.SensorReading = SensorReading;
|
|
374
|
-
SensorReading.Name = 'SensorReading';
|
|
375
|
-
class RawReadCmd extends ButtplugDeviceMessage {
|
|
376
|
-
constructor(DeviceIndex, Endpoint, ExpectedLength, Timeout, Id = exports.DEFAULT_MESSAGE_ID) {
|
|
377
|
-
super(DeviceIndex, Id);
|
|
378
|
-
this.DeviceIndex = DeviceIndex;
|
|
379
|
-
this.Endpoint = Endpoint;
|
|
380
|
-
this.ExpectedLength = ExpectedLength;
|
|
381
|
-
this.Timeout = Timeout;
|
|
382
|
-
this.Id = Id;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
exports.RawReadCmd = RawReadCmd;
|
|
386
|
-
RawReadCmd.Name = 'RawReadCmd';
|
|
387
|
-
class RawWriteCmd extends ButtplugDeviceMessage {
|
|
388
|
-
constructor(DeviceIndex, Endpoint, Data, WriteWithResponse, Id = exports.DEFAULT_MESSAGE_ID) {
|
|
389
|
-
super(DeviceIndex, Id);
|
|
390
|
-
this.DeviceIndex = DeviceIndex;
|
|
391
|
-
this.Endpoint = Endpoint;
|
|
392
|
-
this.Data = Data;
|
|
393
|
-
this.WriteWithResponse = WriteWithResponse;
|
|
394
|
-
this.Id = Id;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
exports.RawWriteCmd = RawWriteCmd;
|
|
398
|
-
RawWriteCmd.Name = 'RawWriteCmd';
|
|
399
|
-
class RawSubscribeCmd extends ButtplugDeviceMessage {
|
|
400
|
-
constructor(DeviceIndex, Endpoint, Id = exports.DEFAULT_MESSAGE_ID) {
|
|
401
|
-
super(DeviceIndex, Id);
|
|
402
|
-
this.DeviceIndex = DeviceIndex;
|
|
403
|
-
this.Endpoint = Endpoint;
|
|
404
|
-
this.Id = Id;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
exports.RawSubscribeCmd = RawSubscribeCmd;
|
|
408
|
-
RawSubscribeCmd.Name = 'RawSubscribeCmd';
|
|
409
|
-
class RawUnsubscribeCmd extends ButtplugDeviceMessage {
|
|
410
|
-
constructor(DeviceIndex, Endpoint, Id = exports.DEFAULT_MESSAGE_ID) {
|
|
411
|
-
super(DeviceIndex, Id);
|
|
412
|
-
this.DeviceIndex = DeviceIndex;
|
|
413
|
-
this.Endpoint = Endpoint;
|
|
414
|
-
this.Id = Id;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
exports.RawUnsubscribeCmd = RawUnsubscribeCmd;
|
|
418
|
-
RawUnsubscribeCmd.Name = 'RawUnsubscribeCmd';
|
|
419
|
-
class RawReading extends ButtplugDeviceMessage {
|
|
420
|
-
constructor(DeviceIndex, Endpoint, Data, Id = exports.DEFAULT_MESSAGE_ID) {
|
|
421
|
-
super(DeviceIndex, Id);
|
|
422
|
-
this.DeviceIndex = DeviceIndex;
|
|
423
|
-
this.Endpoint = Endpoint;
|
|
424
|
-
this.Data = Data;
|
|
425
|
-
this.Id = Id;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
exports.RawReading = RawReading;
|
|
429
|
-
RawReading.Name = 'RawReading';
|
|
46
|
+
var OutputType;
|
|
47
|
+
(function (OutputType) {
|
|
48
|
+
OutputType["Unknown"] = "Unknown";
|
|
49
|
+
OutputType["Vibrate"] = "Vibrate";
|
|
50
|
+
OutputType["Rotate"] = "Rotate";
|
|
51
|
+
OutputType["Oscillate"] = "Oscillate";
|
|
52
|
+
OutputType["Constrict"] = "Constrict";
|
|
53
|
+
OutputType["Inflate"] = "Inflate";
|
|
54
|
+
OutputType["Position"] = "Position";
|
|
55
|
+
OutputType["PositionWithDuration"] = "PositionWithDuration";
|
|
56
|
+
OutputType["Temperature"] = "Temperature";
|
|
57
|
+
OutputType["Spray"] = "Spray";
|
|
58
|
+
OutputType["Led"] = "Led";
|
|
59
|
+
})(OutputType || (exports.OutputType = OutputType = {}));
|
|
60
|
+
var InputType;
|
|
61
|
+
(function (InputType) {
|
|
62
|
+
InputType["Unknown"] = "Unknown";
|
|
63
|
+
InputType["Battery"] = "Battery";
|
|
64
|
+
InputType["RSSI"] = "RSSI";
|
|
65
|
+
InputType["Button"] = "Button";
|
|
66
|
+
InputType["Pressure"] = "Pressure";
|
|
67
|
+
// Temperature,
|
|
68
|
+
// Accelerometer,
|
|
69
|
+
// Gyro,
|
|
70
|
+
})(InputType || (exports.InputType = InputType = {}));
|
|
71
|
+
var InputCommandType;
|
|
72
|
+
(function (InputCommandType) {
|
|
73
|
+
InputCommandType["Read"] = "Read";
|
|
74
|
+
InputCommandType["Subscribe"] = "Subscribe";
|
|
75
|
+
InputCommandType["Unsubscribe"] = "Unsubscribe";
|
|
76
|
+
})(InputCommandType || (exports.InputCommandType = InputCommandType = {}));
|
|
430
77
|
//# sourceMappingURL=Messages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Messages.js","sourceRoot":"","sources":["../../../../src/core/Messages.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,sCAAsC;AACtC,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"Messages.js","sourceRoot":"","sources":["../../../../src/core/Messages.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,sCAAsC;AACtC,YAAY,CAAC;;;AA6Bb,sBAOC;AAED,4BAQC;AA5CD,6CAAoD;AAEvC,QAAA,iBAAiB,GAAG,CAAC,CAAC;AACtB,QAAA,kBAAkB,GAAG,CAAC,CAAC;AACvB,QAAA,MAAM,GAAG,UAAU,CAAC;AACpB,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAC/B,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAmB3C,CAAC;AAEF,SAAgB,KAAK,CAAC,GAAoB;IACxC,KAAK,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;YACvB,OAAO,KAAK,CAAC,EAAE,CAAC;QAClB,CAAC;IACH,CAAC;IACD,MAAM,IAAI,iCAAoB,CAAC,WAAW,GAAG,uBAAuB,CAAC,CAAC;AACxE,CAAC;AAED,SAAgB,QAAQ,CAAC,GAAoB,EAAE,EAAU;IACvD,KAAK,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;YACvB,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;YACd,OAAO;QACT,CAAC;IACH,CAAC;IACD,MAAM,IAAI,iCAAoB,CAAC,WAAW,GAAG,uBAAuB,CAAC,CAAC;AACxE,CAAC;AAUD,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,6DAAa,CAAA;IACb,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,qDAAS,CAAA;IACT,2DAAY,CAAA;AACd,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB;AA+DD,IAAY,UAYX;AAZD,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,iCAAmB,CAAA;IACnB,+BAAiB,CAAA;IACjB,qCAAuB,CAAA;IACvB,qCAAuB,CAAA;IACvB,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,2DAA6C,CAAA;IAC7C,yCAA2B,CAAA;IAC3B,6BAAe,CAAA;IACf,yBAAW,CAAA;AACb,CAAC,EAZW,UAAU,0BAAV,UAAU,QAYrB;AAED,IAAY,SASX;AATD,WAAY,SAAS;IACnB,gCAAmB,CAAA;IACnB,gCAAmB,CAAA;IACnB,0BAAa,CAAA;IACb,8BAAiB,CAAA;IACjB,kCAAqB,CAAA;IACrB,eAAe;IACf,iBAAiB;IACjB,QAAQ;AACV,CAAC,EATW,SAAS,yBAAT,SAAS,QASpB;AAED,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,iCAAa,CAAA;IACb,2CAAuB,CAAA;IACvB,+CAA2B,CAAA;AAC7B,CAAC,EAJW,gBAAgB,gCAAhB,gBAAgB,QAI3B"}
|
package/dist/main/src/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';
|
package/dist/main/src/index.js
CHANGED
|
@@ -21,15 +21,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
21
21
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
__exportStar(require("./client/
|
|
24
|
+
__exportStar(require("./client/ButtplugClient"), exports);
|
|
25
25
|
__exportStar(require("./client/ButtplugClientDevice"), exports);
|
|
26
26
|
__exportStar(require("./client/ButtplugBrowserWebsocketClientConnector"), exports);
|
|
27
27
|
__exportStar(require("./client/ButtplugNodeWebsocketClientConnector"), exports);
|
|
28
28
|
__exportStar(require("./client/ButtplugClientConnectorException"), exports);
|
|
29
29
|
__exportStar(require("./utils/ButtplugMessageSorter"), exports);
|
|
30
|
+
__exportStar(require("./client/ButtplugClientDeviceCommand"), exports);
|
|
30
31
|
__exportStar(require("./client/IButtplugClientConnector"), exports);
|
|
32
|
+
//export * from './core/MessageClasses';
|
|
31
33
|
__exportStar(require("./core/Messages"), exports);
|
|
32
|
-
|
|
34
|
+
//export * from './core/MessageUtils';
|
|
33
35
|
__exportStar(require("./core/Logging"), exports);
|
|
34
36
|
__exportStar(require("./core/Exceptions"), exports);
|
|
35
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;AAEH,0DAAwC;AACxC,gEAA8C;AAC9C,mFAAiE;AACjE,gFAA8D;AAC9D,4EAA0D;AAC1D,gEAA8C;AAC9C,uEAAqD;AACrD,oEAAkD;AAClD,wCAAwC;AACxC,kDAAgC;AAChC,sCAAsC;AACtC,iDAA+B;AAC/B,oDAAkC"}
|