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.
Get currently connected Bluetooth devices.
my.getConnectedBluetoothDevices({ deviceId: 'XX:XX:XX:XX:XX:XX', success(res) { console.log('Connected devices:', res.devices); } });
Page({ data: { connectedDevices: [] }, checkConnections() { my.getConnectedBluetoothDevices({ deviceId: this.targetDeviceId, success: (res) => { this.setData({ connectedDevices: res.devices }); if (res.devices.length === 0) { my.showToast({ content: 'No devices connected' }); } } }); } });
Page({ targetDeviceId: 'XX:XX:XX:XX:XX:XX', checkAndReconnect() { my.getConnectedBluetoothDevices({ deviceId: this.targetDeviceId, success: (res) => { const isConnected = res.devices.some( d => d.deviceId === this.targetDeviceId ); if (!isConnected) { this.reconnectDevice(); } } }); }, reconnectDevice() { my.connectBLEDevice({ deviceId: this.targetDeviceId, success: () => { my.showToast({ content: 'Reconnected' }); } }); } });