How to use the buttplug.DeviceConfigurationManager.Manager 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-node-bluetoothle-manager / src / ButtplugNodeBluetoothLEDeviceManager.ts View on Github external
private OpenDevice = async (device: noble.Peripheral): Promise => {
    if (device === undefined) {
      // TODO Throw here?
    // If the device doesn't even have a name, chances are we aren't interested.
    if (device.advertisement.localName === undefined) {
    const devConfig = new BluetoothLEProtocolConfiguration([device.advertisement.localName]);
    const foundConfig = DeviceConfigurationManager.Manager.Find(devConfig);
    if (foundConfig === undefined) {
    this.logger.Debug(`Found configuration for device ${device.advertisement.localName}`);
    const [config, protocolType] = foundConfig;
    const bpDevImpl = new ButtplugNodeBluetoothLEDevice(config as BluetoothLEProtocolConfiguration, device);
    this.logger.Debug(`Connecting to noble device ${device.advertisement.localName}`);
    try {
      await bpDevImpl.Connect();
    } catch (e) {
      let errStr: string;
      switch (e) {
        case ButtplugDeviceException: {
          errStr = e.errorMessage;