Physical Operations Overview
Welcome to the Physical Operations documentation for the AIBuds SDK. This section covers reading and changing the mapping between physical device operations and device functions.
Available Features
Operations and Functions
Reference the physical operations and assignable functions exposed by the SDK
View Operation Mapping
Read the device's physical-operation-to-function mapping
Assign Functions
Assign a device function to a physical operation
Implement with AI Assistance
Build with AI
Implement this workflow with AI
Use the official Manage AIBuds Physical Operations skill to adapt this workflow to your app.
Read and follow https://docs-aibuds.github.io/skills/manage-aibuds-physical-operations. Use it to implement Manage AIBuds Physical Operations in this iOS project and verify the result.Getting Started
To manage physical operations, follow these steps:
- Connect to Device - Establish a connection with your AIBuds device
- Check Protocol Conformance - Verify the device conforms to
DevicePhysicalOperationsAPI - View Operation Mapping - Read
physicalOperationsMapping - Assign Functions - Assign a
DeviceFunctionto aDeviceOperation
Key Concepts
Button Mapping
- Physical Operations:
DeviceOperationrepresents clicks, long presses, touch-panel gestures, buttons, and supported slide gestures - Device Functions:
DeviceFunctiondefines assignable behaviors such as playback, volume, voice-assistant, recording, and camera actions - Mapping:
physicalOperationsMappingstores operation and function raw values asNSNumberkeys and values
Protocol Reference
Physical operations are accessed through DevicePhysicalOperationsAPI. Before reading or changing the mapping, verify protocol conformance:
- Swift
- Objective-C
guard let device = device as? DevicePhysicalOperationsAPI else {
print("Device does not support DevicePhysicalOperationsAPI")
return
}id<AIBudsDevicePhysicalOperationsAPI> device =
(id<AIBudsDevicePhysicalOperationsAPI>)self.device;
if (![device conformsToProtocol:@protocol(AIBudsDevicePhysicalOperationsAPI)]) {
NSLog(@"Device does not support AIBudsDevicePhysicalOperationsAPI");
return;
}Best Practices
- Check Protocol Conformance: Always verify the device supports the required protocol
- Use Reported Operations: Present operations contained in
physicalOperationsMapping - Handle Errors: Implement proper error handling in completion handlers
- Provide Feedback: Inform users when button mappings are successfully updated
Notes
- Button mapping availability depends on the device model
- An enum case being present in
DeviceOperationorDeviceFunctiondoes not guarantee that every device supports it - An operation or function can be unsupported even when its enum value exists; handle the assignment result
- The SDK exposes a dictionary rather than a
KeyMappingmodel or asynchronous get-mapping method