본문으로 건너뛰기

카메라 펌웨어 업데이트

Camera OTA updates firmware running on 지원되는 device's camera module. It 입니다 separate 에서 기기's main 펌웨어 업데이트.

호스트 앱 제공합니다 compatible 로컬 camera firmware package. SDK then coordinates complete upgrade 흐름: configuring 기기 핫스팟, entering Camera OTA mode, starting 로컬 HTTP 서버, sending firmware URL 기기, transferring package, 및 flashing camera firmware. 사용 stage 콜백 present 현재 operation, 및 treat final 완료 핸들러 as authoritative upgrade result.

Animated workflow

Camera OTA delivery path

로컬 package moves 에서 host-side validation 통해 SDK orchestration transfer, flashing, 및 authoritative final result.

호스트 앱

Validate Package

검증 integrity, camera-model compatibility, 및 readable 로컬 path.

SDK + device

설정 핫스팟

Prepare 기기 네트워크 used by Camera OTA 흐름.

Device

Enter OTA Mode

Switch camera module into its 펌웨어 업데이트 mode.

SDK

연결 핫스팟

Join SSID exposed 위한 staged update 세션.

SDK

시작 HTTP 서버

Expose selected 로컬 firmware package 기기.

SDK → device

전송 Firmware URL

Deliver 로컬 HTTP URL 기기 will request.

진행률 phase

Transfer Firmware

Serve package 동안 기기 downloads firmware bytes.

.transferring · 0...100
진행률 phase

Flash Firmware

camera module writes transferred firmware. 하지 마세요 interrupt.

.flashing · 0...100
Authoritative result

Final Completion

사용 final 콜백—아닌 transfer 진행률—as upgrade result.

Follow final completion 콜백 위한 authoritative result.

사전 요구 사항

  • 기기 입니다 connected 및 conforms DeviceCameraOtaAPI.
  • 로컬 firmware path 입니다 readable 및 package matches camera hardware.
  • 앱 할 수 있습니다 join 기기 핫스팟, access 로컬 네트워크, 및 keep its 로컬 HTTP 서버 사용 가능한.
  • Prevent concurrent media import, camera OTA, 또는 other 핫스팟 workflows.

AI를 활용해 구현

AI로 구현

AI로 이 워크플로 구현

공식 “AIBuds 카메라 펌웨어 업데이트” 스킬을 사용해 앱에 맞게 구현하세요.

https://docs-aibuds.github.io/ko/skills/update-aibuds-camera-firmware을 읽고 지침을 따르세요. 이 스킬로 “AIBuds 카메라 펌웨어 업데이트”을 이 iOS 프로젝트에 구현하고 검증하세요.
공식 스킬 보기

API Reference

Framework

AIBuds.xcframework

Import

Swift
import AIBuds
import AIBudsFoundation

프로토콜

DeviceCameraOtaAPI protocol inherits 에서 DeviceAPI 및 currently exposes one instance method 위한 complete Camera OTA 흐름.

인스턴스 메서드

