-
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathnode-test.ts
More file actions
23 lines (22 loc) · 1.13 KB
/
node-test.ts
File metadata and controls
23 lines (22 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { ButtplugClient, ButtplugNodeWebsocketClientConnector, InputCommandType, InputType, OutputType } from '.';
import { DeviceOutput, DeviceOutputCommand } from './dist/main/src/client/ButtplugClientDeviceCommand';
async function run() {
const client = new ButtplugClient('Test Client');
await client.connect(new ButtplugNodeWebsocketClientConnector('ws://127.0.0.1:12345'));
console.log(client.devices);
//console.log(client.devices.get(0)!.hasOutput(OutputType.Vibrate));
//console.log("Vibrating");
try {
//await client.devices.get(2)!.runOutput(DeviceOutput.Vibrate.percent(0.5));
console.log(await client.devices.get(1)!.battery());
await client.devices.get(1)!.features.get(0)!.runInput(InputType.Pressure, InputCommandType.Subscribe);
} catch (e) {
console.log(e);
}
await new Promise((res, _) => setTimeout(() => res(true), 3000));
//await client.devices.get(1)!.features.get(0)!.runInput(InputType.Pressure, InputCommandType.Unsubscribe);
//console.log("stopping");
//console.log(await client.devices.get(1)!.features.get(0)!.runOutput(DeviceOutput.Vibrate.percent(0)));
}
run();
//testInterfaces();