-
Notifications
You must be signed in to change notification settings - Fork 0
Core Wear Detection Get Support
Mr.P edited this page Aug 29, 2026
·
2 revisions
Read whether the device supports wear detection and whether that feature can be configured.
- The device is connected and ready.
- The device conforms to
DeviceWearDetectionAPI.
AIBuds.xcframework
import AIBuds#import <AIBuds/AIBuds-Swift.h>
#import <AIBuds/AIBuds.h>The capability is a property of DeviceWearDetectionAPI.
/// The protocol for device wear detection API.
protocol DeviceWearDetectionAPI: DeviceAPI {
/// The wear-detection capabilities supported by the device
var wearDetectionCapability: WearDetectionCapability { get }
}/// The protocol for device wear detection API.
@protocol AIBudsDeviceWearDetectionAPI <AIBudsDeviceAPI>
/// The wear-detection capabilities supported by the device
@property(nonatomic, readonly) enum AIBudsWearDetectionCapability wearDetectionCapability;
@end| Property | Type | Description |
|---|---|---|
wearDetectionCapability |
WearDetectionCapability |
The capability currently reported by the device. |
| Swift | Objective-C | Meaning |
|---|---|---|
.none |
AIBudsWearDetectionCapabilityNone |
Not supported. |
.supportedNotConfigurable |
AIBudsWearDetectionCapabilitySupportedNotConfigurable |
Supported, but not configurable. |
.supportedAndConfigurable |
AIBudsWearDetectionCapabilitySupportedAndConfigurable |
Supported and configurable. |
import AIBuds
guard let device = device as? DeviceWearDetectionAPI else {
print("Wear detection is not exposed by this device")
return
}
switch device.wearDetectionCapability {
case .none:
print("Wear detection is not supported")
case .supportedNotConfigurable:
print("Wear detection is supported but not configurable")
case .supportedAndConfigurable:
print("Wear detection is supported and configurable")
@unknown default:
print("Unknown wear-detection capability")
}#import <AIBuds/AIBuds-Swift.h>
#import <AIBuds/AIBuds.h>
id<AIBudsDeviceWearDetectionAPI> device = (id<AIBudsDeviceWearDetectionAPI>)self.device;
if (![device conformsToProtocol:@protocol(AIBudsDeviceWearDetectionAPI)]) {
NSLog(@"Wear detection is not exposed by this device");
return;
}
switch (device.wearDetectionCapability) {
case AIBudsWearDetectionCapabilityNone:
NSLog(@"Wear detection is not supported");
break;
case AIBudsWearDetectionCapabilitySupportedNotConfigurable:
NSLog(@"Wear detection is supported but not configurable");
break;
case AIBudsWearDetectionCapabilitySupportedAndConfigurable:
NSLog(@"Wear detection is supported and configurable");
break;
}This property has no completion handler. Handle failed protocol conformance and unknown future enum values. Do not interpret .none as a transport error; it is a valid capability value.
- Read Before Configuring: Check the capability before presenting an enable/disable control.
- Preserve All Capability Levels: Do not collapse “not configurable” into “not supported.”
-
Handle Future Values: Use
@unknown defaultin Swift when switching over the enum.
- This API is a synchronous property read, not an asynchronous
getWearDetectionSupportmethod. - The SDK Demo uses this property to decide whether configuration controls should be available.
AIBuds SDK documentation · Full documentation · API Reference
- Introduction
- Getting Started
- Core Concepts
-
Core Features
- Basic Features
- Device Info
- Find Device
- Physical Operations
- Work Mode
- Work Status
- Wear Detection
- Volume Control
- Music Control
- TWS
- Equalizer
- ANC
- Audio
- Camera
- Remote Camera
- File Import
- Teleprompter
- Segment Navigation
- Live Streaming
- Device Applications
- OTA
- Camera OTA
- Service Auth
- AI Services
- Voice Assistant
- Logging
- Advanced Topics
- Releases
- Troubleshooting