Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Stop discovering Bluetooth devices.
my.stopBluetoothDevicesDiscovery({ success() { console.log('Stopped scanning'); } });
Page({ targetDeviceName: 'MyDevice', startScan() { my.onBluetoothDeviceFound((res) => { const targetDevice = res.devices.find( d => d.name === this.targetDeviceName ); if (targetDevice) { // Found target, stop scanning my.stopBluetoothDevicesDiscovery(); this.connectToDevice(targetDevice); } }); my.startBluetoothDevicesDiscovery(); }, connectToDevice(device) { console.log('Connecting to:', device.name); // Connect logic here } });
Page({ scanTimeout: null, startTimedScan() { my.startBluetoothDevicesDiscovery({ success: () => { // Auto-stop after 15 seconds this.scanTimeout = setTimeout(() => { my.stopBluetoothDevicesDiscovery(); my.showToast({ content: 'Scan complete' }); }, 15000); } }); }, stopScanEarly() { if (this.scanTimeout) { clearTimeout(this.scanTimeout); } my.stopBluetoothDevicesDiscovery(); } });