### showInstallBanner usage Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/detect/README.md Use this lower-level primitive to drive the install banner manually. The default CTA opens the guided setup flow at https://beacio.com/setup; override with startOnboardingUrl or appStoreUrl. ```typescript import { showInstallBanner, removeInstallBanner } from '@beacio/core/detect'; showInstallBanner({ mode: 'sheet', // 'sheet' (iOS bottom sheet, default) or 'banner' operatorName: 'FitTracker', // your app name shown in the prompt dismissDays: 14, // suppress after dismiss }); ``` -------------------------------- ### Install @beacio/core and @beacio/detect with npm Source: https://github.com/wklm/beacio-sdk/blob/main/wiki/Home.md Install the core SDK and detection packages via npm. This is the first step in the quick start workflow. ```bash npm install @beacio/core @beacio/detect ``` -------------------------------- ### InstallationWizard Source: https://github.com/wklm/beacio-sdk/blob/main/packages/react-sdk/README.md Guides users through beacio extension installation on Safari iOS. Provides an onComplete callback when installation is finished. ```APIDOC ## InstallationWizard ### Description Guides users through beacio extension installation on Safari iOS. ### Usage ```tsx import { InstallationWizard } from '@beacio/react'; console.log('Extension installed!')} /> ``` ### Props - **onComplete** (function) - Required - Callback invoked when the installation process is complete. ``` -------------------------------- ### Install @beacio/react and @beacio/core Source: https://github.com/wklm/beacio-sdk/blob/main/packages/react-sdk/README.md Install the required packages using npm. ```bash npm install @beacio/react @beacio/core ``` -------------------------------- ### Install @beacio/detect Source: https://github.com/wklm/beacio-sdk/blob/main/wiki/Extension-Detection.md Install the detection package via npm. ```bash npm install @beacio/detect ``` -------------------------------- ### Setup BeacioProvider with Namespace Source: https://github.com/wklm/beacio-sdk/blob/main/wiki/React-SDK.md Alternative provider setup using the namespace style. ```tsx import { beacio } from '@beacio/react'; function App() { return ( ); } ``` -------------------------------- ### Use InstallationWizard Source: https://github.com/wklm/beacio-sdk/blob/main/packages/react-sdk/README.md The InstallationWizard component guides users through the installation of the beacio extension on Safari iOS. ```tsx import { InstallationWizard } from '@beacio/react'; console.log('Extension installed!')} /> ``` -------------------------------- ### Install @ios-web-bluetooth/core Source: https://github.com/wklm/beacio-sdk/wiki/Core-SDK Install the core SDK package using npm. ```bash npm install @ios-web-bluetooth/core ``` -------------------------------- ### Install React SDK and core packages Source: https://github.com/wklm/beacio-sdk/wiki/React-SDK Install the React SDK and core packages via npm. Optionally add @ios-web-bluetooth/detect for automatic iOS Safari install prompts. ```bash npm install @ios-web-bluetooth/react @ios-web-bluetooth/core ``` -------------------------------- ### Typical TypeScript Setup Source: https://github.com/wklm/beacio-sdk/wiki/Extension-Detection Initialize the extension detection logic within an iOS Safari environment, providing configuration for the install banner and lifecycle callbacks. ```typescript import { initIOSWebBLE, isIOSSafari } from '@ios-web-bluetooth/detect'; if (isIOSSafari()) { await initIOSWebBLE({ operatorName: 'FitTracker', banner: { mode: 'sheet', dismissDays: 14 }, onReady: () => console.log('Extension active'), onNotInstalled: () => console.log('Prompting install'), }); } ``` -------------------------------- ### Full lifecycle example Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/README.md Demonstrates the complete workflow from checking availability and scanning to connecting, subscribing, and cleaning up. ```typescript import { beacio, BeacioError } from '@beacio/core'; const ble = new Beacio({ maxConnections: 2 }); // 1. Check availability if (!ble.isSupported) { console.log('Web Bluetooth not available'); // On iOS Safari, suggest installing the beacio extension } // 2. Scan const device = await ble.requestDevice({ filters: [{ services: ['heart_rate'] }], }); // 3. Connect await device.connectWithRetry({ maxAttempts: 3, delayMs: 500 }); // 4. Subscribe const unsub = await device.subscribeAsync('heart_rate', 'heart_rate_measurement', (value) => { console.log('Heart rate:', value.getUint8(1)); }); // 5. Handle disconnection device.on('disconnected', () => { console.log('Connection lost'); }); // 6. Clean up when done unsub(); await device.disconnect(); ``` -------------------------------- ### Install verification tools via Homebrew Source: https://github.com/wklm/beacio-sdk/blob/main/beacio-developer/references/simulator-tools.md Install the required external tools xcsift, axe, and imagemagick using Homebrew. ```bash brew install xcsift cameroncooke/axe/axe imagemagick ``` -------------------------------- ### Manual initialization for any framework Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/detect/AGENTS.md Manually call initBeacio to trigger detection and the install banner. ```typescript import { initBeacio } from '@beacio/core/detect' initBeacio({ operatorName: 'YourApp' }) // add `key: 'wbl_xxxxx'` for campaign tracking ``` -------------------------------- ### Install and import polyfill via npm Source: https://github.com/wklm/beacio-sdk/blob/main/webble-sdk-consumer/references/quickstart.md Install the core package and import the auto-configuration module for production environments. ```bash npm install @beacio/core ``` ```js import '@beacio/core/auto'; ``` -------------------------------- ### React Setup with BeacioProvider Source: https://github.com/wklm/beacio-sdk/blob/main/wiki/Extension-Detection.md Wrap your application with the BeacioProvider component to configure the SDK in a React environment. ```tsx import { BeacioProvider } from '@beacio/react'; export default function App({ children }) { return {children}; } ``` -------------------------------- ### Complete Background Sync Workflow Source: https://github.com/wklm/beacio-sdk/wiki/Background-Sync A full example demonstrating permission request, device connection, registration, and management. ```javascript const permission = await navigator.webble.backgroundSync.requestPermission(); if (permission !== 'granted') { throw new Error('Enable notifications to use background BLE alerts'); } const device = await navigator.bluetooth.requestDevice({ filters: [{ services: ['heart_rate'] }], }); await device.gatt.connect(); const keepAlive = await navigator.webble.backgroundSync.requestBackgroundConnection({ deviceId: device.id, }); const heartRateAlerts = await navigator.webble.backgroundSync.registerCharacteristicNotifications({ deviceId: device.id, serviceUUID: 'heart_rate', characteristicUUID: 'heart_rate_measurement', cooldownSeconds: 30, template: { title: 'Heart rate update', body: '{{device.name}} sent {{value.hex}} at {{timestamp}}', url: 'https://example.com/monitor', }, }); const activeRegistrations = await navigator.webble.backgroundSync.getRegistrations(); console.log(activeRegistrations.map(({ id, type }) => ({ id, type }))); await heartRateAlerts.update({ body: 'Latest payload from {{device.name}}: {{value.hex}}', }); ``` -------------------------------- ### showInstallBanner Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/detect/README.md Shows the install banner for the Beacio SDK. Use this lower-level primitive when you need to drive the banner yourself instead of using initBeacio. ```APIDOC ## showInstallBanner ### Description Shows the install banner for the Beacio SDK. Use this lower-level primitive when you need to drive the banner yourself instead of using initBeacio. ### Method Function call ### Signature showInstallBanner(options) ### Parameters #### Options Object - **mode** (string) - Optional - 'sheet' (iOS bottom sheet, default) or 'banner' - **operatorName** (string) - Required - Your app name shown in the prompt - **dismissDays** (number) - Optional - Suppress after dismiss (default 14) - **startOnboardingUrl** (string) - Optional - Override the default guided setup flow URL - **appStoreUrl** (string) - Optional - Override the App Store URL ### Example ```typescript import { showInstallBanner, removeInstallBanner } from '@beacio/core/detect'; showInstallBanner({ mode: 'sheet', // 'sheet' (iOS bottom sheet, default) or 'banner' operatorName: 'FitTracker', // your app name shown in the prompt dismissDays: 14, // suppress after dismiss }); ``` ### Notes The banner's default CTA opens the guided setup flow at https://beacio.com/setup (install → enable the Safari extension → return to your page). Override with startOnboardingUrl or appStoreUrl. ``` -------------------------------- ### Recommended initBeacio call Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/detect/AGENTS.md Use initBeacio to guide installation only when the W3C Bluetooth surface is absent. ```typescript import { initBeacio } from '@beacio/core/detect' // Only guide install when the W3C surface is absent (iOS Safari without the extension). if (navigator.bluetooth === undefined) { initBeacio({ operatorName: 'YourApp' }) } ``` -------------------------------- ### Install @beacio/skill Source: https://github.com/wklm/beacio-sdk/blob/main/packages/skill/README.md Install the @beacio/skill package via npm. The package ships only SKILL.md with no runtime code. ```bash npm install @beacio/skill ``` -------------------------------- ### Provider setup with namespace style Source: https://github.com/wklm/beacio-sdk/wiki/React-SDK Alternative provider style using WebBLE.Provider as shown in the README. ```tsx import { WebBLE } from '@ios-web-bluetooth/react'; function App() { return ( ); } ``` -------------------------------- ### Install @ios-web-bluetooth/detect Source: https://github.com/wklm/beacio-sdk/wiki/Extension-Detection Install the package using npm. ```bash npm install @ios-web-bluetooth/detect ``` -------------------------------- ### Install iOSWebBLE packages with npm Source: https://github.com/wklm/beacio-sdk/wiki/Getting-Started Install the core and detect packages for plain Web Bluetooth support and iOS Safari install prompts. Use this command in your project root. ```bash npm install @ios-web-bluetooth/core @ios-web-bluetooth/detect ``` -------------------------------- ### Setup BeacioProvider Source: https://github.com/wklm/beacio-sdk/blob/main/wiki/React-SDK.md Wrap your application with the BeacioProvider to enable BLE functionality. ```tsx import { BeacioProvider } from '@beacio/react'; function App() { return ( ); } ``` -------------------------------- ### Install @beacio/core via npm Source: https://github.com/wklm/beacio-sdk/blob/main/packages/AGENTS.md Install the core beacio SDK package. Required for any web app using Bluetooth/BLE, especially for Safari iOS support. ```bash npm install @beacio/core ``` -------------------------------- ### Minimal iOS Safari flow with initIOSWebBLE and WebBLE Source: https://github.com/wklm/beacio-sdk/wiki/Getting-Started Initializes the iOS extension, prompts installation if needed, and connects to a BLE device. requestDevice() must be called from a direct user gesture (e.g., click handler), not from page load or useEffect. The example reads a heart rate measurement and logs errors with code and suggestion. ```typescript import { initIOSWebBLE, isIOSSafari } from '@ios-web-bluetooth/detect'; import { WebBLE, WebBLEError } from '@ios-web-bluetooth/core'; if (isIOSSafari()) { await initIOSWebBLE({ operatorName: 'MyApp', banner: { mode: 'sheet', dismissDays: 14 }, onReady: () => console.log('Extension ready'), onNotInstalled: () => console.log('Prompting install'), }); } const ble = new WebBLE(); async function connect() { try { const device = await ble.requestDevice({ filters: [{ services: ['heart_rate'] }], }); await device.connect(); const value = await device.read('heart_rate', 'heart_rate_measurement'); console.log('Heart rate:', value.getUint8(1)); } catch (err) { if (err instanceof WebBLEError) { console.error(err.code, err.suggestion); } } } document.getElementById('connect')?.addEventListener('click', connect); ``` -------------------------------- ### Example: Device pairing and connection with useBluetooth and useDevice Source: https://github.com/wklm/beacio-sdk/wiki/React-SDK Complete example showing how to request a device, connect, disconnect, and handle availability states. Note that requestDevice() must be called from a user gesture, not from useEffect. ```tsx import { useState } from 'react'; import { WebBLEProvider, useBluetooth, useDevice } from '@ios-web-bluetooth/react'; function DevicePanel() { const { requestDevice, isAvailable, isSupported } = useBluetooth(); const [device, setDevice] = useState(null); const { connect, disconnect, isConnected, isConnecting } = useDevice(device); const handlePair = async () => { const nextDevice = await requestDevice({ filters: [{ services: ['heart_rate'] }], }); if (nextDevice) { setDevice(nextDevice); } }; if (!isSupported) return

