public override async Task <ButtplugMessage> Initialize()
 {
     BpLogger.Trace($"Initializing {Name}");
     return(await Interface.WriteValue(ButtplugConsts.SystemMsgId,
                                       Info.Characteristics[(uint)FleshlightLaunchBluetoothInfo.Chrs.Cmd],
                                       new byte[] { 0 },
                                       true));
 }
Esempio n. 2
0
        public override async Task <ButtplugMessage> InitializeAsync(CancellationToken aToken)
        {
            BpLogger.Trace($"Initializing {Name}");

            // Kick Vibrator into motor control mode, just copying what the app sends when you go to
            // create pattern mode.
            return(await Interface.WriteValueAsync(ButtplugConsts.SystemMsgId,
                                                   (uint)MysteryVibeBluetoothInfo.Chrs.ModeControl,
                                                   new byte[] { 0x43, 0x02, 0x00 }, true, aToken).ConfigureAwait(false));
        }
Esempio n. 3
0
        public override async Task InitializeAsync(CancellationToken aToken)
        {
            BpLogger.Trace($"Initializing {Name}");

            // Kick Vibrator into motor control mode, just copying what the app sends when you go to
            // create pattern mode.
            await Interface.WriteValueAsync(new byte[] { 0x43, 0x02, 0x00 },
                                            new ButtplugDeviceWriteOptions { Endpoint = Endpoints.TxMode, WriteWithResponse = true },
                                            aToken).ConfigureAwait(false);
        }
Esempio n. 4
0
        public override void StartScanning()
        {
            _scanning = true;
            var hidDevices = new HidEnumerator();

            foreach (var hid in hidDevices.Enumerate())
            {
                try
                {
                    hid.ReadProduct(out var product);
                    hid.ReadManufacturer(out var vendor);
                    var prod = Encoding.Unicode.GetString(product);
                    var vend = Encoding.Unicode.GetString(vendor);
                    prod = prod.Substring(0, prod.IndexOf('\0'));
                    vend = vend.Substring(0, vend.IndexOf('\0'));

                    BpLogger.Trace("Found HID device (" +
                                   hid.Attributes.VendorHexId + ":" + hid.Attributes.ProductHexId +
                                   "): " + vend + " - " + prod);

                    var factories = _deviceFactories.Where(x =>
                                                           x.MayBeDevice(hid.Attributes.VendorId, hid.Attributes.ProductId));
                    var buttplugHidDeviceFactories = factories as HidDeviceFactory[] ?? factories.ToArray();
                    if (buttplugHidDeviceFactories.Length != 1)
                    {
                        if (buttplugHidDeviceFactories.Any())
                        {
                            BpLogger.Warn($"Found multiple HID factories for {hid.Attributes.VendorHexId}:{hid.Attributes.ProductHexId}");
                            buttplugHidDeviceFactories.ToList().ForEach(x => BpLogger.Warn(x.GetType().Name));
                        }
                        else
                        {
                            // BpLogger.Trace("No BLE factories found for device.");
                        }

                        continue;
                    }

                    var factory = buttplugHidDeviceFactories.First();
                    BpLogger.Debug($"Found HID factory: {factory.GetType().Name}");

                    var d = factory.CreateDevice(hid);
                    InvokeDeviceAdded(new DeviceAddedEventArgs(d));
                }
                catch (Exception e)
                {
                    // TODO Figure out what exceptions can actually be thrown here.
                    BpLogger.Error(e.Message);
                }
            }

            _scanning = false;
            InvokeScanningFinished();
        }
Esempio n. 5
0
        public override async Task <ButtplugMessage> InitializeAsync(CancellationToken aToken)
        {
            BpLogger.Trace($"Initializing {Name}");
            var chr = (uint)FleshlightLaunchBluetoothInfo.Chrs.Cmd;

            if (Name == "Kiiroo Onyx2")
            {
                chr = (uint)KiirooOnyx2BluetoothInfo.Chrs.Cmd;
            }

            return(await Interface.WriteValueAsync(ButtplugConsts.SystemMsgId,
                                                   chr,
                                                   new byte[] { 0 },
                                                   true, aToken).ConfigureAwait(false));
        }
        public override void StartScanning()
        {
            BpLogger.Trace("XInputGamepadManager start scanning");
            var controllers = new[]
            {
                new Controller(UserIndex.One),
                new Controller(UserIndex.Two),
                new Controller(UserIndex.Three),
                new Controller(UserIndex.Four),
            };

            foreach (var c in controllers)
            {
                if (!c.IsConnected)
                {
                    continue;
                }

                BpLogger.Debug($"Found connected XInput Gamepad for Index {c.UserIndex}");
                var device = new XInputGamepadDevice(LogManager, c);
                InvokeDeviceAdded(new DeviceAddedEventArgs(device));
                InvokeScanningFinished();
            }
        }
