/** * OTA Manager - Handles firmware over-the-air updates via BLE * * Downloads firmware from backend, transfers to device via BLE, * device writes to SD card as update.ufw and reboots to apply. */ import EventEmitter from 'eventemitter3'; import type { ConnectedDevice } from '../models/Device'; import type { DeviceManager } from './DeviceManager'; /** * Firmware info */ export interface FirmwareInfo { version: string; url: string; checksum: string; releaseNotes?: string; size: number; } /** * OTA progress stages */ export type OtaStage = 'checking' | 'downloading' | 'preparing' | 'updating' | 'verifying' | 'restarting' | 'completed' | 'failed'; /** * OTA progress */ export interface OtaProgress { stage: OtaStage; progress: number; error?: string; } /** * Events emitted by OTAManager */ interface OTAManagerEvents { updateAvailable: (firmware: FirmwareInfo) => void; progress: (deviceId: string, progress: OtaProgress) => void; completed: (deviceId: string, version: string) => void; failed: (deviceId: string, error: Error) => void; } /** * OTA Manager class */ export declare class OTAManager extends EventEmitter { private firmwareCdnUrl; private deviceManager; constructor(deviceManager: DeviceManager, firmwareCdnUrl?: string); /** * Check for available firmware updates */ checkForUpdate(device: ConnectedDevice): Promise; /** * Download firmware package */ downloadFirmware(firmware: FirmwareInfo): Promise; /** * Perform firmware update via Bluetooth transfer to SD card. * * Downloads firmware from URL, transfers to device via BLE, * device writes to SD card as update.ufw and reboots to apply. * * @param grantBlob - P7: Base64-encoded 207-byte OTA grant blob. When provided, * written to CHAR_DEVICE_COMMAND before upload begins so the * device can verify the transfer against the grant's SHA-256. */ performUpdate(device: ConnectedDevice, firmware: FirmwareInfo, grantBlob?: string): Promise; private waitForReconnect; /** * Compare semantic versions */ private isNewerVersion; /** * Clean up resources */ destroy(): void; } export {}; //# sourceMappingURL=OTAManager.d.ts.map