supportsBluetoothChannelSounding
A Boolean value that indicates whether the device supports distance measurements over a Bluetooth connection.
Declaration
var supportsBluetoothChannelSounding: Bool { get }Discussion
Bluetooth Channel Sounding is a Bluetooth 6.0 specification ranging strategy that relies on a Bluetooth connection to measure distance between iPhone and a paired accessory.
Check this property before using Bluetooth Channel Sounding ranging to ensure the device has the required hardware capabilities. Running a Bluetooth Channel Sounding session on an unsupported device invalidates the session with an error.
To use Bluetooth Channel Sounding,
Pair your accessory with AccessorySetupKit; the Nearby Interaction framework only supports Bluetooth Channel Sounding with accessories paired through AccessorySetupKit.
Instantiate an NINearbyAccessoryConfiguration using the init(bluetoothChannelSoundingIdentifier:previousBluetoothIdentifier:) initializer:
guard NISession.deviceCapabilities.supportsBluetoothChannelSounding else {
print("Device doesn't support Bluetooth Channel Sounding.")
return
}
// Create a configuration for Bluetooth Channel Sounding ranging.
let config = NINearbyAccessoryConfiguration(
bluetoothChannelSoundingIdentifier: identifier,
previousBluetoothIdentifier: nil
)
session.run(config)