搜尋套件、儲存庫與 APP 分類

套件詳情v1.1.3

bluetoothadapter

一個 Flutter 外掛,用於為 **僅 Android** 暴露藍牙適配器的功能。

近 30 天下載
63
喜歡數
22
Pub 分數
40

安裝套件

flutter pub add bluetoothadapter

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

The bluetoothadapter package is a Flutter plugin that provides access to Bluetooth adapter functionalities on Android devices. It enables developers to check Bluetooth status, enable or disable Bluetooth, and retrieve adapter information. Designed specifically for Android, it offers a straightforward API to interact with the device's Bluetooth hardware, making it ideal for apps requiring low-level Bluetooth control. The plugin does not support iOS, limiting its use to Android-only applications. It integrates seamlessly with Flutter projects via pub.dev.

適用情境

  • 透過程式設計方式啟用/停用藍牙
  • 檢查藍牙適配器狀態
  • 在僅限 Android 的應用中整合藍牙功能
  • 開發物聯網裝置連接解決方案
  • 建立基於藍牙的近距離檢測系統

主要特色

  • 僅限 Android 相容性
  • 藍牙適配器控制的簡單API
  • 支援啟用和停用藍牙
  • 提供適配器資訊和狀態
  • 輕量且易於整合

適合對象

  • 專注於 Android 的移動應用開發者
  • 物聯網應用創建者
  • 藍牙設備整合商
  • 需要直接藍牙管理的應用
  • 不支援 iOS 的專案

使用建議

  • 不相容 iOS 平台
  • 僅限 Android 藍牙適配器功能
  • 需要 Android 特定權限
  • 不支援進階藍牙LE作業
  • 取決於設備製造商的實現

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

bluetoothadapter

A Flutter plugin to expose the features of Bluetooth Adapter for Android only.

Objective

The primary purpose of this project was to communicate between flutter and Rasburry Pie using Bluetooth.

Main Features

  • Setting up a UUID from user end.
  • Checking Bluetooth connection status and giving alerts if its off or not right.
  • Getting list of paired devices.
  • Get a particular paired device info.
  • Start Bluetooth server.
  • Start Bluetooth client.
  • Start Bluetooth client.
  • Send message to a connected device.
  • Stream for listening to received messages.
  • Stream for listening to connection status (CONNECTED, CONNECTING, CONNECTION FAILED, LISTENING, DISCONNECTED).
Getting Started

For a full example please check /example folder. Here are only the most important parts of the code to illustrate how to use the library.

//Initiatinng the bluetooth adapter
Bluetoothadapter flutterbluetoothadapter = Bluetoothadapter();

//Listening to the connection status listener
String _connectionStatus = "NONE";
StreamSubscription _btConnectionStatusListener =flutterbluetoothadapter.connectionStatus().listen((dynamic status) {
  setState(() {
    _connectionStatus = status.toString();
  });
});

//Listening to the recieved messages
String _recievedMessage;
StreamSubscription _btReceivedMessageListener = flutterbluetoothadapter.receiveMessages().listen((dynamic newMessage) {
  setState(() {
    _recievedMessage = newMessage.toString();
  });
});
Getting paired devices
List<BtDevice> devices = await flutterbluetoothadapter.getDevices();
Getting paired device
await flutterbluetoothadapter.getDevice(deviceAddress);
Starting BT server
await flutterbluetoothadapter.startServer();
Starting BT client
flutterbluetoothadapter.startClient(devices.indexOf(element), true);
Sending message
flutterbluetoothadapter.sendMessage(messageString);
Check BT connection
await flutterbluetoothadapter.checkBluetooth(); //returns bool
Set UUID
flutterbluetoothadapter.initBlutoothConnection(uuid);

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。