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 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 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/
- 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, hubungkan dengan @capgo/capacitor-energi rendah bluetooth untuk detail implementasi di @capgo/capacitor-energi rendah bluetooth, Mulai untuk detail implementasi di Mulai, 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.