Pakete, Repositories und App-Kategorien suchen

Cover von flutter_bluetooth_serial
Paketdetailsv0.4.0

flutter_bluetooth_serial

Eine grundlegende Flutter-Bluetooth-Seriell-Bibliothek

Android
30-Tage-Downloads
9560
Likes
377
Pub-Punkte
130

Paket installieren

flutter pub add flutter_bluetooth_serial

Paketübersicht

Aus öffentlichen Paketdaten erstellte Orientierung.

Ein leichtgewichtiger Flutter-Paket zur Verbindung und Kommunikation mit Bluetooth-Seriell-Geräten unter Android. Es ermöglicht den bidirektionalen Datenaustausch zwischen einer Flutter-App und kompatiblen Hardware wie Sensoren, Mikrocontrollern oder benutzerdefinierten IoT-Geräten über Standard-Bluetooth-Seriell-Protokolle. Die Bibliothek abstrahiert Low-Level-Bluetooth-Operationen und bietet eine einfach zu verwendende API zum Scannen, Paaren und Senden/Empfangen von Daten. Speziell für Android entwickelt, unterstützt sie grundlegende Bluetooth-Funktionen ohne komplexe Konfigurationen.

Anwendungsfälle

  • Verbindung zu arduino-basierten Geräten herstellen
  • Übertragung von Sensordaten von Bluetooth-Modulen
  • Steuerung von IoT-Geräten über Bluetooth
  • Integration mit benutzerdefinierten Hardwareperipheriegeräten
  • Echtzeit-Datenaustausch in mobilen Apps ermöglichen

Hauptmerkmale

  • Einfache API für Bluetooth-Kommunikation
  • Nur Android unterstützt
  • Bidirektionaler Datentransfer
  • Geräteentdeckung und Paarung
  • Leichtgewichtig und minimale Abhängigkeiten

Geeignet für

  • IoT-Anwendungsentwickler
  • Hardware-Integrationprojekte
  • Bildungsrobotik
  • Embedded-System-Prototyping
  • Android-spezifische Bluetooth-Anwendungen

Hinweise

  • Beschränkt auf die Android-Plattform
  • Keine Unterstützung für iOS
  • Erfordert Bluetooth-Berechtigungen im Manifest
  • Abhängig von der Gerätekompatibilität mit dem Seriellen Protokoll
  • Grundfunktionspaket ohne erweiterte Bluetooth-Profile

Original-README

Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.

flutter_bluetooth_serial

pub package

Flutter basic implementation for Classical Bluetooth (only RFCOMM for now).

Features

The first goal of this project, started by @edufolly was making an interface for Serial Port Protocol (HC-05 Adapter). Now the plugin features:

  • Adapter status monitoring,

  • Turning adapter on and off,

  • Opening settings,

  • Discovering devices (and requesting discoverability),

  • Listing bonded devices and pairing new ones,

  • Connecting to multiple devices at the same time,

  • Sending and receiving data (multiple connections).

The plugin (for now) uses Serial Port profile for moving data over RFCOMM, so make sure there is running Service Discovery Protocol that points to SP/RFCOMM channel of the device. There could be max up to 7 Bluetooth connections.

For now there is only Android support.

Funding

Your contribution will help drive the development of quality tools for the Flutter and Dart developer community. Any amount will be appreciated. Thank you for your continued support!

BuyMeACoffee

PIX

Sua contribuição ajudará a impulsionar o desenvolvimento de ferramentas de qualidade para a comunidade de desenvolvedores Flutter e Dart. Qualquer quantia será apreciada. Obrigado pelo seu apoio contínuo!

PIX

Getting Started

Depending
# Add dependency to `pubspec.yaml` of your project.
dependencies:
  # ...
  flutter_bluetooth_serial: ^0.4.0
Installing
flutter pub get
Importing
import 'package:flutter_bluetooth_serial/flutter_bluetooth_serial.dart';
Usage

You should look to the Dart code of the library (mostly documented functions) or to the examples code.

// Some simplest connection :F
try {
    BluetoothConnection connection = await BluetoothConnection.toAddress(address);
    print('Connected to the device');

    connection.input.listen((Uint8List data) {
        print('Data incoming: ${ascii.decode(data)}');
        connection.output.add(data); // Sending data

        if (ascii.decode(data).contains('!')) {
            connection.finish(); // Closing connection
            print('Disconnecting by local host');
        }
    }).onDone(() {
        print('Disconnected by remote request');
    });
}
catch (exception) {
    print('Cannot connect, exception occured');
}

Note: Work is underway to make the communication easier than operations on byte streams. See #41 for discussion about the topic.

Examples

Check out example application with connections with both Arduino HC-05 and Raspberry Pi (RFCOMM) Bluetooth interfaces.

Main screen and options Discovery and connecting Simple chat with server Background connection

To-do list

  • Add some utils to easier manage BluetoothConnection (see discussion #41),
  • Allow connection method/protocol/UUID specification,
  • Listening/server mode,
  • Recognizing and displaying BluetoothClass of device,
  • Maybe integration with flutter_blue one day ;)

You might also want to check milestones.

Credits

  • [Eduardo Folly](mailto:edufolly@gmail.com)
  • [Martin Mauch](mailto:martin.mauch@gmail.com)
  • [Patryk Ludwikowski](mailto:patryk.ludwikowski.7@gmail.com)

After version 0.3.0 we have a lot of collaborators. If you would like to be credited, please send me an [email](mailto:edufolly@gmail.com).

Kategorien

Quell-Repository

Projekte, die dieses Paket verwenden