Guide
Tutoriel sur Bluetooth Low Energy
Utilisation de @capgo/capacitor-bluetooth-low-energy
Capacitor Plugin Bluetooth Low Energy pour la communication BLE.
Installer
bun add @capgo/capacitor-bluetooth-low-energy
bunx cap sync
Ce Qu'Exposent Ce Plugin
initialize- Initialiser le plugin BLE. Doit être appelé avant toute autre méthode.shimWebBluetooth- Installer le Capacitor shim Web Bluetooth surnavigator.bluetoothAppeler manuellement avant d'utiliser le Web Bluetooth API à partir d'une application native Capacitor.isAvailable- Vérifier si le Bluetooth est disponible sur le dispositif.isEnabled- Vérifier si le Bluetooth est activé sur le dispositif.
Exemple d'Utilisation
initialize
- Initialiser le plugin BLE. Doit être appelé avant toute autre méthode.
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
await BluetoothLowEnergy.initialize({ mode: 'central' });
shimWebBluetooth
- Installer le Capacitor shim Web Bluetooth sur navigator.bluetoothAppeler manuellement avant d'utiliser le Web Bluetooth API à partir d'une application native Capacitor.
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
BluetoothLowEnergy.shimWebBluetooth();
isAvailable
- Vérifier si le Bluetooth est disponible sur le dispositif.
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
const { available } = await BluetoothLowEnergy.isAvailable();
isEnabled
- Vérifier si le Bluetooth est activé sur le dispositif.
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
const { enabled } = await BluetoothLowEnergy.isEnabled();
Référence complète
- GitHub: https://github.com/Cap-go/capacitor-low-energy-bluetooth/
- Documentation : /docs/plugins/low-energy-bluetooth/
Continuez à partir de l'utilisation de @capgo/capacitor-low-energy-bluetooth
Si vous utilisez L'utilisation de @capgo/capacitor-low-energy-bluetooth pour planifier le travail du plugin natif, connectez-le avec @capgo/capacitor-low-energy-bluetooth pour les détails d'implémentation dans @capgo/capacitor-low-energy-bluetooth Démarrage pour les détails d'implémentation dans Démarrage, Répertoire de plugins Capgo pour le flux de travail du produit dans le Répertoire de plugins Capgo, Plugins Capacitor par Capgo pour le détail d'implémentation dans Plugins Capacitor par Capgo, et Ajouter ou Mettre à Jour les Plugins pour le détail d'implémentation dans Ajouter ou Mettre à Jour les Plugins.