パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.1.1

flutter_blue_classic

Bluetoothクラシックデバイスとの通信を行うためのFlutterプラグイン

Android
30日間ダウンロード
3290
いいね数
37
Pub ポイント
160

パッケージをインストール

flutter pub add flutter_blue_classic

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

flutter_blue_classic は、Android 上で Bluetooth Classic デバイスとの通信を可能にする Flutter プラグインです。クラシック Bluetooth パーサイタルデバイスの検出、接続、データ交換を簡単な API で実現します。オーディオ機器、センサー、カスタム IoT ガジェットなどのレガシー Bluetooth ハードウェアとやり取りするアプリを開発する開発者向けに設計されており、Flutter アプリケーションにスムーズに統合できます。スキャン、ペアリング、接続済みデバイスからのデータストリーム処理といった基本的な Bluetooth 操作をサポートしています。lenhart.dev によってメンテナンスされ、GitHub でホストされており、透明性とコミュニティ貢献を促進しています。

用途

  • レガシーなBluetoothオーディオデバイスに接続しています
  • カスタムBluetoothセンサーとのインターフェース
  • IoT制御アプリケーションの構築
  • Androidデバイス間でのデータ転送
  • 産業用または医療用Bluetoothツールの開発

主な機能

  • Android専用のサポート
  • Bluetoothクラシックプロトコルの互換性
  • リアルタイムデータストリーミング
  • デバイスの検出と接続管理
  • シンプルなイベント駆動型 API

適している対象

  • Android向けのBluetoothアプリ開発
  • クラシックBluetooth統合を必要とするプロジェクト
  • 古いBluetoothハードウェアを使用している開発者
  • IoTおよびセンサーに基づくアプリケーション
  • Bluetooth対応ソリューションのプロトタイピング

注意事項

  • Androidプラットフォームに限定
  • Bluetooth LE のサポートなし
  • Bluetooth アクセスのための Android 権限が必要です
  • 追加のデバイス固有の構成が必要になる場合があります
  • 外部のネイティブBluetoothライブラリに依存しています

元の 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

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。