protocol WearablesInterface: Sendable
devices
: [DeviceIdentifier]
[Get] |
The current list of devices available.
|
registrationState
: RegistrationState
[Get] |
The current registration state of the user's devices. See RegistrationState for options.
|
addDevicesListener
(
listener
)
|
Adds a listener to receive callbacks when the device list changes. The listener is immediately called with the current devices.
Signature
public func addDevicesListener(_ listener: @Sendable @escaping ([DeviceIdentifier]) -> Void) -> AnyListenerToken Parameters _ listener: @Sendable @escaping ([DeviceIdentifier]) -> Void
The callback to execute when the device list changes.
Returns AnyListenerToken
A token that can be used to cancel the listener. When the token deinits the listener is also canceled.
|
addRegistrationStateListener
(
listener
)
|
Adds a listener to receive callbacks when the registration state changes. The listener is immediately called with the current state.
Signature
public func addRegistrationStateListener(_ listener: @Sendable @escaping (RegistrationState) -> Void) -> AnyListenerToken Parameters _ listener: @Sendable @escaping (RegistrationState) -> Void
The callback to execute when the registration state changes.
Returns AnyListenerToken
A token that can be used to cancel the listener. When the token deinits the listener is also canceled.
|
checkPermissionStatus
(
permission
)
|
Checks if a specific permission is granted for the current application.
Signature
public func checkPermissionStatus(_ permission: Permission) -> PermissionStatus Parameters Throws |
createSession
(
deviceSelector
)
|
Creates a new DeviceSession for the device resolved by the given selector.
Fails if a non-stopped session already exists for the resolved device. After the session has stopped or been released, a new one can be created. Call DeviceSession.start() to connect, then add capabilities such as DeviceSession/addStream(config:) once the session reaches DeviceSessionState.started.
Signature
public func createSession( deviceSelector: DeviceSelector) -> DeviceSession Parameters Throws |
deviceForIdentifier
(
identifier
)
|
Fetch the underlying Device object for a given DeviceIdentifier.
Signature
public func deviceForIdentifier(_ identifier: DeviceIdentifier) -> Device? Parameters |
devicesStream
()
|
Creates an AsyncStream for observing device list changes.
Signature
public func devicesStream() -> AsyncStream<[DeviceIdentifier]> Returns AsyncStream<[DeviceIdentifier]> |
deviceStateStream
(
identifier
)
|
Creates an AsyncStream for observing device state changes on a specific device.
Signature
public func deviceStateStream(for identifier: DeviceIdentifier) -> AsyncStream<DeviceState> Parameters Returns AsyncStream<DeviceState>
A stream that yields DeviceState values when the device state changes (e.g. thermal level).
|
handleUrl
(
url
)
|
Handles callback URLs from the Meta AI app during registration and permission flows.
This method must be called when your app receives a URL callback after the user completes an action in the Meta AI app. This includes callbacks from startRegistration(), startUnregistration(), and permission requests.
The SDK will determine if the URL is relevant to the Wearables Device Access Toolkit. If not relevant, the method returns false without throwing an error.
## Platform Flow On iOS, the Meta AI app returns to your app via a URL scheme callback. You must: 1. Configure your app's URL schemes in Info.plist 2. Implement URL handling in your app delegate or scene delegate 3. Call this method with the received URL
Signature
public func handleUrl(_ url: URL) -> Bool Parameters _ url: URL
The incoming URL to handle.
Returns Bool true if the URL was handled by the Wearables Device Access Toolkit, false if it's not relevant to the Wearables Device Access Toolkit.
Throws |
openDATGlassesAppUpdate
()
|
Opens the DAT glasses app update screen in the Meta AI app.
Developer mode apps are routed to the developer app management surface, while production apps are routed to the app connections page for the configured Meta app identifier.
Signature
public func openDATGlassesAppUpdate() Throws |
openFirmwareUpdate
()
|
Opens the firmware update screen in the Meta AI app for the connected device.
This method launches the Meta AI app and navigates directly to the firmware update screen. The user can then check for and install any available firmware updates.
Signature
public func openFirmwareUpdate() Throws |
registrationStateStream
()
|
Creates an AsyncStream for observing registration state changes.
Signature
public func registrationStateStream() -> AsyncStream<RegistrationState> Returns AsyncStream<RegistrationState> |
requestPermission
(
permission
)
|
Requests a specific permission on AI glasses.
This method opens the Meta AI app where the user completes the permission request flow. After the user responds in the Meta AI app, your app will receive a callback URL that must be passed to handleUrl(_:) to complete the permission request.
Signature
public func requestPermission(_ permission: Permission) -> PermissionStatus Parameters Throws |
startRegistration
()
|
Initiates the registration process with AI glasses.
This method opens the Meta AI app where the user completes the registration flow. After the user completes the flow in the Meta AI app, your app will receive a callback URL that must be passed to handleUrl(_:) to complete the registration.
The registrationState property will be updated throughout the registration process.
Signature
public func startRegistration() Throws |
startUnregistration
()
|
Initiates the unregistration process with AI glasses.
This method opens the Meta AI app where the user completes the unregistration flow. After the user completes the flow in the Meta AI app, your app will receive a callback URL that must be passed to handleUrl(_:) to complete the unregistration.
The registrationState property will be updated throughout the unregistration process.
Signature
public func startUnregistration() Throws |