Cette page a été traduite automatiquement et peut contenir des erreurs. Voir l’original en anglais
Class BhapticsAppleDevices
BhapticsAppleDevices provides the API for scanning and connecting to bHaptics devices directly over CoreBluetooth on iOS and visionOS. See the iOS/visionOS Connection Guide for the overall setup and the sample UI.
remarque
Use these APIs for iOS/visionOS physical devices only.
| API | Behavior |
|---|---|
BhapticsAppleDevices.Scan() | Starts a BLE scan for nearby bHaptics devices |
BhapticsAppleDevices.StopScan() | Stops the scan |
BhapticsAppleDevices.IsScanning() | Whether a scan is in progress |
BhapticsAppleDevices.GetDevices() | List of devices — HapticDevice (name, Position, IsConnected, IsPaired) |
BhapticsAppleDevices.Pair(id) | Pair (remember) + connect |
BhapticsAppleDevices.Unpair(id) | Unpair + disconnect |
BhapticsAppleDevices.IsSupported | Whether this is an iOS/visionOS physical device (false in the Editor or on other platforms) |
// Minimal example: start scanning → poll the list → connect to the first device
BhapticsAppleDevices.Scan();
var devices = BhapticsAppleDevices.GetDevices(); // Call periodically to refresh
if (devices.Count > 0 && !devices[0].IsPaired)
{
BhapticsAppleDevices.Pair(devices[0].Address);
}