Panduan
Tutorial tentang 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 padanavigator.bluetooth. Panggil secara manual sebelum menggunakan Web Bluetooth API dari aplikasi native Capacitor.isAvailable- Periksa apakah Bluetooth tersedia pada perangkat.isEnabled- Periksa apakah Bluetooth telah diaktifkan pada perangkat.
Contoh Penggunaan
initialize
Initilize plugin BLE. Harus dipanggil sebelum metode lainnya.
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
await BluetoothLowEnergy.initialize({ mode: 'central' });
shimWebBluetooth
Instal shim Web Bluetooth Capacitor pada 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 apakah Bluetooth tersedia pada perangkat.
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
const { available } = await BluetoothLowEnergy.isAvailable();
isEnabled
Periksa apakah Bluetooth telah diaktifkan pada 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/
- Docs: /docs/plugins/bluetooth-low-energy/
Teruskan dari Menggunakan @capgo/capacitor-bluetooth-low-energy
If Anda menggunakan Menggunakan @capgo/capacitor-bluetooth-low-energy untuk merencanakan kerja plugin asli, hubungkan dengan @capgo/capacitor-bluetooth-low-energy untuk detail implementasi di @capgo/capacitor-bluetooth-low-energy, Panduan Pemula untuk detail implementasi di Panduan Pemula, Daftar Plugin @Capgo untuk alur kerja produk di Daftar Plugin @Capgo, Plugin @Capacitor oleh @Capgo untuk detail implementasi di Plugin @Capacitor oleh @Capgo, dan Menambahkan atau Mengupdate Plugin untuk detail implementasi di Menambahkan atau Mengupdate Plugin.