@capgo/capacitor-bluetooth-low-energyを使用
Capacitor Bluetooth Low Energy プラグインはBLE通信に使用されます。
インストール
bun add @capgo/capacitor-bluetooth-low-energy
bunx cap sync
このプラグインが提供するもの
initialize- BLE プラグインを初期化する。どの他のメソッドよりも前に呼び出す必要があります。shimWebBluetooth- Capacitor Web Bluetooth シムを__CAPGO_KEEP_1__にインストールする。navigator.bluetoothAPIをCapacitorのWeb Bluetooth APIから呼び出す前に、.を呼び出してください。isAvailable- デバイス上のBluetoothが利用可能かどうかを確認する。isEnabled- __CAPGO_KEEP_0__ を有効にしているかどうかを確認してください。
Example Usage
initialize
BLE プラグインを初期化します。どのメソッドも呼び出す前に呼び出す必要があります。
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
await BluetoothLowEnergy.initialize({ mode: 'central' });
shimWebBluetooth
Capacitor Web Bluetooth shim をインストールしてください。 navigator.bluetooth. API を呼び出す前に、 Capacitor から呼び出す API Web Bluetooth を手動で呼び出してください。
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
BluetoothLowEnergy.shimWebBluetooth();
isAvailable
__CAPGO_KEEP_0__ がデバイス上で利用可能かどうかを確認します。
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
const { available } = await BluetoothLowEnergy.isAvailable();
isEnabled
__CAPGO_KEEP_0__ がデバイス上で有効かどうかを確認します。
import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';
const { enabled } = await BluetoothLowEnergy.isEnabled();
Full Reference
- GitHub: https://github.com/Cap-go/capacitor-bluetooth-low-energy/
- Docs: /docs/plugins/bluetooth-low-energy/
Using @capgo/capacitor-bluetooth-low-energy
Capacitor Bluetooth Low Energyを使用している場合 Using @capgo/capacitor-bluetooth-low-energy Capacitor Bluetooth Low Energyを使用してネイティブプラグインの作業を計画するには、Capacitor Bluetooth Low Energyに接続してください @capgo/capacitor-bluetooth-low-energy for the implementation detail in @capgo/capacitor-bluetooth-low-energy, Capacitor Bluetooth Low Energyの実装詳細については、Capacitor Bluetooth Low Energyを参照してください Capacitor プラグインディレクトリ Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, and Capacitorプラグイン 実装詳細については、プラグインの追加または更新の際の