使用する @capgo/capacitor-bluetooth-low-energy
Capacitor Bluetooth Low Energy プラグイン for BLE 通信。
インストール
bun add @capgo/capacitor-bluetooth-low-energy
bunx cap sync
このプラグインが公開するもの
initialize- BLE プラグインを初期化する。どの他のメソッドも呼び出す前に必ず実行する。shimWebBluetooth- Capacitor Web Bluetooth shim をインストールする。navigator.bluetooth. API Web Bluetooth を Capacitor ネイティブ アプリから呼び出す前に、手動で呼び出す。isAvailable- デバイス上の Bluetooth が利用可能かどうかを確認する。isEnabled- デバイス上の Bluetooth が有効かどうかを確認する。
使用例
initialize
BLE プラグインを初期化します。どの他のメソッドよりも前に呼び出す必要があります。
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
await BluetoothLowEnergy.initialize({ mode: 'central' });
shimWebBluetooth
Capacitor Web Bluetooth シムをインストールします。 navigator.bluetoothAPI Web Bluetooth を使用する前に、Capacitor ネイティブ アプリから API を手動で呼び出してください。
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
BluetoothLowEnergy.shimWebBluetooth();
isAvailable
デバイス上の Bluetooth が利用可能かどうかを確認します。
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
const { available } = await BluetoothLowEnergy.isAvailable();
isEnabled
デバイス上の Bluetooth が有効かどうかを確認します。
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
const { enabled } = await BluetoothLowEnergy.isEnabled();
フル リファレンス
- GitHub: https://github.com/Cap-go/capacitor-bluetooth-low-energy/
- /docs/plugins/bluetooth-low-energy/
Using @capgo/capacitor-bluetooth-low-energy を使用している場合
Using @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-bluetooth-low-energy Using @capgo/capacitor-bluetooth-low-energy ネイティブ プラグインの作業を計画するには、 @capgo/capacitor-Bluetooth Low Energy @capgo/capacitor-Bluetooth Low Energyの実装詳細 Getting Started Getting Startedの実装詳細 Capgo プラグイン ディレクトリ Capgo プラグイン ディレクトリの製品ワークフロー Capacitor プラグインズ by Capgo Capacitor プラグインズ by Capgoの実装詳細 プラグインの追加または更新 プラグインの追加または更新の実装詳細