import { TurboModuleRegistry, type TurboModule } from 'react-native'; export interface BleDevice { id: string; name?: string; rssi?: number; manufacturerData?: string; serviceUUIDs?: string[]; } export interface BleService { uuid: string; characteristics: BleCharacteristic[]; } export interface BleCharacteristic { uuid: string; properties: string[]; descriptors?: BleDescriptor[]; } export interface BleDescriptor { uuid: string; } export interface BleScanOptions { serviceUUIDs?: string[]; allowDuplicates?: boolean; scanMode?: 'lowPower' | 'balanced' | 'lowLatency'; timeout?: number; } export interface BleWriteOptions { withResponse?: boolean; } export interface BleConnectionState { deviceId: string; state: 'connecting' | 'connected' | 'disconnecting' | 'disconnected'; } export interface Spec extends TurboModule { // Scanning startScan(options?: BleScanOptions): Promise; stopScan(): Promise; // Connection management connect(deviceId: string): Promise; disconnect(deviceId: string): Promise; isConnected(deviceId: string): Promise; getConnectedDevices(): Promise; // Service discovery discoverServices(deviceId: string): Promise; // Characteristic operations readCharacteristic( deviceId: string, serviceUuid: string, characteristicUuid: string ): Promise; writeCharacteristic( deviceId: string, serviceUuid: string, characteristicUuid: string, data: string, options?: BleWriteOptions ): Promise; setNotify( deviceId: string, serviceUuid: string, characteristicUuid: string, enable: boolean ): Promise; // Permissions and state requestPermissions(): Promise; isBluetoothEnabled(): Promise; enableBluetooth(): Promise; // Event listeners (these will be handled by the EventEmitter pattern) addListener(eventName: string): void; removeListeners(count: number): void; // Misc base64ToHexDash(base64: string): Promise; // Infusion control startInfusion(deviceId: string): Promise; stopInfusion(deviceId: string): Promise; setInfusionLevel(deviceId: string, level: number): Promise; // User role setUserRole(role: string): Promise; } export default TurboModuleRegistry.getEnforcing('SdkBle');