패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.1.1

flutter_blue_classic

블루투스 클래식 장치와 통신하기 위한 플러터 플러그인

Android
30일 다운로드
3.3천
좋아요
37
Pub 점수
160

패키지 설치

flutter pub add flutter_blue_classic

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

flutter_blue_classic은 안드로이드에서 블루투스 클래식 장치와의 통신을 가능하게 하는 플러터 플러그인입니다. 클래식 블루투스 주변기기를 탐지하고 연결하며 데이터를 교환할 수 있는 간단한 API를 제공합니다. 오디오 장치, 센서 또는 맞춤형 IoT 기기와 같은 구형 블루투스 하드웨어와 상호작용하는 앱을 개발하는 개발자를 위해 설계되었으며, 플러터 애플리케이션에 원활하게 통합됩니다. 스캔, 페어링 및 연결된 장치로부터의 데이터 스트림 처리와 같은 핵심 블루투스 작업을 지원합니다. lenhart.dev에서 유지보수되며, 투명성과 커뮤니티 기여를 위해 GitHub에 호스팅되어 있습니다.

사용 사례

  • 구형 블루투스 오디오 장치에 연결 중
  • 사용자 정의 블루투스 센서와의 인터페이싱
  • IoT 제어 애플리케이션 구축
  • 안드로이드 기기 간 데이터 전송
  • 산업용 또는 의료용 블루투스 도구 개발

주요 기능

  • 안드로이드 전용 지원
  • 블루투스 클래식 프로토콜 호환성
  • 실시간 데이터 스트리밍
  • 장치 탐지 및 연결 관리
  • 간단한 이벤트 기반 API

적합한 대상

  • 안드로이드 중심의 블루투스 앱 개발
  • 클래식 블루투스 통합이 필요한 프로젝트
  • 오래된 블루투스 하드웨어를 사용하는 개발자
  • 사물인터넷 및 센서 기반 응용 프로그램
  • 블루투스 기능이 있는 솔루션의 프로토타이핑

고려 사항

  • Android 플랫폼에 한정
  • 블루투스 LE 지원 없음
  • 블루투스 접근을 위한 Android 권한이 필요합니다
  • 추가적인 장치별 구성이 필요할 수 있습니다
  • 외부 네이티브 블루투스 라이브러리에 의존합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

flutter_blue_classic

Flutter_blue_classic is a flutter plugin for communicating with bluetooth classic devices. If you want to use an Bluetooth low energy (BLE) device, you might want to consider flutter_blue_plus.

A note on iOS

This plugin is currently only compatible with Android. iOS does not provide a similar interface for Bluetooth Classic like Android does. On iOS your BL device must be MFi (Made for iPod/iPhone) certified and you will have to use the External Accessory Framework. Since this is out of the scope of this package, you will have to implement this yourself.

Getting Started

minSdkVersion

This package is only compatible with Android SDK 21 or higher. Please set your minSdkVersion in the android/app/build.gradle accordingly.

Permissions

As the Android permission requirements can differ from case to case, this package does not define any permissions in it's Manifest. It is therefore necessary to declare them yourself. For detailed information, take a look at the Android Developer Documentation on Permissions.

Below are two common presets:

Without location access

In the android/app/src/main/AndroidManifest.xml add:

<!-- Permissions for Android 12 or above -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />

    <!-- legacy for Android 11 or lower -->
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />

    <!-- legacy for Android 9 or lower -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="28" />
With location access

In the android/app/src/main/AndroidManifest.xml add:

<!-- Permissions for Android 12 or above -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <!-- legacy for Android 11 or lower -->
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />

    <!-- legacy for Android 9 or lower -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="28" />

Then pass the accessFineLocation parameter when initializing the plugin:


final blueClassic = FlutterBlueClassic(usesFineLocation: true);

Reference

FlutterBlueClassic
Description
isSupported Checks whether the device supports Bluetooth
isEnabled Checks whether Bluetooth is enabled
adapterStateNow Current state of the bluetooth adapter
adapterState Stream of on, off and intermediary states of the bluetooth adapter
bondedDevices Returns the list of bonded (paired) devices
startScan Starts a scan for Bluetooth devices
stopScan Stop an existing scan for Bluetooth devices
isScanningNow Checks whether the Bluetooth adapter is currently scanning.
isScanning Stream whether the device is scanning for BL devices.
scanResults Stream of found devices during scan
turnOn Requests to turn the bluetooth adapter on
bondDevice Requests to create a bond with a bluetooth device
connect Tries to connect with a bluetooth device
BluetoothConnection
Description
input The stream of data received from the connected BL device
output A stream sink to send byte data to the connected BL device
writeString A helper to send utf-8 encoded strings to the remote device
isConnected Indicates whether the connection is still open.
dispose This should be called, when the Connection is no longer needed and will call finish (see below).
finish This will wait for any ongoing writes to be finished and gracefully close the connection.
close This will immediately close the connection.

Acknowledgement

flutter_blue_classic is loosely based on flutter_bluetooth_serial.

카테고리

의존성

의존성 목록 1 개

  • plugin_platform_interface^2.0.2

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.