Esempio n. 7
0
        private async void _adapter_DeviceAdvertised(object sender, Plugin.BLE.Abstractions.EventArgs.DeviceEventArgs e)
        {
            if (e?.Device == null)
            {
                BpLogger.Debug("Null BLE advertisement received: skipping");
                return;
            }
            string advertName = e.Device.GetPropValue <string>("BluetoothDevice.Name");

            var advertGUIDs = new List <Guid>();

            advertGUIDs.Add(e.Device.Id);
            var btAddr = e.Device.GetPropValue <string>("BluetoothDevice.Address");

            BpLogger.Trace($"Got BLE Advertisement for device: {advertName} / {btAddr}");
            if (_seenAddresses.Contains(btAddr))
            {
                BpLogger.Trace($"Ignoring advertisement for already connecting device: {btAddr}");
                return;
            }
            _seenAddresses.Add(btAddr);
            BpLogger.Trace("BLE device found: " + advertName);

            // We always need a name to match against.
            if (String.IsNullOrEmpty(advertName))
            {
                return;
            }

            // todo Add advertGUIDs back in. Not sure that ever really gets used though.
            var deviceCriteria = new BluetoothLEProtocolConfiguration(advertName);

            var deviceFactory = DeviceConfigurationManager.Manager.Find(deviceCriteria);

            // If we don't have a protocol to match the device, we can't do anything with it.
            if (deviceFactory == null || !(deviceFactory.Config is BluetoothLEProtocolConfiguration bleConfig))
            {
                BpLogger.Debug($"No usable device factory available for {advertName}.");
                return;
            }

            // If a device is turned on after scanning has started, windows seems to lose the device
            // handle the first couple of times it tries to deal with the advertisement. Just log the
            // error and hope it reconnects on a later retry.
            IButtplugDeviceImpl bleDevice = null;
            IButtplugDevice     btDevice  = null;

            try
            {
                await _adapter.ConnectToDeviceAsync(e.Device);

                bleDevice = await XamarinBluetoothDeviceInterface.Create(LogManager, bleConfig, e.Device).ConfigureAwait(false);

                btDevice = await deviceFactory.CreateDevice(LogManager, bleDevice).ConfigureAwait(false);

                InvokeDeviceAdded(new DeviceAddedEventArgs(btDevice));
            }
            catch (Exception ex)
            {
                if (btDevice != null)
                {
                    btDevice.Disconnect();
                }
                else
                {
                    bleDevice?.Disconnect();
                }

                BpLogger.Error(
                    $"Cannot connect to device {advertName} {btAddr}: {ex.Message}");
            }
        }
Esempio n. 8
0
 protected override bool HandleData(byte[] data)
 {
     BpLogger.Trace("Cyclone got data: " + BitConverter.ToString(data));
     return(true);
 }
Esempio n. 9
0
 public override void StopScanning()
 {
     BpLogger.Trace("Stopping BLE Scanning");
     _bleWatcher.Stop();
 }
Esempio n. 10
0
 public override void StartScanning()
 {
     BpLogger.Trace("Starting BLE Scanning");
     _bleWatcher.Start();
 }
