import type { AdvertisingDataTypes, BLEDevice, BackgroundSessionOptions, MultipeerSessionOptions, MultipeerPeer, MultipeerDiscoveryInfoEntry, MultipeerEncryptionPreference, MultipeerPeerState, ScanOptions, GATTService, GATTDescriptor, CharacteristicValue, DescriptorValue, BluetoothCapabilities, BluetoothPhy, BluetoothPhyOption, BondState, PhyStatus, ExtendedAdvertisingOptions, L2CAPChannel } from './specs/munim-bluetooth.nitro'; export type BluetoothEventMap = { deviceFound: BLEDevice; onDeviceFound: BLEDevice; scanResult: BLEDevice; scanFailed: { errorCode: number; message: string; }; advertisingStarted: Record; advertisingStartFailed: { error?: string; errorCode?: number; message?: string; }; classicDeviceFound: BLEDevice & { bondState?: string; }; classicScanFailed: { message: string; }; classicScanFinished: Record; classicConnected: { deviceId: string; }; classicDisconnected: { deviceId: string; }; classicConnectionReceived: { deviceId: string; }; classicServerStarted: { serviceUUID: string; serviceName: string; }; classicServerStopped: { serviceUUID: string; }; classicDataReceived: { deviceId: string; value: string; }; deviceConnected: { deviceId: string; }; deviceDisconnected: { deviceId: string; }; servicesDiscovered: { deviceId: string; services: GATTService[]; }; characteristicValueChanged: CharacteristicValue & { deviceId: string; }; l2capChannelPublished: { channelId: string; psm: number; }; l2capChannelPublishFailed: { psm?: number; error: string; }; l2capChannelUnpublished: { psm: number; error?: string; }; l2capChannelOpened: { channelId: string; psm: number; deviceId?: string; }; l2capChannelOpenFailed: { deviceId?: string; error: string; }; l2capChannelClosed: { channelId: string; psm?: number; deviceId?: string; }; l2capDataReceived: { channelId: string; psm?: number; deviceId?: string; value: string; }; peripheralReadRequest: CharacteristicValue & { centralId: string; }; peripheralWriteRequest: CharacteristicValue & { centralId: string; }; peripheralSubscribed: { centralId: string; serviceUUID: string; characteristicUUID: string; }; peripheralUnsubscribed: { centralId: string; serviceUUID: string; characteristicUUID: string; }; rssiUpdated: { deviceId: string; rssi: number; }; backgroundSessionStarted: { platform: string; serviceUUIDs?: string[]; localName?: string | null; }; backgroundSessionStopped: { platform: string; }; backgroundSessionRestored: { platform: string; role?: 'central' | 'peripheral'; isScanning?: boolean; isAdvertising?: boolean; serviceUUIDs?: string[]; deviceIds?: string[]; }; backgroundSessionStartFailed: { platform: string; error: string; }; multipeerStarted: { platform: string; serviceType: string; peerId: string; displayName: string; }; multipeerStopped: { platform: string; }; multipeerStartFailed: { platform: string; error: string; }; multipeerPeerFound: MultipeerPeer; multipeerPeerLost: { peerId: string; }; multipeerPeerStateChanged: MultipeerPeer; multipeerMessageReceived: { peerId: string; displayName: string; value: string; }; }; export type BluetoothEventName = keyof BluetoothEventMap; /** * Start advertising as a Bluetooth peripheral with platform-aware advertising data. * * @param options - An object with serviceUUIDs (string[]) and advertising data types. * iOS only advertises local name and service UUIDs. */ export declare function startAdvertising(options: { serviceUUIDs: string[]; localName?: string; manufacturerData?: string; advertisingData?: AdvertisingDataTypes; }): void; /** * Update advertising data while advertising is active. * * @param advertisingData - The new advertising data to use. */ export declare function updateAdvertisingData(advertisingData: AdvertisingDataTypes): void; /** * Get current advertising data. * * @returns Promise resolving to current advertising data. */ export declare function getAdvertisingData(): Promise; /** * Stop BLE advertising. */ export declare function stopAdvertising(): void; /** * Set GATT services and characteristics for the Bluetooth peripheral. * * @param services - An array of service objects, each with a uuid and an array of characteristics. */ export declare function setServices(services: GATTService[]): void; /** * Update a local peripheral characteristic value and optionally notify/indicate * subscribed centrals. */ export declare function updateCharacteristicValue(serviceUUID: string, characteristicUUID: string, value: string, notify?: boolean): Promise; /** * Check if Bluetooth is enabled on the device. * * @returns Promise resolving to true if Bluetooth is enabled, false otherwise. */ export declare function isBluetoothEnabled(): Promise; /** * Request Bluetooth permissions (Android) or check authorization status (iOS). * * @returns Promise resolving to true if permissions are granted, false otherwise. */ export declare function requestBluetoothPermission(): Promise; /** * Return the Bluetooth feature set supported by the current platform/device. */ export declare function getCapabilities(): Promise; /** * Start scanning for BLE devices. * * @param options - Optional scan configuration including service UUIDs to filter by. */ export declare function startScan(options?: ScanOptions): void; /** * Stop scanning for BLE devices. */ export declare function stopScan(): void; /** * Connect to a BLE device. * * @param deviceId - The unique identifier of the device to connect to. * @returns Promise resolving when connection is established or rejected. */ export declare function connect(deviceId: string): Promise; /** * Disconnect from a BLE device. * * @param deviceId - The unique identifier of the device to disconnect from. */ export declare function disconnect(deviceId: string): void; /** * Discover GATT services for a connected device. * * @param deviceId - The unique identifier of the connected device. * @returns Promise resolving to array of discovered services. */ export declare function discoverServices(deviceId: string): Promise; /** * Read a characteristic value from a connected device. * * @param deviceId - The unique identifier of the connected device. * @param serviceUUID - The UUID of the service containing the characteristic. * @param characteristicUUID - The UUID of the characteristic to read. * @returns Promise resolving to the characteristic value. */ export declare function readCharacteristic(deviceId: string, serviceUUID: string, characteristicUUID: string): Promise; /** * Read a descriptor value from a connected device. */ export declare function readDescriptor(deviceId: string, serviceUUID: string, characteristicUUID: string, descriptorUUID: string): Promise; /** * Write a value to a characteristic on a connected device. * * @param deviceId - The unique identifier of the connected device. * @param serviceUUID - The UUID of the service containing the characteristic. * @param characteristicUUID - The UUID of the characteristic to write. * @param value - The value to write (hex string). * @param writeType - Optional write type: 'write' or 'writeWithoutResponse'. Defaults to 'write'. * @returns Promise resolving when write is complete. */ export declare function writeCharacteristic(deviceId: string, serviceUUID: string, characteristicUUID: string, value: string, writeType?: 'write' | 'writeWithoutResponse'): Promise; /** * Write a descriptor value to a connected device. */ export declare function writeDescriptor(deviceId: string, serviceUUID: string, characteristicUUID: string, descriptorUUID: string, value: string): Promise; /** * Subscribe to notifications/indications from a characteristic. * * @param deviceId - The unique identifier of the connected device. * @param serviceUUID - The UUID of the service containing the characteristic. * @param characteristicUUID - The UUID of the characteristic to subscribe to. */ export declare function subscribeToCharacteristic(deviceId: string, serviceUUID: string, characteristicUUID: string): void; /** * Unsubscribe from notifications/indications from a characteristic. * * @param deviceId - The unique identifier of the connected device. * @param serviceUUID - The UUID of the service containing the characteristic. * @param characteristicUUID - The UUID of the characteristic to unsubscribe from. */ export declare function unsubscribeFromCharacteristic(deviceId: string, serviceUUID: string, characteristicUUID: string): void; /** * Get list of currently connected devices. * * @returns Promise resolving to array of connected device IDs. */ export declare function getConnectedDevices(): Promise; /** * Read RSSI (signal strength) for a connected device. * * @param deviceId - The unique identifier of the connected device. * @returns Promise resolving to RSSI value in dBm. */ export declare function readRSSI(deviceId: string): Promise; /** * Request an ATT MTU. Android supports this directly; iOS rejects with unsupported. */ export declare function requestMTU(deviceId: string, mtu: number): Promise; /** * Set preferred BLE PHY. Android 8+ supports this when hardware allows it. */ export declare function setPreferredPhy(deviceId: string, txPhy: BluetoothPhy, rxPhy: BluetoothPhy, phyOption?: BluetoothPhyOption): Promise; /** * Read current BLE PHY. Android 8+ supports this when hardware allows it. */ export declare function readPhy(deviceId: string): Promise; /** * Return current platform bond state for a device. */ export declare function getBondState(deviceId: string): Promise; /** * Start platform pairing/bonding for a device. */ export declare function createBond(deviceId: string): Promise; /** * Remove a platform bond where supported. */ export declare function removeBond(deviceId: string): Promise; /** * Start BLE extended advertising where supported. */ export declare function startExtendedAdvertising(options: ExtendedAdvertisingOptions): Promise; /** * Stop a BLE extended advertising set. */ export declare function stopExtendedAdvertising(advertisingId: string): void; /** * Publish a local BLE L2CAP channel where supported. */ export declare function publishL2CAPChannel(encryptionRequired?: boolean): Promise; /** * Stop a local BLE L2CAP channel. */ export declare function unpublishL2CAPChannel(psm: number): void; /** * Open an outbound BLE L2CAP channel. */ export declare function openL2CAPChannel(deviceId: string, psm: number): Promise; /** * Close an L2CAP channel. */ export declare function closeL2CAPChannel(channelId: string): void; /** * Send hex data over an open L2CAP channel. */ export declare function sendL2CAPData(channelId: string, value: string): Promise; /** * Start Classic Bluetooth discovery where supported. */ export declare function startClassicScan(): void; /** * Stop Classic Bluetooth discovery. */ export declare function stopClassicScan(): void; /** * Connect to a Classic Bluetooth RFCOMM service where supported. */ export declare function connectClassic(deviceId: string, serviceUUID?: string): Promise; /** * Listen for incoming Classic Bluetooth RFCOMM connections on Android. */ export declare function startClassicServer(serviceUUID?: string, serviceName?: string): Promise; /** * Stop a Classic Bluetooth RFCOMM listener on Android. */ export declare function stopClassicServer(serviceUUID?: string): void; /** * Disconnect a Classic Bluetooth device. */ export declare function disconnectClassic(deviceId: string): void; /** * Write hex data to a Classic Bluetooth RFCOMM connection. */ export declare function writeClassic(deviceId: string, value: string): Promise; /** * Start a best-effort background BLE session. * * Android uses a foreground service and restores scan/advertising/configured * GATT services after normal service process recreation. iOS relies on the host * app's Bluetooth background modes and CoreBluetooth state restoration, with * terminated-state relaunch still limited by Apple's current relaunch rules. * User force-quit/force-stop is controlled by the OS and cannot be bypassed. */ export declare function startBackgroundSession(options: BackgroundSessionOptions): void; /** * Stop the active background BLE session. */ export declare function stopBackgroundSession(): void; /** * Start Apple Multipeer Connectivity transport. This is iOS/iPadOS/macOS/tvOS * only; Android cannot join Apple Multipeer sessions. */ export declare function startMultipeerSession(options: MultipeerSessionOptions): void; /** * Stop the active Apple Multipeer Connectivity session. */ export declare function stopMultipeerSession(): void; /** * Invite a discovered Multipeer peer by runtime peer id. */ export declare function inviteMultipeerPeer(peerId: string): void; /** * Return discovered/connected Apple Multipeer peers. */ export declare function getMultipeerPeers(): Promise; /** * Send hex data over Apple Multipeer Connectivity. Omit peerIds to broadcast * to all connected peers. */ export declare function sendMultipeerMessage(value: string, peerIds?: string[], reliable?: boolean): Promise; /** * Add a device found event listener (for scanning). * * @param callback - Function to call when a device is found * @returns A function to remove the listener */ export declare function addDeviceFoundListener(callback: (device: BLEDevice) => void): () => void; /** * Add an event listener. * * @param eventName - The name of the event to listen for. * @param callback - The callback to invoke when the event occurs. * @returns A function to remove the listener */ export declare function addEventListener(eventName: EventName, callback: (data: BluetoothEventMap[EventName]) => void): () => void; /** * Add an event listener (legacy method). * * @param eventName - The name of the event to listen for. */ export declare function addListener(eventName: string): void; /** * Remove event listeners. * * @param count - Number of listeners to remove. */ export declare function removeListeners(count: number): void; export type { AdvertisingDataTypes, BLEDevice, BackgroundSessionOptions, MultipeerSessionOptions, MultipeerPeer, MultipeerDiscoveryInfoEntry, MultipeerEncryptionPreference, MultipeerPeerState, ScanOptions, GATTService, GATTDescriptor, CharacteristicValue, DescriptorValue, BluetoothCapabilities, BluetoothPhy, BluetoothPhyOption, BondState, PhyStatus, ExtendedAdvertisingOptions, L2CAPChannel, }; declare const _default: { startAdvertising: typeof startAdvertising; stopAdvertising: typeof stopAdvertising; updateAdvertisingData: typeof updateAdvertisingData; getAdvertisingData: typeof getAdvertisingData; setServices: typeof setServices; updateCharacteristicValue: typeof updateCharacteristicValue; isBluetoothEnabled: typeof isBluetoothEnabled; requestBluetoothPermission: typeof requestBluetoothPermission; getCapabilities: typeof getCapabilities; startScan: typeof startScan; stopScan: typeof stopScan; connect: typeof connect; disconnect: typeof disconnect; discoverServices: typeof discoverServices; readCharacteristic: typeof readCharacteristic; readDescriptor: typeof readDescriptor; writeCharacteristic: typeof writeCharacteristic; writeDescriptor: typeof writeDescriptor; subscribeToCharacteristic: typeof subscribeToCharacteristic; unsubscribeFromCharacteristic: typeof unsubscribeFromCharacteristic; getConnectedDevices: typeof getConnectedDevices; readRSSI: typeof readRSSI; requestMTU: typeof requestMTU; setPreferredPhy: typeof setPreferredPhy; readPhy: typeof readPhy; getBondState: typeof getBondState; createBond: typeof createBond; removeBond: typeof removeBond; startExtendedAdvertising: typeof startExtendedAdvertising; stopExtendedAdvertising: typeof stopExtendedAdvertising; publishL2CAPChannel: typeof publishL2CAPChannel; unpublishL2CAPChannel: typeof unpublishL2CAPChannel; openL2CAPChannel: typeof openL2CAPChannel; closeL2CAPChannel: typeof closeL2CAPChannel; sendL2CAPData: typeof sendL2CAPData; startClassicScan: typeof startClassicScan; stopClassicScan: typeof stopClassicScan; connectClassic: typeof connectClassic; startClassicServer: typeof startClassicServer; stopClassicServer: typeof stopClassicServer; disconnectClassic: typeof disconnectClassic; writeClassic: typeof writeClassic; startBackgroundSession: typeof startBackgroundSession; stopBackgroundSession: typeof stopBackgroundSession; startMultipeerSession: typeof startMultipeerSession; stopMultipeerSession: typeof stopMultipeerSession; inviteMultipeerPeer: typeof inviteMultipeerPeer; getMultipeerPeers: typeof getMultipeerPeers; sendMultipeerMessage: typeof sendMultipeerMessage; addDeviceFoundListener: typeof addDeviceFoundListener; addEventListener: typeof addEventListener; addListener: typeof addListener; removeListeners: typeof removeListeners; }; export default _default; //# sourceMappingURL=index.d.ts.map