Panduan
Tutorial Menggunakan Bluetooth Low Energy
Menggunakan @capgo/capacitor-bluetooth-low-energy
Plugin Bluetooth Low Energy Capacitor untuk Komunikasi BLE.
Instal
bun add @capgo/capacitor-bluetooth-low-energy
bunx cap sync
Apa yang Dapat Diketahui Plugin Ini
initialize- Inisialisasi plugin BLE. Harus dipanggil sebelum metode lainnya.shimWebBluetooth- Pasang shim Web Bluetooth Capacitor dinavigator.bluetooth. Panggil secara manual sebelum menggunakan Web Bluetooth API dari sebuah Capacitor aplikasi native.isAvailable- Periksa apakah Bluetooth tersedia di perangkat.isEnabled- Periksa apakah Bluetooth diaktifkan di perangkat.
Contoh Penggunaan
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.bluetooth. Panggil secara manual sebelum menggunakan Web Bluetooth API dari sebuah Capacitor aplikasi native.
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
BluetoothLowEnergy.shimWebBluetooth();
isAvailable
Periksa apakah Bluetooth tersedia di perangkat.
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
const { available } = await BluetoothLowEnergy.isAvailable();
isEnabled
Periksa apakah 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/
Teruskan 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 Pembelajaran Awal untuk detail implementasi di Pembelajaran Awal, 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.