Swift
/// Start camera OTA upgrade.
///
/// - Parameters:
///   - filePath: The readable local path of the camera firmware file.
///   - configureHotspotStartingHandler: Called when hotspot configuration starts.
///   - hotspotConfigureCompletionHandler: Called when hotspot configuration completes.
///     - success: `true` if configuration succeeded; otherwise `false`.
///     - error: The failure information, or `nil` if configuration succeeded.
///   - enterCameraOtaModeStartingHandler: Called when entry into camera OTA mode starts.
///   - enterCameraOtaModeCompletedHandler: Called when entry into camera OTA mode completes.
///     - success: `true` if the device entered OTA mode; otherwise `false`.
///     - error: The failure information, or `nil` if entry succeeded.
///   - waitingForHotspotOpenHandler: Called while waiting for the device hotspot to open.
///   - connectDeviceHotspotStartingHandler: Called when connecting to the device hotspot starts.
///     - ssid: The SSID of the device hotspot.
///   - deviceHotspotConnectCompletionHandler: Called when the hotspot connection completes.
///     - success: `true` if the connection succeeded; otherwise `false`.
///     - error: The failure information, or `nil` if the connection succeeded.
///   - httpServerStartingHandler: Called when the local HTTP server is starting.
///   - httpServerStartCompletionHandler: Called when the HTTP server start attempt completes.
///     - success: `true` if the server started; otherwise `false`.
///     - error: The failure information, or `nil` if the server started.
///   - sendingFirmwareUrlHandler: Called before sending the firmware URL to the device.
///     - firmwareUrl: The local HTTP URL that will be sent.
///   - firmwareUrlSendCompletionHandler: Called when firmware URL delivery completes.
///     - success: `true` if the URL was sent; otherwise `false`.
///     - error: The failure information, or `nil` if delivery succeeded.
///   - startCompletionHandler: Called when the Camera OTA start command completes.
///     - success: `true` if the update started; otherwise `false`.
///     - error: The failure information, or `nil` if the update started.
///   - fileTransferStartedHandler: Called when firmware transfer starts.
///   - fileTransferCompletedHandler: Called when firmware transfer completes.
///   - waitingForFlashingHandler: Called while the device is preparing to flash.
///   - flashingStartedHandler: Called when firmware flashing starts.
///   - flashingCompletedHandler: Called when firmware flashing completes.
///   - phaseProgressHandler: Reports progress for transfer and flashing.
///     - phase: `.transferring` or `.flashing`.
///     - progress: The phase progress in the range `0...100`.
///   - completionHandler: Called when the complete Camera OTA workflow finishes.
///     - success: `true` if the upgrade succeeded; otherwise `false`.
///     - error: The failure information, or `nil` if the upgrade succeeded.
func startCameraOta(
    withFilePath filePath: String,
    configureHotspotStartingHandler: AIBudsCameraOtaConfigureHotspotStartingHandler?,
    hotspotConfigureCompletionHandler: AIBudsCameraOtaHotspotConfigureCompletionHandler?,
    enterCameraOtaModeStartingHandler: AIBudsEnterCameraOtaModeStartingHandler?,
    enterCameraOtaModeCompletedHandler: AIBudsEnterCameraOtaModeCompletionHandler?,
    waitingForHotspotOpenHandler: AIBudsCameraOtaStartingToWaitForHotspotOpenHandler?,
    connectDeviceHotspotStartingHandler: AIBudsCameraOtaConnectDeviceHotspotStartingHandler?,
    deviceHotspotConnectCompletionHandler: AIBudsCameraOtaDeviceHotspotConnectCompletionHandler?,
    httpServerStartingHandler: AIBudsCameraOtaHttpServerStartingHandler?,
    httpServerStartCompletionHandler: AIBudsCameraOtaHttpServerStartCompletionHandler?,
    sendingFirmwareUrlHandler: AIBudsCameraOtaSendingFirmwareUrlHandler?,
    firmwareUrlSendCompletionHandler: AIBudsCameraOtaFirmwareUrlSendCompletionHandler?,
    startCompletionHandler: AIBudsCameraOtaStartCompletionHandler?,
    fileTransferStartedHandler: AIBudsCameraOtaFileTransferStartedHandler?,
    fileTransferCompletedHandler: AIBudsCameraOtaFileTransferCompletedHandler?,
    waitingForFlashingHandler: AIBudsCameraOtaWaitingForFlashingHandler?,
    flashingStartedHandler: AIBudsCameraOtaFlashingStartedHandler?,
    flashingCompletedHandler: AIBudsCameraOtaFlashingCompletedHandler?,
    phaseProgressHandler: AIBudsCameraOtaPhaseProgressHandler?,
    completionHandler: AIBudsCameraOtaCompletionHandler?
)

See startCameraOta 에서 API Reference.

반환값

이 method 하지 않습니다 반환 value directly. Startup, stage transitions, 진행률, 및 final result 입니다 delivered 통해 supplied handlers.

흐름 Stages

These 입니다 콜백 stages 에서 Camera OTA 흐름. They 입니다 아닌 values 의 CameraOtaProgressPhase.

단계관련 handler
설정 핫스팟configureHotspotStartingHandler, hotspotConfigureCompletionHandler
카메라 OTA 모드 진입enterCameraOtaModeStartingHandler, enterCameraOtaModeCompletedHandler
연결 device 핫스팟waitingForHotspotOpenHandler, connectDeviceHotspotStartingHandler, deviceHotspotConnectCompletionHandler
시작 로컬 HTTP 서버httpServerStartingHandler, httpServerStartCompletionHandler
전송 firmware URLsendingFirmwareUrlHandler, firmwareUrlSendCompletionHandler
시작 updatestartCompletionHandler
펌웨어 전송fileTransferStartedHandler, fileTransferCompletedHandler
Prepare 및 flashwaitingForFlashingHandler, flashingStartedHandler, flashingCompletedHandler
완료completionHandler

진행률 Phases

CameraOtaProgressPhase 에는 공개 값이 정확히 두 개 있습니다. progress 인수는 보고된 단계에 대해 다음 범위의 정수입니다: 0 부터 100 까지.

SwiftObjective-CRaw value의미
.transferringAIBudsCameraOtaProgressPhaseTransferring1Firmware file transfer 진행률.
.flashingAIBudsCameraOtaProgressPhaseFlashing2Camera 펌웨어 업데이트 진행률.

사용 예제

examples preserve every 콜백 exposed by SDK Demo. Update UI on 메인 큐 에서 production code.

Swift
guard let cameraOtaDevice = device as? DeviceCameraOtaAPI else {
    print("Camera OTA is not supported")
    return
}

