/** * Discovery types * Types for device discovery */ // Discovery event constants export const EVENT_DEVICE_ALREADY_PAIRED = 'EVENT_DEVICE_ALREADY_PAIRED' export const EVENT_DEVICE_FOUND = 'EVENT_DEVICE_FOUND' export const EVENT_DEVICE_DISCOVER_DONE = 'EVENT_DEVICE_DISCOVER_DONE' export const EVENT_BLUETOOTH_NOT_SUPPORT = 'EVENT_BLUETOOTH_NOT_SUPPORT' // Discovery event types export type DiscoveryEventType = | typeof EVENT_DEVICE_ALREADY_PAIRED | typeof EVENT_DEVICE_FOUND | typeof EVENT_DEVICE_DISCOVER_DONE | typeof EVENT_BLUETOOTH_NOT_SUPPORT // Event data types export interface DiscoveryEventData { [EVENT_DEVICE_ALREADY_PAIRED]: { devices?: string // JSON string of BluetoothDevice[] } [EVENT_DEVICE_FOUND]: { device?: string // JSON string or object } [EVENT_DEVICE_DISCOVER_DONE]: { paired?: string // JSON string of BluetoothDevice[] found?: string // JSON string of BluetoothDevice[] } [EVENT_BLUETOOTH_NOT_SUPPORT]: {} } export interface BluetoothDevice { name: string address: string deviceType?: 'bt' | 'ble' | 'dual' | 'unknown' // Type of Bluetooth connection rssi?: number // Signal strength (for BLE) isSupported?: boolean // iOS: false if not MFi/BLE, Android: usually true protocolStrings?: string[] // iOS: MFi protocols } export interface ScanResult { paired: BluetoothDevice[] found: BluetoothDevice[] }