How to use the buttplug.ButtplugClient function in buttplug

To help you get started, we’ve selected a few buttplug examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github buttplugio / buttplug-js / packages / buttplug-server-cli / src / local.ts View on Github external
async function main() {
  process.on("unhandledRejection", (reason, p) => {
    console.log("Unhandled Rejection at: Promise", p, "reason:", reason);
    // application specific logging, throwing an error, or other logic here

  let res;
  const p = new Promise((resolve, reject) => { res = resolve });
  const bs = new ButtplugServer();
  bs.AddDeviceManager(new ButtplugNodeBluetoothLEDeviceManager());
  const localConnector = new ButtplugEmbeddedServerConnector();
  localConnector.Server = bs;
  const bc = new ButtplugClient("Buttplug Local Client");
  await bc.Connect(localConnector);
  bc.on("deviceadded", (d) => {
    console.log(`Device Found: ${d.Name}`);
  console.log("starting scan");
  await bc.StartScanning();
  await p;
  console.log("Found a device, exiting.")
  await bc.Disconnect();
github buttplugio / buttplug-js / packages / buttplug-node-bluetoothle-manager / example / device-scanning.js View on Github external
let main = async () => {

  const connector = new Buttplug.ButtplugEmbeddedServerConnector();
  const client = new Buttplug.ButtplugClient("Device Scanning Example");
  await client.Connect(connector);

  const dm = new ButtplugBLE.ButtplugNodeBluetoothLEDeviceManager();
  console.log("Initializing Bluetooth adapter...");
  await dm.Initialize();

  console.log("Scanning for devices...");
  client.on("deviceadded", (device) => {

  await client.StartScanning();