본문으로 건너뛰기

중지 Find Device

Request connected device 중지 its firmware-defined locate-device indication.

사전 요구 사항

전에 calling 이 API, ensure:

  • 기기 입니다 connected 및 ready
  • 기기 supports DeviceFindAPI protocol

API Reference

Framework

AIBuds.xcframework

Import

Swift
import AIBuds

프로토콜

stopFindDevice method 입니다 defined 에서 DeviceFindAPI.

Swift
/// Controls the locate-device indication on a connected device.
///
/// This API operates on the device represented by the conforming object. It
/// does not perform Bluetooth discovery or scan for nearby devices.
public protocol DeviceFindAPI: DeviceAPI {
    /// Requests that the connected device stop its locate-device indication.
    /// - Parameters:
    ///   - completion: Called when command processing completes.
    ///     - success: `true` when the device accepted the stop command;
    ///       otherwise, `false`.
    ///     - error: The command or communication error, or `nil` on success.
    func stopFindDevice(_ completion: AIBudsCompletionHandler?)
}

인스턴스 메서드

Requests connected device 중지 its locate-device indication.

Swift
/// Requests that the connected device stop its locate-device indication.
/// - Parameters:
///   - completion: Called when command processing completes.
///     - success: `true` when the device accepted the stop command; otherwise,
///       `false`.
///     - error: The command or communication error, or `nil` on success.
func stopFindDevice(_ completion: AIBudsCompletionHandler?)

매개변수

매개변수타입설명
completionAIBudsCompletionHandler?선택적 handler called 때 command processing completes.

콜백 Parameters:

이름타입설명
successBool / BOOLtrue 때 기기 accepted 중지 command; 그렇지 않으면 false.
errorNSError?command 또는 communication 오류, 또는 nil on 성공.

반환값

이 method 하지 않습니다 반환 value directly. result 입니다 provided 통해 완료 핸들러.

사용 예제

Swift
import AIBuds

final class DeviceManager {
    weak var device: DeviceConvertible?

    func stopFindingDevice() {
        guard let device = device as? DeviceFindAPI else {
            print("Device does not support finding")
            return
        }

        device.stopFindDevice { success, error in
            guard success else {
                print("Failed to stop finding: \(error?.localizedDescription ?? "Unknown error")")
                return
            }

            print("Stop command accepted")
        }
    }
}

오류 처리

확인 success 전에 showing 중지 command was accepted, 및 사용 error 위한 command 또는 communication failures. 하지 마세요 assume fixed 오류 codes 입니다 아닌 documented 위한 target device.

권장 사항

  1. 확인 Protocol Conformance: 검증 DeviceFindAPI support 전에 calling method.
  2. Track UI State Locally: protocol 하지 않습니다 expose property 보고서 whether finding 입니다 active.
  3. Update UI on 메인 큐: Dispatch UIKit updates 에서 완료 핸들러 메인 큐.

참고

  • 공개 API 하지 않습니다 define result 의 calling 중지 때 no finding operation 입니다 active.
  • 기기-specific locate indication 입니다 outside 이 API contract.
  • 이 stops 기기-side indication. It 하지 않습니다 중지 iPhone-side find-iPhone alert; alert 입니다 owned by 호스트 앱.