How to use the buttplug.ButtplugDevice 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.

github buttplugio / buttplug-js / packages / buttplug-node-bluetoothle-manager / src / ButtplugNodeBluetoothLEDeviceManager.ts View on Github external
case Error: {
          errStr = e.message;
          break;
        }
        default: {
          errStr = e.toString();
          break;
        }
      }
      this.logger.Info(`Error while connecting to ${device.advertisement.localName}: ${errStr}`);
      // We can't rethrow here, as this method is only called from an event
      // handler, so just return;
      return;
    }
    const bpProtocol = new protocolType(bpDevImpl);
    const bpDevice = new ButtplugDevice(bpProtocol, bpDevImpl);
    this.logger.Debug(`Initializing noble device ${device.advertisement.localName}`);
    try {
      await bpDevice.Initialize();
    } catch (e) {
      let errStr: string;
      switch (e) {
        case ButtplugDeviceException: {
          errStr = e.errorMessage;
          break;
        }
        case Error: {
          errStr = e.message;
          break;
        }
        default: {
          errStr = e.toString();