Skip to content

Devices & Scanning

cind3rdev edited this page Sep 14, 2023 · 2 revisions

The ButtplugManager class maintains a list of connected devices through its Devices array field. It provides functions to begin scanning for or stop scanning for devices, and lastly it exposes events for when devices are connected, disconnected, or when they change.

Scanning for Devices

To allow devices to connect, you'll need to call the StartScanning function. After being called, compatible devices will automatically start to connect, triggering the OnDeviceAdded and OnDevicesUpdated events.

To prevent additional devices from connecting, you can call StopScanning.

Device Connection Events

  • OnDevicesUpdated() - called when a device connects or disconnects from the server, or otherwise changes
  • OnDeviceAdded(FButtplugDevice Device) - called when a device connects to the server
  • OnDeviceRemoved(int32 DeviceIndex) - called when a device disconnects from the server

Stopping Devices

If you would like to stop a device from vibration, moving, rotating, etc., you can use the StopDeviceCmd(int32 DeviceIndex) function to stop an individual device, or the StopAllDevices() function to stop all connected devices.

Connected devices are automatically stopped when disconnecting from the server, or if the device itself is disconnected.

Forcing Devices array to update

You can request that the server provide an up to date list of devices using the RequestDeviceList function, but this should generally not be required, since the Devices array is automatically updated when devices connect or disconnect.

Clone this wiki locally