Esempio n. 11
0
        public override async Task <ButtplugMessage> InitializeAsync(CancellationToken aToken)
        {
            BpLogger.Trace($"Initializing {Name}");

            // Subscribing to read updates
            await Interface.SubscribeToUpdatesAsync().ConfigureAwait(false);

            Interface.BluetoothNotifyReceived += NotifyReceived;

            // Retreiving device type info for identification.
            var writeMsg = await Interface.WriteValueAsync(ButtplugConsts.SystemMsgId, Encoding.ASCII.GetBytes("DeviceType;"), true, aToken).ConfigureAwait(false);

            if (writeMsg is Error)
            {
                BpLogger.Error($"Error requesting device info from Lovense {Name}");
                return(writeMsg);
            }

            var deviceInfoString = string.Empty;

            try
            {
                var(msg, result) =
                    await Interface.ReadValueAsync(ButtplugConsts.SystemMsgId, aToken).ConfigureAwait(false);

                if (msg is Ok && result.Length > 0)
                {
                    deviceInfoString = Encoding.ASCII.GetString(result);
                }
            }
            catch (ButtplugDeviceException)
            {
                // The device info notification isn't available immediately.
                // TODO Turn this into a task semaphore with cancellation/timeout, let system handle check timing.
                int timeout = 1000;
                while (timeout > 0)
                {
                    if (_lastNotifyReceived != string.Empty)
                    {
                        deviceInfoString = _lastNotifyReceived;
                        break;
                    }

                    timeout -= 5;
                    await Task.Delay(5).ConfigureAwait(false);
                }
            }

            BpLogger.Debug($"Received device query return for {Interface.Name}");

            // Expected Format X:YY:ZZZZZZZZZZZZ X is device type leter YY is firmware version Z is
            // bluetooth address
            var deviceInfo = deviceInfoString.Split(':');

            // If we don't get back the amount of tokens we expect, identify as unknown, log, bail.
            if (deviceInfo.Length != 3 || deviceInfo[0].Length != 1)
            {
                throw new ButtplugDeviceException(BpLogger,
                                                  $"Unknown Lovense DeviceType of {deviceInfoString} found. Please report to B******g Developers by filing an issue at https://github.com/buttplugio/b******g/");
            }

            var deviceTypeLetter = deviceInfo[0][0];

            if (deviceTypeLetter == 'C')
            {
                deviceTypeLetter = 'A';
            }

            int.TryParse(deviceInfo[1], out var deviceVersion);
            BpLogger.Trace($"Lovense DeviceType Return: {deviceTypeLetter}");
            if (!Enum.IsDefined(typeof(LovenseDeviceType), (uint)deviceTypeLetter))
            {
                // If we don't know what device this is, just assume it has a single vibrator, call
                // it unknown, log something.
                AddCommonMessages();
                throw new ButtplugDeviceException(BpLogger, $"Unknown Lovense Device of Type {deviceTypeLetter} found. Please report to B******g Developers by filing an issue at https://github.com/buttplugio/b******g/");
            }

            Name = $"Lovense {Enum.GetName(typeof(LovenseDeviceType), (uint)deviceTypeLetter)} v{deviceVersion}";

            _deviceType = (LovenseDeviceType)deviceTypeLetter;

            if (_deviceType == LovenseDeviceType.Unknown)
            {
                BpLogger.Error("Lovense device type unknown, treating as single vibrator device. Please contact developers for more info.");
            }

            switch (_deviceType)
            {
            case LovenseDeviceType.Edge:

                // Edge has 2 vibrators
                _vibratorCount++;
                break;

            case LovenseDeviceType.Nora:

                // Nora has a rotator
                AddMessageHandler <RotateCmd>(HandleRotateCmd, new MessageAttributes {
                    FeatureCount = 1
                });
                break;
            }

            // Common messages.
            AddCommonMessages();

            return(new Ok(ButtplugConsts.SystemMsgId));
        }
