/** * BLE Device interface */ export interface BLEDevice { id: string; name?: string; rssi?: number; [key: string]: any; } /** * Scan configuration options */ export interface ScanOptions { timeout?: number; allowDuplicates?: boolean; } /** * User role types */ export type UserRole = 'patient' | 'nurse' | 'engineer'; /** * Characteristic notification event */ export interface CharacteristicNotification { deviceId: string; serviceUuid: string; characteristicUuid: string; value: any; } /** * Device connection state */ export interface DeviceConnectionState { deviceId: string; isConnected: boolean; isInfusionRunning: boolean; infusionLevel: number | null; notifications: { ff01: CharacteristicNotification | null; ff21: CharacteristicNotification | null; ff31: CharacteristicNotification | null; ff41: CharacteristicNotification | null; ff02: CharacteristicNotification | null; }; } /** * BLE event types */ export type BLEEventType = | 'scanResult' | 'connected' | 'disconnected' | 'BleManagerScanFailed' | 'bluetoothStateChanged' | 'characteristicChanged'; /** * BLE event payloads */ export interface BLEEvents { scanResult: { device: BLEDevice }; connected: { deviceId: string }; disconnected: { deviceId: string }; BleManagerScanFailed: { error: string }; bluetoothStateChanged: { state: string }; characteristicChanged: CharacteristicNotification; } /** * Characteristic UUIDs for notifications */ export enum CharacteristicUUID { FF01 = '0000FF01-0000-1000-8000-00805F9B34FB', FF21 = '0000FF21-0000-1000-8000-00805F9B34FB', FF31 = '0000FF31-0000-1000-8000-00805F9B34FB', FF41 = '0000FF41-0000-1000-8000-00805F9B34FB', FF02 = '0000FF02-0000-1000-8000-00805F9B34FB', } /** * BLE Manager interface */ export interface IBLEManager { isBluetoothEnabled(): Promise; requestPermissions(): Promise; startScan(options?: ScanOptions): Promise; stopScan(): Promise; connect(deviceId: string): Promise; disconnect(deviceId: string): Promise; on(event: BLEEventType, callback: (data: any) => void): void; removeAllListeners(): void; }