UNPKG

fleeta-api-lib

Version:

A comprehensive library for fleet management applications - API, Auth, Device management

217 lines 5.87 kB
/** * Multi-Device WebRTC Provider Types * 다중 디바이스 실시간 스트리밍을 위한 타입 정의 * * 🎯 Pure API Types Only - No UI Components */ /** * Stream quality levels */ export type StreamQuality = 'high' | 'medium' | 'low'; /** * Stream type classification */ export type StreamType = 'main' | 'preview'; /** * Available camera channels */ export type CameraChannel = 'front' | 'rear' | 'interior' | 'exterior'; /** * WebRTC connection state */ export type ConnectionState = 'idle' | 'connecting' | 'connected' | 'disconnected' | 'failed'; /** * Two-way audio communication status */ export type TwoWayAudioStatus = 'free' | 'busy' | 'active' | 'error'; /** * Voice communication state */ export interface VoiceCommState { isActive: boolean; isStarting: boolean; status: TwoWayAudioStatus; error: string | null; localAudioEnabled: boolean; remoteAudioVolume: number; localAudioStream: MediaStream | null; remoteAudioStream: MediaStream | null; } /** * Stream update callback data */ export interface StreamUpdateEvent { psn: string; channel: CameraChannel; stream: MediaStream; type: StreamType; quality: StreamQuality; timestamp: number; } /** * Stream callback function type */ export type StreamCallback = (event: StreamUpdateEvent) => void; /** * Voice communication callback function type */ export type VoiceCommCallback = (psn: string, state: VoiceCommState) => void; /** * Device stream configuration */ export interface DeviceStreamConfig { psn: string; initialChannel: CameraChannel; availableChannels: CameraChannel[]; } interface ConnectionStats { } /** * Pool statistics interface for monitoring connection pool performance */ export interface PoolStats { totalConnections: number; activeConnections: number; idleConnections: number; memoryUsage: number; bandwidthUsage: number; connectionsByQuality: Record<StreamQuality, number>; } /** * Pooled connection information */ export interface PooledConnection { connection: import('./WebRTCConnection').MultiDeviceWebRTCConnection; channel: CameraChannel; quality: StreamQuality; createdAt: number; lastUsed: number; isActive: boolean; } /** /** * Device statistics */ export interface DeviceStats { psn: string; activeConnections: number; bandwidthUsage: number; memoryUsage: number; currentChannel: CameraChannel; connectionStates: Record<CameraChannel, ConnectionState>; lastChannelSwitch: number; totalChannelSwitches: number; voiceCommState: VoiceCommState; } /** * Multi-device statistics */ export interface MultiDeviceStats { totalDevices: number; connectedDevices: number; totalConnections: number; totalBandwidth: number; memoryUsage: number; deviceStats: DeviceStats[]; lastUpdated: number; activeVoiceComm: number; } /** * Multi-device provider configuration */ export interface MultiDeviceProviderConfig { maxDevices: number; maxConnectionsPerDevice: number; defaultQuality: StreamQuality; enableConnectionPooling: boolean; connectionTimeout: number; poolCleanupInterval: number; enableStatistics: boolean; statisticsInterval: number; enableVoiceCommSupport: boolean; } /** * Device manager events interface */ export interface DeviceManagerEvents { onStreamUpdate?: StreamCallback; onConnectionStateChange?: (psn: string, channel: CameraChannel, state: ConnectionState) => void; onChannelChanged?: (psn: string, oldChannel: CameraChannel, newChannel: CameraChannel) => void; onError?: (psn: string, error: Error) => void; onStatsUpdate?: (psn: string, stats: DeviceStats) => void; onVoiceCommStateChange?: VoiceCommCallback; } /** * Device manager configuration interface */ export interface DeviceManagerConfig { initialChannel: CameraChannel; defaultQuality: StreamQuality; enableConnectionPooling: boolean; connectionTimeout: number; enableVoiceCommSupport: boolean; } /** * Multi-device connection configuration interface */ export interface MultiDeviceConnectionConfig { deviceId: string; channel: CameraChannel; quality: StreamQuality; clientId: string; role: 'VIEWER' | 'MASTER'; enableStats: boolean; statsInterval: number; enableVoiceComm: boolean; onStateChange?: (state: ConnectionState) => void; onError?: (error: Error) => void; onStreamReceived?: (stream: MediaStream) => void; onStatsUpdate?: (stats: ConnectionStats) => void; onVoiceCommStateChange?: (state: VoiceCommState) => void; } /** * Multi-device provider events interface */ export interface MultiDeviceProviderEvents { onDeviceAdded?: (psn: string) => void; onDeviceRemoved?: (psn: string) => void; onGlobalStatsUpdate?: (stats: MultiDeviceStats) => void; onError?: (error: Error) => void; onVoiceCommStateChange?: VoiceCommCallback; } /** * Connection pool configuration */ export interface ConnectionPoolConfig { maxConnections: Record<StreamQuality, number>; connectionTTL: number; cleanupInterval: number; retryAttempts: number; retryDelay: number; } /** * Quality adaptation configuration */ export interface QualityAdaptationConfig { enableAdaptation: boolean; adaptationRules: { deviceCount: Array<{ threshold: number; quality: StreamQuality; }>; bandwidth: Array<{ threshold: number; quality: StreamQuality; }>; memory: Array<{ threshold: number; quality: StreamQuality; }>; }; } /** * Default quality adaptation configuration */ export declare const DEFAULT_QUALITY_ADAPTATION: QualityAdaptationConfig; export {}; //# sourceMappingURL=types.d.ts.map