メインコンテンツにスキップ
プラグインに戻る
@capgo/capacitor-Bluetooth Low Energy
チュートリアル
@capgo/capacitor-Bluetooth Low Energy

Bluetooth Low Energy

Bluetooth Low Energy プラグイン

ガイド

Bluetooth Low Energy についてのチュートリアル

Using @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

__CAPGO_KEEP_0__を有効にしているかどうかを確認してください。

import { BluetoothLowEnergy } from '@capgo/capacitor-bluetooth-low-energy';

const { enabled } = await BluetoothLowEnergy.isEnabled();

Full Reference

@capgo/capacitor-bluetooth-low-energyを使用し続けてください。

__CAPGO_KEEP_0__を使用している場合 @capgo/capacitor-bluetooth-low-energyを使用して @__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, __CAPGO_KEEP_0__を使用している場合、@__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-bluetooth-low-energyを使用してください。 for the implementation detail in Getting Started、 Capgo プラグイン ディレクトリ for the product workflow in Capgo プラグイン ディレクトリ、 Capacitor プラグインズ by Capgo for the implementation detail in Capacitor プラグインズ by Capgo、そして プラグインの追加または更新 for the implementation detail in プラグインの追加または更新。