Bluetooth not supported

; if (!isAvailable) return

Bluetooth not available

; return (
{!device && } {device && !isConnected && ( )} {isConnected && }
); } export default function App() { return ( ); } ``` -------------------------------- ### subscribeAsync(service, characteristic, callback): Promise<() => void> Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/README.md Awaits notification setup and gets an unsubscribe function. ```APIDOC ## subscribeAsync(service, characteristic, callback): Promise<() => void> ### Description Awaits notification setup and gets an unsubscribe function. ### Method subscribeAsync ### Parameters - **service** (string) - Required - The service UUID. - **characteristic** (string) - Required - The characteristic UUID. - **callback** (function) - Required - The callback to invoke on notification. ### Returns - **Promise<() => void>** - A promise that resolves to an unsubscribe function. ``` -------------------------------- ### peripheral.startAdvertising(options?) / peripheral.stopAdvertising() Source: https://github.com/wklm/beacio-sdk/blob/main/beacio-sdk-consumer/references/api-reference.md Starts or stops advertising the custom GATT server. ```APIDOC ## peripheral.startAdvertising(options?) / peripheral.stopAdvertising() ### Description Starts or stops advertising the custom GATT server. ### Method startAdvertising / stopAdvertising ### Parameters #### options (object) - Optional - Advertising options (not specified). ### Request Example ```ts peripheral.startAdvertising(options); peripheral.stopAdvertising(); ``` ### Response #### Success Response Returns void or a promise (not specified). ``` -------------------------------- ### Implement Device Pairing and Connection Source: https://github.com/wklm/beacio-sdk/blob/main/wiki/React-SDK.md Example demonstrating device request, connection management, and availability checks using core hooks. ```tsx import { useState } from 'react'; import { BeacioProvider, useBluetooth, useDevice } from '@beacio/react'; function DevicePanel() { const { requestDevice, isAvailable, isSupported } = useBluetooth(); const [device, setDevice] = useState(null); const { connect, disconnect, isConnected, isConnecting } = useDevice(device); const handlePair = async () => { const nextDevice = await requestDevice({ filters: [{ services: ['heart_rate'] }], }); if (nextDevice) { setDevice(nextDevice); } }; if (!isSupported) return

