Menggunakan @capgo/capacitor-bluetooth-low-energy
Capacitor Plugin Bluetooth Low Energy untuk komunikasi BLE.
Pasang
bun add @capgo/capacitor-bluetooth-low-energy
bunx cap sync
Apa yang Dibuka oleh Plugin ini
initialize- Inisialisasi plugin BLE. Harus dipanggil sebelum metode lainnya.shimWebBluetooth- Pasang shim Web Bluetooth Capacitor padanavigator.bluetoothPanggil secara manual sebelum menggunakan Web Bluetooth API dari aplikasi native Capacitor.isAvailable- Periksa jika Bluetooth tersedia pada perangkat.isEnabled- Periksa jika Bluetooth diaktifkan pada perangkat.
Penggunaan Contoh
initialize
Inisialisasi plugin BLE. Harus dipanggil sebelum metode lainnya.
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
await BluetoothLowEnergy.initialize({ mode: 'central' });
shimWebBluetooth
Pasang shim Web Bluetooth Capacitor di navigator.bluetoothPanggil secara manual sebelum menggunakan Web Bluetooth API dari aplikasi native Capacitor.
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
BluetoothLowEnergy.shimWebBluetooth();
isAvailable
Periksa jika Bluetooth tersedia di perangkat.
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
const { available } = await BluetoothLowEnergy.isAvailable();
isEnabled
Periksa jika Bluetooth diaktifkan di perangkat.
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
const { enabled } = await BluetoothLowEnergy.isEnabled();
Referensi Lengkap
- GitHub: https://github.com/Cap-go/capacitor-bluetooth-low-energy/
- Dokumen: /docs/plugins/bluetooth-low-energy/
Lanjutkan dari Menggunakan @capgo/capacitor-bluetooth-low-energy
Jika Anda menggunakan Menggunakan @capgo/capacitor-bluetooth-low-energy untuk merencanakan pekerjaan plugin native, hubungkannya dengan @capgo/capacitor-Bluetooth Low Energy untuk detail implementasi di @capgo/capacitor-Bluetooth Low Energy, Mengawali Mulai untuk detail implementasi di Mengawali Mulai, Direktori Plugin Capgo untuk alur kerja produk di Direktori Plugin Capgo, Plugin-Plugin Capacitor oleh Capgo untuk detail implementasi di Plugin-Plugin Capacitor oleh Capgo, dan Menambahkan atau Mengupdate Plugin untuk detail implementasi di Menambahkan atau Mengupdate Plugin.