Esempio n. 12
0
        public override async Task InitializeAsync(CancellationToken aToken)
        {
            BpLogger.Trace($"Initializing {Name}");

            // Subscribing to read updates
            await Interface.SubscribeToUpdatesAsync().ConfigureAwait(false);

            Interface.DataReceived += NotifyReceived;

            // Retrieving device type info for identification.
            await Interface.WriteValueAsync(Encoding.ASCII.GetBytes("DeviceType;"),
                                            new ButtplugDeviceWriteOptions { WriteWithResponse = true },
                                            aToken).ConfigureAwait(false);

            await Task.WhenAny(_notificationWaiter.Task, Task.Delay(4000, aToken));

            var deviceInfoString = _notificationWaiter.Task.Result;

            BpLogger.Debug($"Received device query return for {Name}");

            // Expected Format X:YY:ZZZZZZZZZZZZ X is device type leter YY is firmware version Z is
            // bluetooth address
            var deviceInfo = deviceInfoString.Split(':');

            // If we don't get back the amount of tokens we expect, identify as unknown, log, bail.
            if (deviceInfo.Length != 3 || deviceInfo[0].Length != 1)
            {
                throw new ButtplugDeviceException(BpLogger,
                                                  $"Unknown Lovense DeviceType of {deviceInfoString} found. Please report to B******g Developers by filing an issue at https://github.com/buttplugio/b******g/");
            }

            var deviceTypeLetter = deviceInfo[0][0];

            if (deviceTypeLetter == 'C')
            {
                deviceTypeLetter = 'A';
            }

            int.TryParse(deviceInfo[1], out var deviceVersion);
            BpLogger.Trace($"Lovense DeviceType Return: {deviceTypeLetter}");
            if (!Enum.IsDefined(typeof(LovenseDeviceType), (uint)deviceTypeLetter))
            {
                // If we don't know what device this is, just assume it has a single vibrator, call
                // it unknown, log something.
                AddCommonMessages();
                throw new ButtplugDeviceException(BpLogger, $"Unknown Lovense Device of Type {deviceTypeLetter} found. Please report to B******g Developers by filing an issue at https://github.com/buttplugio/b******g/");
            }

            Name = $"Lovense {Enum.GetName(typeof(LovenseDeviceType), (uint)deviceTypeLetter)} v{deviceVersion}";

            _deviceType = (LovenseDeviceType)deviceTypeLetter;

            if (_deviceType == LovenseDeviceType.Unknown)
            {
                BpLogger.Error("Lovense device type unknown, treating as single vibrator device. Please contact developers for more info.");
            }

            switch (_deviceType)
            {
            case LovenseDeviceType.Edge:

                // Edge has 2 vibrators
                _vibratorCount++;
                break;

            case LovenseDeviceType.Nora:

                // Nora has a rotator
                AddMessageHandler <RotateCmd>(HandleRotateCmd, new MessageAttributes {
                    FeatureCount = 1
                });
                break;
            }

            // Common messages.
            AddCommonMessages();
        }
        private async void OnAdvertisementReceived(BluetoothLEAdvertisementWatcher aObj,
                                                   BluetoothLEAdvertisementReceivedEventArgs aEvent)
        {
            if (aEvent?.Advertisement == null)
            {
                BpLogger.Debug("Null BLE advertisement received: skipping");
                return;
            }

            var advertName  = aEvent.Advertisement.LocalName ?? string.Empty;
            var advertGUIDs = new List <Guid>();

            advertGUIDs.AddRange(aEvent.Advertisement.ServiceUuids ?? new Guid[] { });
            var btAddr = aEvent.BluetoothAddress;

            // BpLogger.Trace($"Got BLE Advertisement for device: {aEvent.Advertisement.LocalName} / {aEvent.BluetoothAddress}");
            if (_seenAddresses.Contains(btAddr))
            {
                // BpLogger.Trace($"Ignoring advertisement for already connecting device:
                // {aEvent.Advertisement.LocalName} / {aEvent.BluetoothAddress}");
                return;
            }

            BpLogger.Trace("BLE device found: " + advertName);

            // We always need a name to match against.
            if (advertName == string.Empty)
            {
                return;
            }

            // todo Add advertGUIDs back in. Not sure that ever really gets used though.
            var deviceCriteria = new BluetoothLEProtocolConfiguration(advertName);

            var deviceFactory = DeviceConfigurationManager.Manager.Find(deviceCriteria);

            // If we don't have a protocol to match the device, we can't do anything with it.
            if (deviceFactory == null || !(deviceFactory.Config is BluetoothLEProtocolConfiguration bleConfig))
            {
                BpLogger.Debug($"No usable device factory available for {advertName}.");
                // If we've got an actual name this time around, and we don't have any factories
                // available that match the info we have, add to our seen list so we won't keep
                // rechecking. If a device does have a factory, but doesn't connect, we still want to
                // try again.
                _seenAddresses.Add(btAddr);
                return;
            }

            var fromBluetoothAddressAsync = BluetoothLEDevice.FromBluetoothAddressAsync(btAddr);

            // Can return null if the device no longer exists, for instance if it turned off between
            // advertising and us getting here. Since we didn't get a chance to try to connect,
            // remove it from seen devices, since the user may turn it back on during this scanning period.
            if (fromBluetoothAddressAsync == null)
            {
                return;
            }

            var dev = await fromBluetoothAddressAsync;

            // If a device is turned on after scanning has started, windows seems to lose the device
            // handle the first couple of times it tries to deal with the advertisement. Just log the
            // error and hope it reconnects on a later retry.
            IButtplugDeviceImpl bleDevice = null;
            IButtplugDevice     btDevice  = null;

            try
            {
                bleDevice = await UWPBluetoothDeviceInterface.Create(LogManager, bleConfig, dev).ConfigureAwait(false);

                btDevice = await deviceFactory.CreateDevice(LogManager, bleDevice).ConfigureAwait(false);

                InvokeDeviceAdded(new DeviceAddedEventArgs(btDevice));
            }
            catch (Exception ex)
            {
                if (btDevice != null)
                {
                    btDevice.Disconnect();
                }
                else
                {
                    bleDevice?.Disconnect();
                }

                BpLogger.Error(
                    $"Cannot connect to device {advertName} {btAddr}: {ex.Message}");
            }
        }
 public override void StopScanning()
 {
     // noop
     BpLogger.Trace("XInputGamepadManager stop scanning");
 }
        private async void OnAdvertisementReceived(BluetoothLEAdvertisementWatcher aObj,
                                                   BluetoothLEAdvertisementReceivedEventArgs aEvent)
        {
            if (aEvent?.Advertisement == null)
            {
                BpLogger.Debug("Null BLE advertisement recieved: skipping");
                return;
            }

            var advertName  = aEvent.Advertisement.LocalName ?? string.Empty;
            var advertGUIDs = new List <Guid>();

            advertGUIDs.AddRange(aEvent.Advertisement.ServiceUuids ?? new Guid[] { });
            var btAddr = aEvent.BluetoothAddress;

            // BpLogger.Trace($"Got BLE Advertisement for device: {aEvent.Advertisement.LocalName} / {aEvent.BluetoothAddress}");
            if (_currentlyConnecting.Contains(btAddr))
            {
                // BpLogger.Trace($"Ignoring advertisement for already connecting device: {aEvent.Advertisement.LocalName} / {aEvent.BluetoothAddress}");
                return;
            }

            BpLogger.Trace("BLE device found: " + advertName);
            var factories = from x in _deviceFactories
                            where x.MayBeDevice(advertName, advertGUIDs)
                            select x;

            // We should always have either 0 or 1 factories.
            var buttplugBluetoothDeviceFactories = factories as UWPBluetoothDeviceFactory[] ?? factories.ToArray();

            if (buttplugBluetoothDeviceFactories.Length != 1)
            {
                if (buttplugBluetoothDeviceFactories.Any())
                {
                    BpLogger.Warn($"Found multiple BLE factories for {advertName} {btAddr}:");
                    buttplugBluetoothDeviceFactories.ToList().ForEach(x => BpLogger.Warn(x.GetType().Name));
                }
                else
                {
                    // BpLogger.Trace("No BLE factories found for device.");
                }

                return;
            }

            _currentlyConnecting.Add(btAddr);
            var factory = buttplugBluetoothDeviceFactories.First();

            BpLogger.Debug($"Found BLE factory: {factory.GetType().Name}");

            // If we actually have a factory for this device, go ahead and create the device
            var fromBluetoothAddressAsync = BluetoothLEDevice.FromBluetoothAddressAsync(btAddr);

            if (fromBluetoothAddressAsync != null)
            {
                var dev = await fromBluetoothAddressAsync;

                // If a device is turned on after scanning has started, windows seems to lose the
                // device handle the first couple of times it tries to deal with the advertisement.
                // Just log the error and hope it reconnects on a later retry.
                try
                {
                    var d = await factory.CreateDeviceAsync(dev);

                    InvokeDeviceAdded(new DeviceAddedEventArgs(d));
                }
                catch (Exception ex)
                {
                    BpLogger.Error(
                        $"Cannot connect to device {advertName} {btAddr}: {ex.Message}");
                    _currentlyConnecting.Remove(btAddr);
                    return;
                }
            }

            _currentlyConnecting.Remove(btAddr);
        }
