Capacitor Bluetooth Low Energy Plugin for BLE communication.
基本機能
セクション「基本機能」initialize- BLE プラグインを初期化する必要があります。どの他のメソッドも呼び出す前に呼び出してください。shimWebBluetooth- Capacitor Web Bluetooth shim をインストールする。__CAPGO_KEEP_1__ ネイティブ アプリから Web Bluetooth Capacitor を使用する前に、手動で呼び出してください。navigator.bluetooth. Call this manually before using the Web Bluetooth API from a Capacitor native app.isAvailable__CAPGO_KEEP_1__ native app.isEnabled- デバイス上のBluetoothが有効かどうかを確認してください。
パブリック API
「パブリック API」というセクション| メソッド | 説明 |
|---|---|
initialize | BLE プラグインを初期化します。どのメソッドも呼び出す前に呼び出してください。 |
shimWebBluetooth | Capacitor Web Bluetooth シムをインストールします。 navigator.bluetooth Capacitor ネイティブ アプリからWeb Bluetooth API を使用する前に、手動で呼び出してください。 |
isAvailable | デバイス上のBluetoothが利用可能かどうかを確認します。 |
isEnabled | デバイス上のBluetoothが有効かどうかを確認します。 |
isLocationEnabled | Android でのみ、位置情報サービスが有効かどうかを確認します。 |
openAppSettings | アプリの設定画面を開きます。 |
openBluetoothSettings | Android用のBluetooth設定画面を開きます。 |
openLocationSettings | Android用の位置情報設定画面を開きます。 |
checkPermissions | 現在の許可状態を確認します。 |
requestPermissions | Bluetoothの許可を求めます。 |
startScan | BLEデバイスのスキャンを開始します。 |
stopScan | BLEデバイスのスキャンを停止します。 |
connect | BLEデバイスに接続します。 |
disconnect | BLEデバイスから切断します。 |
createBond | Android用のBLEデバイスとバンドを形成します。 |
isBonded | Android用にデバイスがバンドされているかどうかを確認します。 |
discoverServices | 接続されたデバイスのサービスを検出します。 |
getServices | デバイスの検出されたサービスを取得します。 |
getConnectedDevices | 接続されているデバイスの一覧を取得します。 |
readCharacteristic | 特性値を読み取ります。 |
writeCharacteristic | 特性値を書き込みます。 |
startCharacteristicNotifications | 特性の通知を開始します。 |
stopCharacteristicNotifications | 特性の通知を停止します。 |
readDescriptor | デスクリプター値を読み取ります。 |
writeDescriptor | デスクリプター値を書き込みます。 |
readRssi | 接続されているデバイスのRSSI(信号強度)を読み取ります。 |
requestMtu | MTUサイズ変更を要求します(Androidのみ)。 |
requestConnectionPriority | 接続優先度を要求します(Androidのみ)。 |
startAdvertising | BLEサーバーとしてアドバタイズを開始します。 |
stopAdvertising | アドバタイズを停止します。 |
startForegroundService | バックグラウンドでBLE接続を維持するために、フォアグラウンドサービスを開始します (Androidのみ)。 |
stopForegroundService | フォアグラウンドサービスを停止します (Androidのみ)。 |
getPluginVersion | Capacitorネイティブプラグインのバージョンを取得します。 |
addListener | デバイスがスキャンされたイベントのリスナーを追加します。 |
addListener | デバイスが接続されたイベントのリスナーを追加します。 |
addListener | デバイスが切断されたイベントのリスナーを追加します。 |
addListener | 特性が変更されたイベントのリスナーを追加します。 |
removeAllListeners | このプラグインのすべてのリスナーを削除します。 |
真実の源
「真実の源」セクションこのリファレンスは src/definitions.ts in capacitor-Bluetooth Low Energy.