ガイド
Bluetooth Low Energy についてのチュートリアル
Capacitor/@capgo/capacitor-bluetooth-low-energy を使用する
Capacitor Bluetooth Low Energy Plugin for BLE communication.
インストール
bun add @capgo/capacitor-bluetooth-low-energy
bunx cap sync
このプラグインが公開するもの
initialize- BLE プラグインを初期化する。どのメソッドも呼ぶ前に呼び出す必要がある。shimWebBluetooth- Capacitor Web Bluetooth シムをインストールする。navigator.bluetooth. Capacitor ネイティブ アプリから Web Bluetooth API を使用する前に、手動で呼び出す。isAvailable- デバイス上の Bluetooth が利用可能かどうかを確認する。isEnabled- デバイス上の Bluetooth が有効かどうかを確認する。
使用例
initialize
- BLE プラグインを初期化する。どのメソッドも呼ぶ前に呼び出す必要がある。
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
await BluetoothLowEnergy.initialize({ mode: 'central' });
shimWebBluetooth
- Capacitor Web Bluetooth シムをインストールする。 navigator.bluetooth. Capacitor ネイティブ アプリから Web Bluetooth 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から続けてください。
__CAPGO_KEEP_0__を使用している場合 Using @capgo/capacitor-bluetooth-low-energy __CAPGO_KEEP_0__を使用してnativeプラグインの作業を計画する場合、@__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-bluetooth-low-energyに接続してください。 @capgo/capacitor-bluetooth-low-energyの実装詳細については、@capgo/capacitor-bluetooth-low-energyを参照してください。 for the implementation detail in @capgo/capacitor-bluetooth-low-energy, Getting Startedの実装詳細については、Getting Startedを参照してください。 Getting Started Capgo プラグイン ディレクトリ Capgo プラグイン ディレクトリの製品ワークフローについて Capacitor プラグインは Capgo によって提供されます Capacitor プラグインの実装詳細については Capacitor プラグインは Capgo によって提供されます プラグインの追加または更新 プラグインの追加または更新の実装詳細