Langkapi ke konten utama
Kembali ke plugin
@capgo/capacitor-bluetooth-low-energy
Tutorial
@capgo/capacitor-bluetooth-low-energy

Bluetooth Low Energy

Plugin BLE yang lengkap untuk melakukan pencarian, koneksi, membaca, menulis, dan menerima notifikasi dari perangkat Bluetooth

Panduan

Tutorial tentang Bluetooth Low Energy

Uji coba pada perangkat

Unduh aplikasi Capgo, kemudian scan kode QR code.

Pratinjau Tautan QR Plugin Bluetooth Low Energy code

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 pada navigator.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

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.