메인 콘텐츠로 건너뛰기
플러그인으로 돌아가기
@capgo/capacitor-블루투스-저전력
튜토리얼
@capgo/capacitor-블루투스-저전력

블루투스 저전력 플러그인은 블루투스 장치에서 스캔, 연결, 읽기, 쓰기 및 알림을 받기 위해 사용할 수 있습니다.

월 다운로드

Bluetooth Low Energy에 대한 가이드

장치에서 테스트

앱을 다운로드하고 QR코드를 스캔하세요.

Download the Capgo app, then scan the QR code.

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

@capgo/capacitor-bluetooth-low-energy 사용

Capacitor 블루투스 저전력 플러그인 (BLE 통신을위한)

설치

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

이 플러그인이 노출하는 것

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

Example Usage

initialize

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

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

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

shimWebBluetooth

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

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

Full Reference

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

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

__CAPGO_KEEP_0__:

Keep going from Using @capgo/capacitor-bluetooth-low-energy

Capacitor Bluetooth Low Energy 플러그인을 사용 중이라면 Using @capgo/capacitor-bluetooth-low-energy Capacitor Bluetooth Low Energy와 연결하여 @capgo/capacitor-bluetooth-low-energy for the implementation detail in @capgo/capacitor-bluetooth-low-energy, Getting Started의 구현 세부 사항을 참조하세요. 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 플러그인 for the implementation detail in Adding or Updating Plugins.