카메라 펌웨어 업데이트
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.
Camera OTA delivery path
로컬 package moves 에서 host-side validation 통해 SDK orchestration transfer, flashing, 및 authoritative final 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로 이 워크플로 구현
공식 “AIBuds 카메라 펌웨어 업데이트” 스킬을 사용해 앱에 맞게 구현하세요.
https://docs-aibuds.github.io/ko/skills/update-aibuds-camera-firmware을 읽고 지침을 따르세요. 이 스킬로 “AIBuds 카메라 펌웨어 업데이트”을 이 iOS 프로젝트에 구현하고 검증하세요.API Reference
Framework
AIBuds.xcframework
Import
- Swift
- Objective-C
import AIBuds
import AIBudsFoundation#import <AIBuds/AIBuds-Swift.h>
#import <AIBuds/AIBuds.h>프로토콜
DeviceCameraOtaAPI protocol inherits 에서 DeviceAPI 및 currently exposes one instance method 위한 complete Camera OTA 흐름.
인스턴스 메서드
- Swift
- Objective-C
/// 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?
)/// Start camera OTA upgrade from a local firmware path.
///
/// - Parameters:
/// - filePath: The readable local path of the camera firmware file.
/// - configureHotspotStartingHandler: Called when hotspot configuration starts.
/// - hotspotConfigureCompletionHandler: Returns configuration success and error.
/// - enterCameraOtaModeStartingHandler: Called when entry into camera OTA mode starts.
/// - enterCameraOtaModeCompletedHandler: Returns OTA-mode entry success and error.
/// - waitingForHotspotOpenHandler: Called while waiting for the device hotspot to open.
/// - connectDeviceHotspotStartingHandler: Returns the device hotspot SSID.
/// - deviceHotspotConnectCompletionHandler: Returns hotspot connection success and error.
/// - httpServerStartingHandler: Called when the local HTTP server is starting.
/// - httpServerStartCompletionHandler: Returns HTTP server start success and error.
/// - sendingFirmwareUrlHandler: Returns the local firmware URL before it is sent.
/// - firmwareUrlSendCompletionHandler: Returns URL delivery success and error.
/// - startCompletionHandler: Returns Camera OTA start success and error.
/// - fileTransferStartedHandler: Called when firmware transfer starts.
/// - fileTransferCompletedHandler: Called when firmware transfer completes.
/// - waitingForFlashingHandler: Called while the device prepares to flash.
/// - flashingStartedHandler: Called when firmware flashing starts.
/// - flashingCompletedHandler: Called when firmware flashing completes.
/// - phaseProgressHandler: Returns `Transferring` or `Flashing` and progress from `0` to `100`.
/// - completionHandler: Returns final upgrade success and error.
- (void)startCameraOtaWithFilePath:(NSString *_Nonnull)filePath
configureHotspotStartingHandler:(AIBudsCameraOtaConfigureHotspotStartingHandler _Nullable)
configureHotspotStartingHandler
hotspotConfigureCompletionHandler:
(AIBudsCameraOtaHotspotConfigureCompletionHandler _Nullable)
hotspotConfigureCompletionHandler
enterCameraOtaModeStartingHandler:
(AIBudsEnterCameraOtaModeStartingHandler _Nullable)enterCameraOtaModeStartingHandler
enterCameraOtaModeCompletedHandler:
(AIBudsEnterCameraOtaModeCompletionHandler _Nullable)enterCameraOtaModeCompletedHandler
waitingForHotspotOpenHandler:
(AIBudsCameraOtaStartingToWaitForHotspotOpenHandler _Nullable)
waitingForHotspotOpenHandler
connectDeviceHotspotStartingHandler:
(AIBudsCameraOtaConnectDeviceHotspotStartingHandler _Nullable)
connectDeviceHotspotStartingHandler
deviceHotspotConnectCompletionHandler:
(AIBudsCameraOtaDeviceHotspotConnectCompletionHandler _Nullable)
deviceHotspotConnectCompletionHandler
httpServerStartingHandler:
(AIBudsCameraOtaHttpServerStartingHandler _Nullable)httpServerStartingHandler
httpServerStartCompletionHandler:
(AIBudsCameraOtaHttpServerStartCompletionHandler _Nullable)
httpServerStartCompletionHandler
sendingFirmwareUrlHandler:
(AIBudsCameraOtaSendingFirmwareUrlHandler _Nullable)sendingFirmwareUrlHandler
firmwareUrlSendCompletionHandler:
(AIBudsCameraOtaFirmwareUrlSendCompletionHandler _Nullable)
firmwareUrlSendCompletionHandler
startCompletionHandler:
(AIBudsCameraOtaStartCompletionHandler _Nullable)startCompletionHandler
fileTransferStartedHandler:
(AIBudsCameraOtaFileTransferStartedHandler _Nullable)fileTransferStartedHandler
fileTransferCompletedHandler:
(AIBudsCameraOtaFileTransferCompletedHandler _Nullable)fileTransferCompletedHandler
waitingForFlashingHandler:
(AIBudsCameraOtaWaitingForFlashingHandler _Nullable)waitingForFlashingHandler
flashingStartedHandler:
(AIBudsCameraOtaFlashingStartedHandler _Nullable)flashingStartedHandler
flashingCompletedHandler:
(AIBudsCameraOtaFlashingCompletedHandler _Nullable)flashingCompletedHandler
phaseProgressHandler:
(AIBudsCameraOtaPhaseProgressHandler _Nullable)phaseProgressHandler
completionHandler:
(AIBudsCameraOtaCompletionHandler _Nullable)completionHandler;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 URL | sendingFirmwareUrlHandler, firmwareUrlSendCompletionHandler |
| 시작 update | startCompletionHandler |
| 펌웨어 전송 | fileTransferStartedHandler, fileTransferCompletedHandler |
| Prepare 및 flash | waitingForFlashingHandler, flashingStartedHandler, flashingCompletedHandler |
| 완료 | completionHandler |
진행률 Phases
CameraOtaProgressPhase 에는 공개 값이 정확히 두 개 있습니다. progress 인수는 보고된 단계에 대해 다음 범위의 정수입니다: 0 부터 100 까지.
| Swift | Objective-C | Raw value | 의미 |
|---|---|---|---|
.transferring | AIBudsCameraOtaProgressPhaseTransferring | 1 | Firmware file transfer 진행률. |
.flashing | AIBudsCameraOtaProgressPhaseFlashing | 2 | Camera 펌웨어 업데이트 진행률. |
사용 예제
examples preserve every 콜백 exposed by SDK Demo. Update UI on 메인 큐 에서 production code.
- Swift
- Objective-C
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")")
}
}
)id<AIBudsDeviceCameraOtaAPI> cameraOtaDevice = (id<AIBudsDeviceCameraOtaAPI>)self.device;
if (![cameraOtaDevice conformsToProtocol:@protocol(AIBudsDeviceCameraOtaAPI)]) {
NSLog(@"Camera OTA is not supported");
return;
}
[cameraOtaDevice startCameraOtaWithFilePath:filePath
configureHotspotStartingHandler:^{
NSLog(@"Configuring device hotspot");
}
hotspotConfigureCompletionHandler:^(BOOL success, NSError *_Nullable error) {
NSLog(@"%@", success ? @"Hotspot configured" : error.localizedDescription);
}
enterCameraOtaModeStartingHandler:^{
NSLog(@"Entering Camera OTA mode");
}
enterCameraOtaModeCompletedHandler:^(BOOL success, NSError *_Nullable error) {
NSLog(@"%@", success ? @"Camera OTA mode ready" : error.localizedDescription);
}
waitingForHotspotOpenHandler:^{
NSLog(@"Waiting for device hotspot");
}
connectDeviceHotspotStartingHandler:^(NSString *_Nonnull ssid) {
NSLog(@"Connecting to %@", ssid);
}
deviceHotspotConnectCompletionHandler:^(BOOL success, NSError *_Nullable error) {
NSLog(@"%@", success ? @"Device hotspot connected" : error.localizedDescription);
}
httpServerStartingHandler:^{
NSLog(@"Starting local HTTP server");
}
httpServerStartCompletionHandler:^(BOOL success, NSError *_Nullable error) {
NSLog(@"%@", success ? @"HTTP server ready" : error.localizedDescription);
}
sendingFirmwareUrlHandler:^(NSString *_Nonnull firmwareUrl) {
NSLog(@"Sending firmware URL: %@", firmwareUrl);
}
firmwareUrlSendCompletionHandler:^(BOOL success, NSError *_Nullable error) {
NSLog(@"%@", success ? @"Firmware URL sent" : error.localizedDescription);
}
startCompletionHandler:^(BOOL success, NSError *_Nullable error) {
NSLog(@"%@", success ? @"Camera OTA started" : error.localizedDescription);
}
fileTransferStartedHandler:^{
NSLog(@"Firmware transfer started");
}
fileTransferCompletedHandler:^{
NSLog(@"Firmware transfer completed");
}
waitingForFlashingHandler:^{
NSLog(@"Waiting for flashing");
}
flashingStartedHandler:^{
NSLog(@"Firmware flashing started");
}
flashingCompletedHandler:^{
NSLog(@"Firmware flashing completed");
}
phaseProgressHandler:^(AIBudsCameraOtaProgressPhase phase, NSInteger progress) {
if (phase == AIBudsCameraOtaProgressPhaseTransferring) {
NSLog(@"Transfer: %ld%%", (long)progress);
} else if (phase == AIBudsCameraOtaProgressPhaseFlashing) {
NSLog(@"Flashing: %ld%%", (long)progress);
}
}
completionHandler:^(BOOL success, NSError *_Nullable error) {
NSLog(@"%@", success ? @"Camera OTA completed successfully" : error.localizedDescription);
}];오류 처리
Camera OTA 오류 사용 AIBudsSDK.CameraOtaErrorDomain 및 SdkCameraOtaErrorCode. public enum covers 로컬 file validation, 네트워크/핫스팟 failures, task 수명 주기 failures, OTA-mode entry failures, 및 firmware-URL delivery failures.
| 코드 | 일반적인 상황 |
|---|---|
unknown, networkRequestFailed, networkTimeout | SDK cannot classify 오류 more narrowly 또는 네트워크 activity fails. |
cameraOtaFileNotFound, invalidCameraOtaFile, cameraOtaTaskCreateFailedDueToFileNotFound | selected 로컬 firmware path 입니다 missing 또는 package 입니다 invalid. |
hotspotDisconnectedDuringTransfer, invalidHotspotConfig | 기기 핫스팟 cannot be used reliably. |
stageTwoTimeout, interruptedByShutdownOrLowBattery | Flashing stalls near completion 또는 기기 interrupts update. |
cameraOtaTaskAlreadyRunning | Another Camera OTA task 입니다 active. |
4003...4009 | task 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.
권장 사항
- Validate 로컬 file exists 전에 calling API; package authenticity 및 camera-model compatibility remain host product's responsibility.
- Prevent concurrent 미디어 파일 Import, Camera OTA, 또는 other 핫스팟 workflows.
- Keep 앱 active 및 로컬 HTTP 서버 reachable until final completion.
- Dispatch UI updates 메인 큐 because 콜백 may arrive on another queue.
- Treat
startCompletionHandleras result 의 starting OTA operation, 아닌 as final upgrade 성공. - 사용
completionHandleras 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.