cameraOtaDevice.startCameraOta(
    withFilePath: filePath,
    configureHotspotStartingHandler: {
        print("Configuring device hotspot")
    },
    hotspotConfigureCompletionHandler: { success, error in
        print(
            success
                ? "Hotspot configured"
                : "Hotspot configuration failed: \(error?.localizedDescription ?? "Unknown error")")
    },
    enterCameraOtaModeStartingHandler: {
        print("Entering Camera OTA mode")
    },
    enterCameraOtaModeCompletedHandler: { success, error in
        print(
            success
                ? "Camera OTA mode ready"
                : "Could not enter Camera OTA mode: \(error?.localizedDescription ?? "Unknown error")"
        )
    },
    waitingForHotspotOpenHandler: {
        print("Waiting for device hotspot")
    },
    connectDeviceHotspotStartingHandler: { ssid in
        print("Connecting to \(ssid)")
    },
    deviceHotspotConnectCompletionHandler: { success, error in
        print(
            success
                ? "Device hotspot connected"
                : "Hotspot connection failed: \(error?.localizedDescription ?? "Unknown error")")
    },
    httpServerStartingHandler: {
        print("Starting local HTTP server")
    },
    httpServerStartCompletionHandler: { success, error in
        print(
            success
                ? "HTTP server ready"
                : "HTTP server failed: \(error?.localizedDescription ?? "Unknown error")")
    },
    sendingFirmwareUrlHandler: { firmwareURL in
        print("Sending firmware URL: \(firmwareURL)")
    },
    firmwareUrlSendCompletionHandler: { success, error in
        print(
            success
                ? "Firmware URL sent"
                : "URL delivery failed: \(error?.localizedDescription ?? "Unknown error")")
    },
    startCompletionHandler: { success, error in
        print(
            success
                ? "Camera OTA started"
                : "Camera OTA could not start: \(error?.localizedDescription ?? "Unknown error")")
    },
    fileTransferStartedHandler: {
        print("Firmware transfer started")
    },
    fileTransferCompletedHandler: {
        print("Firmware transfer completed")
    },
    waitingForFlashingHandler: {
        print("Waiting for flashing")
    },
    flashingStartedHandler: {
        print("Firmware flashing started")
    },
    flashingCompletedHandler: {
        print("Firmware flashing completed")
    },
    phaseProgressHandler: { phase, progress in
        switch phase {
        case .transferring:
            print("Transfer: \(progress)%")
        case .flashing:
            print("Flashing: \(progress)%")
        }
    },
    completionHandler: { success, error in
        if success {
            print("Camera OTA completed successfully")
        } else {
            print("Camera OTA failed: \(error?.localizedDescription ?? "Unknown error")")
        }
    }
)

오류 처리

Camera OTA 오류 사용 AIBudsSDK.CameraOtaErrorDomainSdkCameraOtaErrorCode. public enum covers 로컬 file validation, 네트워크/핫스팟 failures, task 수명 주기 failures, OTA-mode entry failures, 및 firmware-URL delivery failures.

코드일반적인 상황
unknown, networkRequestFailed, networkTimeoutSDK cannot classify 오류 more narrowly 또는 네트워크 activity fails.
cameraOtaFileNotFound, invalidCameraOtaFile, cameraOtaTaskCreateFailedDueToFileNotFoundselected 로컬 firmware path 입니다 missing 또는 package 입니다 invalid.
hotspotDisconnectedDuringTransfer, invalidHotspotConfig기기 핫스팟 cannot be used reliably.
stageTwoTimeout, interruptedByShutdownOrLowBatteryFlashing stalls near completion 또는 기기 interrupts update.
cameraOtaTaskAlreadyRunningAnother Camera OTA task 입니다 active.
4003...4009task fails during device 연결, timeout, 핫스팟 setup, OTA-mode entry, HTTP serving, 또는 URL delivery.
5001...5010기기 rejects OTA-mode entry 또는 firmware-URL delivery because 의 command, 저장 공간, permission, channel, 또는 state conditions.

Show failing 흐름 stage rather than generic update 오류. 한 번 flashing begins, 하지 마세요 automatically 재시도, 연결 해제, shut down, 또는 시작 another 핫스팟 흐름. SDK 하지 않습니다 currently define authoritative 재시도 boundaries; confirm device recovery state 및 camera 펌웨어 버전 전에 offering another package.

권장 사항

  1. Validate 로컬 file exists 전에 calling API; package authenticity 및 camera-model compatibility remain host product's responsibility.
  2. Prevent concurrent 미디어 파일 Import, Camera OTA, 또는 other 핫스팟 workflows.
  3. Keep 앱 active 및 로컬 HTTP 서버 reachable until final completion.
  4. Dispatch UI updates 메인 큐 because 콜백 may arrive on another queue.
  5. Treat startCompletionHandler as result 의 starting OTA operation, 아닌 as final upgrade 성공.
  6. 사용 completionHandler as final result 및 검증 camera firmware state 후에 reconnecting.

참고

  • Camera OTA 사용합니다 로컬 firmware path; SDK 하지 않습니다 query 원격 update service 또는 download package.
  • phaseProgressHandler 보고서 만 transfer 및 flashing 진행률. Other 흐름 stages 사용 their dedicated 콜백.
  • 진행률 value 의 100 위한 transfer 입니다 아닌 final Camera OTA result; flashing 및 final completion still follow.
  • Safe automatic 재시도 behavior 입니다 아닌 currently defined by public SDK contract.