본문으로 바로가기
플러그인으로 돌아가기
@capgo/capacitor-블루투스-저전력
튜토리얼
@capgo/capacitor-블루투스-저전력

블루투스 저전력

블루투스 장치에서 스캔, 연결, 읽기, 쓰기 및 알림을 받기 위해 블루투스 장치에서 완전한 기능의 BLE 플러그인을 제공합니다.

가이드

블루투스 저전력 에너지 튜토리얼

장치에서 테스트

다운로드 Capgo 앱, 그리고 QR code을 스캔하세요.

블루투스 저전력 에너지 플러그인 미리보기 QR code

Using @capgo/capacitor-bluetooth-low-energy

Capacitor 블루투스 저전력 에너지 플러그인 BLE 통신을 위해

설치

bun add @capgo/capacitor-bluetooth-low-energy
bunx cap sync

이 플러그인이 노출하는 것

  • initialize - BLE 플러그인을 초기화합니다. 다른 메서드를 호출하기 전에 반드시 호출해야 합니다.
  • shimWebBluetooth - Capacitor 웹 블루투스 시뮬레이터를 설치합니다. navigator.bluetooth. Capacitor 네이티브 앱에서 웹 블루투스 API를 사용하기 전에 수동으로 호출해야 합니다.
  • isAvailable - 장치에서 블루투스를 사용할 수 있는지 확인합니다.
  • isEnabled - 장치에서 블루투스를 활성화했는지 확인합니다.

예시 사용

initialize

블루투스 플러그인을 초기화합니다. 다른 메서드를 호출하기 전에 반드시 호출해야 합니다.

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

await BluetoothLowEnergy.initialize({ mode: 'central' });

shimWebBluetooth

Capacitor 웹 블루투스 시뮬레이터를 설치하세요. navigator.bluetoothCapacitor 네이티브 앱에서 웹 블루투스 API를 사용하기 전에 이 메서드를 수동으로 호출하세요.

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

BluetoothLowEnergy.shimWebBluetooth();

isAvailable

디바이스에서 블루투스가 사용 가능한지 확인하세요.

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

const { available } = await BluetoothLowEnergy.isAvailable();

isEnabled

디바이스에서 블루투스가 활성화되어 있는지 확인하세요.

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

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

전체 참조

Using @capgo/capacitor-bluetooth-low-energy

블루투스 플러그인을 사용하는 경우 Using @capgo/capacitor-bluetooth-low-energy native 플러그인 작업을 계획하기 위해, 그것을 연결하세요. @capgo/capacitor-블루투스 저전력 @capgo/capacitor-블루투스 저전력의 implementation detail Getting Started Getting Started의 implementation detail Capgo 플러그인 디렉토리 Capgo 플러그인 디렉토리의 제품 워크플로우 Capacitor 플러그인들에 의해 Capgo Capacitor 플러그인들에 의해 Capgo의 implementation detail 플러그인 추가 또는 업데이트 플러그인 추가 또는 업데이트의 implementation detail