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

블루투스 저전력

블루투스 저전력 BLE 플러그인으로 블루투스 장치에서 스캔, 연결, 읽기, 쓰기 및 알림을 받을 수 있습니다.

가이드

블루투스 저전력에 대한 튜토리얼

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

Capacitor BLE 블루투스 저전력 플러그인으로 BLE 통신을 위해.

설치

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

이 플러그인은 다음을 제공합니다.

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

사용 예

initialize

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

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

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

shimWebBluetooth

Capacitor 웹 블루투스 시뮬레이터를 설치합니다. navigator.bluetooth. Capacitor 네이티브 앱에서 웹 블루투스 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

__CAPGO_KEEP_0__:

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

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

Full Reference

capgo에서 계속하기: Using @capgo/capacitor-low-energy

__CAPGO_KEEP_0__을 사용하고 있다면 Using @capgo/capacitor-low-energy __CAPGO_KEEP_0__을 연결하여 @capgo/capacitor-low-energy capgo의 implementation detail을 @capgo/capacitor-low-energy에서 확인하세요. Getting Started for the implementation detail in Getting Started, Capgo 플러그인 디렉토리 for the product workflow in Capgo 플러그인 디렉토리, Capacitor 플러그인들에 의해 Capgo for the implementation detail in Capacitor 플러그인들에 의해 Capgo, 그리고 __CAPGO_KEEP_0__ 플러그인 추가 또는 업데이트 for the implementation detail in __CAPGO_KEEP_0__ 플러그인 추가 또는 업데이트.