Bluetooth not supported

; if (!isAvailable) return

Bluetooth not available

; return (
{!device && } {device && !isConnected && ( )} {isConnected && }
); } export default function App() { return ( ); } ``` -------------------------------- ### Typical TypeScript Setup Source: https://github.com/wklm/beacio-sdk/blob/main/wiki/Extension-Detection.md Initialize the Beacio SDK within an iOS Safari environment, providing configuration for the operator name and banner behavior. ```typescript import { initBeacio, isIOSSafari } from '@beacio/detect'; if (isIOSSafari()) { await initBeacio({ operatorName: 'FitTracker', banner: { mode: 'sheet', dismissDays: 14 }, onReady: () => console.log('Extension active'), onNotInstalled: () => console.log('Prompting install'), }); } ``` -------------------------------- ### Manual detection with getExtensionInstallState Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/detect/README.md Manually check if running on iOS Safari and get the extension install state. The state is 'not-installed', 'installed-inactive', or 'active'. Use this to show your own UI or call showInstallBanner(). ```typescript import { getExtensionInstallState, isExtensionInstalled, isIOSSafari, } from '@beacio/core/detect'; if (isIOSSafari()) { const state = await getExtensionInstallState(); // 'not-installed' | 'installed-inactive' | 'active' if (state !== 'active') { // show your own UI, or use showInstallBanner() below } } ``` -------------------------------- ### Provider setup with WebBLEProvider Source: https://github.com/wklm/beacio-sdk/wiki/React-SDK Wrap your app with WebBLEProvider to enable hooks and components. This is the standard provider style. ```tsx import { WebBLEProvider } from '@ios-web-bluetooth/react'; function App() { return ( ); } ``` -------------------------------- ### Vanilla Web Bluetooth Implementation Source: https://github.com/wklm/beacio-sdk/blob/main/packages/react-sdk/README.md Example of manual device connection and notification subscription using the standard Web Bluetooth API. ```javascript navigator.bluetooth.requestDevice({ filters: [{ services: ['heart_rate'] }] }) .then(device => device.gatt.connect()) .then(server => server.getPrimaryService('heart_rate')) .then(service => service.getCharacteristic('heart_rate_measurement')) .then(characteristic => { characteristic.addEventListener('characteristicvaluechanged', (event) => { console.log('Heart Rate:', event.target.value.getUint8(1)); }); return characteristic.startNotifications(); }) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### React Provider Setup Source: https://github.com/wklm/beacio-sdk/wiki/Extension-Detection Wrap your application with the IOSWebBLEProvider to enable extension detection features in a React application. ```tsx import { IOSWebBLEProvider } from '@ios-web-bluetooth/detect/react'; export default function App({ children }) { return {children}; } ``` -------------------------------- ### Recommended full init with initBeacio Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/detect/README.md Call initBeacio once in the browser entry, guarded on navigator.bluetooth === undefined so it is a no-op where Web Bluetooth is present. It runs detection, dispatches state events, and shows the install banner unless disabled. The banner mode is 'sheet' or false to disable. State changes dispatch a beacio:statechange CustomEvent on window. ```typescript import { initBeacio } from '@beacio/core/detect'; // Only guide install when the W3C surface is absent (iOS Safari without the extension). if (navigator.bluetooth === undefined) { await initBeacio({ operatorName: 'FitTracker', // your app name shown in the prompt banner: { mode: 'sheet' }, // or false to disable onReady: () => console.log('extension active'), onInstalledInactive: () => console.log('installed, needs Safari activation'), onNotInstalled: () => console.log('not installed'), }); } ``` -------------------------------- ### BeacioProvider Source: https://github.com/wklm/beacio-sdk/blob/main/packages/react-sdk/AGENTS.md Provider component that wraps the app and provides context for all hooks. Requires an apiKey for automatic iOS Safari install prompts. ```APIDOC ## BeacioProvider ### Description Wrap your app in BeacioProvider to enable all hooks. All hooks require this context. ### Usage ```tsx import { BeacioProvider } from '@beacio/react'; function App() { return ( ); } ``` ### Config Options - **autoConnect** (boolean) - Optional - Automatically connect to devices. - **cacheTimeout** (number) - Optional - Cache timeout in milliseconds. - **retryAttempts** (number) - Optional - Number of retry attempts for connections. - **apiKey** (string) - Required - API key for enabling automatic iOS Safari install prompts via @beacio/core/detect. - **operatorName** (string) - Optional - Operator name. - **appStoreUrl** (string) - Optional - App store URL for iOS Safari install prompts. ``` -------------------------------- ### new Beacio(options?) Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/AGENTS.md Creates an SDK instance and detects the platform. Use this to initialize the SDK before requesting devices. ```APIDOC ## new Beacio(options?) ### Description Creates an SDK instance and detects the platform. Use this to initialize the SDK before requesting devices. ### Method Constructor ### Parameters - **options** (object) - Optional - Configuration options for the SDK instance. ### Example ```typescript const ble = new Beacio(); ``` ``` -------------------------------- ### Plain HTML auto-init Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/detect/AGENTS.md Use a meta tag for the key and import the auto-init module from the CDN. ```html ``` -------------------------------- ### Use beacio scaffolding CLI Source: https://github.com/wklm/beacio-sdk/blob/main/packages/mcp/README.md Commands to initialize, migrate, or verify beacio integration in a web project. ```bash npx beacio init # auto-detect framework and add the detection snippet npx beacio migrate # brownfield: patch an existing Web Bluetooth app for iOS Safari npx beacio check # verify beacio integration (add --brownfield for an existing app) ``` -------------------------------- ### Import beacio polyfill Source: https://github.com/wklm/beacio-sdk/blob/main/beacio-sdk-consumer/references/quickstart.md Import the auto-configuration module to initialize the polyfill. ```js import '@beacio/core/auto'; ``` -------------------------------- ### BeacioError Usage Example Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/README.md Example of catching and handling BeacioError instances in TypeScript, accessing error properties such as code, message, suggestion, and retryAfterMs. ```APIDOC ## BeacioError Usage Example ### Description Demonstrates how to catch and handle BeacioError instances thrown by SDK methods. ### Code Example ```typescript import { BeacioError } from '@beacio/core'; try { await device.connect(); const value = await device.read('heart_rate', 'heart_rate_measurement'); } catch (err) { if (err instanceof BeacioError) { console.log(err.code); // e.g. 'SERVICE_NOT_FOUND' console.log(err.message); // Technical detail console.log(err.suggestion); // User-facing recovery hint console.log(err.retryAfterMs); // Suggested retry delay for transient failures } } ``` ### Error Properties - **code** (string) - Typed error code, e.g. 'SERVICE_NOT_FOUND' - **message** (string) - Technical detail - **suggestion** (string) - User-facing recovery hint - **retryAfterMs** (number) - Suggested retry delay for transient failures ### Error Codes | Code | When | |------|------| | `INVALID_PARAMETER` | Invalid argument passed to an SDK method (e.g. negative timeout, malformed UUID) | | `BLUETOOTH_UNAVAILABLE` | Bluetooth is off or not supported | | `EXTENSION_NOT_INSTALLED` | iOS Safari: extension not active | | `EXTENSION_NOT_ENABLED` | iOS Safari: extension installed but not allowed on this site (aA → Manage Extensions → Allow on Every Website) | | `PERMISSION_DENIED` | User denied Bluetooth permission | | `DEVICE_NOT_FOUND` | No matching devices in range | | `DEVICE_DISCONNECTED` | Device disconnected during operation | | `CONNECTION_TIMEOUT` | Connection attempt timed out | | `SERVICE_NOT_FOUND` | Requested GATT service not on device | | `CHARACTERISTIC_NOT_FOUND` | Requested characteristic not on device | | `CHARACTERISTIC_NOT_READABLE` | Characteristic doesn't support read | | `CHARACTERISTIC_NOT_WRITABLE` | Characteristic doesn't support write | | `CHARACTERISTIC_NOT_NOTIFIABLE` | Characteristic doesn't support notifications | | `GATT_OPERATION_FAILED` | Generic GATT operation failure | | `SCAN_ALREADY_IN_PROGRESS` | Another scan is already running | | `CONNECTION_LIMIT_REACHED` | The current `beacio` instance has already reached `maxConnections` | | `USER_CANCELLED` | User dismissed the device picker | | `TIMEOUT` | Operation timed out | | `WRITE_INCOMPLETE` | A multi-part or interrupted write transferred only part of the payload | ``` -------------------------------- ### getCharacteristicName(uuid): string | undefined Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/README.md Gets human-readable characteristic name from UUID. ```APIDOC ## getCharacteristicName(uuid): string | undefined ### Description Gets human-readable characteristic name from UUID. ### Method getCharacteristicName ### Parameters - **uuid** (string) - Required - The characteristic UUID. ### Returns - **string | undefined** - The characteristic name, or undefined if not found. ``` -------------------------------- ### getServiceName(uuid): string | undefined Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/README.md Gets human-readable service name from UUID. ```APIDOC ## getServiceName(uuid): string | undefined ### Description Gets human-readable service name from UUID. ### Method getServiceName ### Parameters - **uuid** (string) - Required - The service UUID. ### Returns - **string | undefined** - The service name, or undefined if not found. ``` -------------------------------- ### BeacioDevice: name: string | undefined Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/README.md Advertised device name. ```APIDOC ## BeacioDevice: name: string | undefined ### Description Advertised device name. ### Type - **string | undefined** - The advertised name of the device, if available. ``` -------------------------------- ### Core pattern for using a profile Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/src/profiles/AGENTS.md Shows the standard workflow of requesting a device, initializing a profile, connecting, and subscribing to data. ```typescript import { HeartRateProfile } from '@beacio/core/profiles'; import { beacio } from '@beacio/core'; const ble = new Beacio(); const device = await ble.requestDevice({ filters: [{ services: ['heart_rate'] }] }); const hr = new HeartRateProfile(device); await hr.connect(); const unsub = hr.onHeartRate(({ bpm, contact, rrIntervals }) => { console.log(`${bpm} BPM, contact: ${contact}`); }); // Later: hr.stop(); ``` -------------------------------- ### connect(): Promise Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/README.md Connects to the device. ```APIDOC ## connect(): Promise ### Description Connects to the device. ### Method connect ### Returns - **Promise** - A promise that resolves when the connection is established. ``` -------------------------------- ### Initialize and connect with explicit API Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/AGENTS.md Demonstrates the core pattern of creating a Beacio instance, requesting a device with filters, connecting, and reading a characteristic value. ```typescript import { beacio } from '@beacio/core'; const ble = new Beacio(); const device = await ble.requestDevice({ filters: [{ services: ['heart_rate'] }] }); await device.connect(); const value = await device.read('heart_rate', 'heart_rate_measurement'); ``` -------------------------------- ### Run beacio check Source: https://github.com/wklm/beacio-sdk/blob/main/packages/skill/SKILL.md Run the CLI check command to verify the migration. ```bash npx beacio check ``` -------------------------------- ### Initialize iOS Safari detection for migration Source: https://github.com/wklm/beacio-sdk/blob/main/packages/skill/SKILL.md Import initBeacio from @beacio/core/detect and call it. For React/Next.js, wrap with BeacioProvider from '@beacio/react'. ```typescript import { initBeacio } from '@beacio/core/detect' initBeacio({}) // React/Next.js: wrap with from '@beacio/react' ``` -------------------------------- ### Headless onboarding with vanilla JS Source: https://github.com/wklm/beacio-sdk/blob/main/packages/core/detect/README.md For partners who render their own UI and want no beacio chrome. These primitives inject no DOM; they supply state, return link, dismissal capping, and App Store destination. Only prompt on iOS Safari without W3C surface and not if recently dismissed. ```javascript // Classic