Esempio n. 16
0
        public override async Task <ButtplugMessage> Initialize()
        {
            BpLogger.Trace($"Initializing {Name}");

            // Subscribing to read updates
            await Interface.SubscribeToUpdates();

            Interface.BluetoothNotifyReceived += NotifyReceived;

            // Retreiving device type info for identification.
            var writeMsg = await Interface.WriteValue(ButtplugConsts.SystemMsgId, Encoding.ASCII.GetBytes($"DeviceType;"), true);

            if (writeMsg is Error)
            {
                BpLogger.Error($"Error requesting device info from Lovense {Name}");
                return(writeMsg);
            }

            var(msg, result) = await Interface.ReadValue(ButtplugConsts.SystemMsgId);

            string deviceInfoString = string.Empty;

            if (msg is Ok)
            {
                deviceInfoString = Encoding.ASCII.GetString(result);
            }
            else
            {
                // The device info notification isn't available immediately.
                // TODO Turn this into a task semaphore with cancellation/timeout, let system handle check timing.
                int timeout = 500;
                while (timeout > 0)
                {
                    if (_lastNotifyReceived != string.Empty)
                    {
                        deviceInfoString = _lastNotifyReceived;
                        break;
                    }

                    timeout -= 5;
                    await Task.Delay(5);
                }
            }

            if (deviceInfoString != string.Empty)
            {
                BpLogger.Debug($"Received device query return for {Interface.Name}");
                // Expected Format X:YY:ZZZZZZZZZZZZ X is device type leter YY is firmware version Z
                // is bluetooth address
                var deviceInfo = deviceInfoString.Split(':');

                // If we don't get back the amount of tokens we expect, identify as unknown, log, bail.
                if (deviceInfo.Length != 3 || deviceInfo[0].Length != 1)
                {
                    return(BpLogger.LogErrorMsg(ButtplugConsts.SystemMsgId, Error.ErrorClass.ERROR_DEVICE,
                                                $"Unknown Lovense DeviceType of {deviceInfoString} found. Please report to B******g Developers by filing an issue at https://github.com/metafetish/b******g/"));
                }

                var deviceTypeLetter = deviceInfo[0][0];
                if (deviceTypeLetter == 'C')
                {
                    deviceTypeLetter = 'A';
                }
                int.TryParse(deviceInfo[1], out var deviceVersion);
                BpLogger.Trace($"Lovense DeviceType Return: {deviceTypeLetter}");
                if (!Enum.IsDefined(typeof(LovenseDeviceType), (uint)deviceTypeLetter))
                {
                    // If we don't know what device this is, just assume it has a single vibrator,
                    // call it unknown, log something.
                    return(BpLogger.LogErrorMsg(ButtplugConsts.SystemMsgId, Error.ErrorClass.ERROR_DEVICE,
                                                $"Unknown Lovense Device of Type {deviceTypeLetter} found. Please report to B******g Developers by filing an issue at https://github.com/metafetish/b******g/"));
                }

                Name = $"Lovense {Enum.GetName(typeof(LovenseDeviceType), (uint)deviceTypeLetter)} v{deviceVersion}";

                _deviceType = (LovenseDeviceType)deviceTypeLetter;
            }
            else
            {
                // If we for some reason don't get a device info query back, use fallback method.
                //
                // TODO Remove this branch at some point? Not sure we'll need it now since device queries seem stable.
                BpLogger.Warn($"Error retreiving device info from Lovense {Name}, using fallback method");

                // Some of the older devices seem to have issues with info lookups? Not sure why, so
                // for now use fallback method.
                switch (Interface.Name.Substring(0, 6))
                {
                case "LVS-B0":
                    _deviceType = LovenseDeviceType.Max;
                    break;

                case "LVS-A0":
                case "LVS-C0":
                    _deviceType = LovenseDeviceType.Nora;
                    break;

                case "LVS-L0":
                    _deviceType = LovenseDeviceType.Ambi;
                    break;

                default:
                    _deviceType = LovenseDeviceType.Unknown;
                    break;
                }

                Name = $"Lovense {Enum.GetName(typeof(LovenseDeviceType), (uint)_deviceType)} v{Interface.Name.Substring(Interface.Name.Length - 2)}";
            }

            if (_deviceType == LovenseDeviceType.Unknown)
            {
                BpLogger.Error("Lovense device type unknown, treating as single vibrator device. Please contact developers for more info.");
            }

            switch (_deviceType)
            {
            case LovenseDeviceType.Edge:

                // Edge has 2 vibrators
                _vibratorCount++;
                MsgFuncs.Remove(typeof(VibrateCmd));
                MsgFuncs.Add(typeof(VibrateCmd), new ButtplugDeviceWrapper(HandleVibrateCmd, new MessageAttributes()
                {
                    FeatureCount = _vibratorCount
                }));
                break;

            case LovenseDeviceType.Nora:

                // Nora has a rotator
                MsgFuncs.Add(typeof(RotateCmd), new ButtplugDeviceWrapper(HandleRotateCmd, new MessageAttributes()
                {
                    FeatureCount = 1
                }));
                break;
            }

            return(new Ok(ButtplugConsts.SystemMsgId));
        }
Esempio n. 17
0
 private void OnWatcherStopped(BluetoothLEAdvertisementWatcher aObj,
                               BluetoothLEAdvertisementWatcherStoppedEventArgs aEvent)
 {
     BpLogger.Trace("Stopped BLE Scanning");
     InvokeScanningFinished();
 }