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

パッケージ詳細v0.2.8

flutter_serial_communication

シリアル通信用のライブラリ。現在、Android USB(OTG)を介して、Android上のArduinoやその他のUSBシリアルハードウェアと通信する機能をサポートしており、rootアクセスなしで利用可能。

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

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

flutter pub add flutter_serial_communication

パッケージ概要

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

USB OTG を介して Android デバイスでシリアル通信を可能にする Flutter パッケージであり、root アクセスを必要とせずに Arduino やその他の USB シリアルハードウェアとやり取りできます。Android の USB ホスト API を活用して、データ交換のための信頼性の高い接続を確立します。このライブラリは、センサーやマイコンなどの外部ハードウェアとシリアルプロトコルを通じてインターフェースするアプリを開発する開発者向けに設計されています。Flutter アプリケーションにおけるシリアルポートのセットアップと処理を簡素化します。

用途

  • USB OTG を通じて Arduino に接続する
  • 外部ハードウェアからセンサー情報を読み取る
  • シリアルプロトコルを介したIoTデバイスの制御
  • 産業用またはラボ自動化アプリの開発
  • 組み込みシステム用のモバイルインターフェースの構築

主な機能

  • AndroidでのUSB OTGサポート
  • ルートアクセスは不要です
  • シリアルポート管理のためのシンプルなAPI
  • リアルタイムデータストリーミング
  • クロスプラットフォーム互換性(Android専用)
  • 組み込みエラー処理

適している対象

  • IoTアプリ開発者
  • ハードウェアインターフェースプロジェクト
  • 教育ロボティクス
  • 埋め込みシステム制御アプリ
  • Android専用のシリアル通信の要件

注意事項

  • Androidプラットフォームに限定
  • USB OTG ハードウェアが必要です
  • 権限の処理が必要になる場合があります
  • デバイス固有のUSB互換性
  • iOS やデスクトップには対応していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

About Flutter Serial Communication

This library aims to ease Flutter Developers to do serial communcation with their peripherals without too much hassle.

Currently supports Android USB (OTG) to communicate with Arduinos and other USB serial hardware on Android WITHOUT using root access.

Installing

1. Install it to your flutter project

flutter pub add flutter_serial_communication

or by adding dependencies to your package's pubspec.yaml then run dart pub get

dependencies:
  flutter_serial_communication: 0.2.8

2. Import it in your .dart file

import 'package:flutter_serial_communication/flutter_serial_communication.dart';

Features

  • Doesn't require root in Android
  • Easy to use
  • Using listener for reading message & device connection status

Functions

  • Get All Available Devices:
final _flutterSerialCommunicationPlugin = FlutterSerialCommunication();

List<DeviceInfo> availableDevices = await _flutterSerialCommunicationPlugin.getAvailableDevices();
  • Connect:
final _flutterSerialCommunicationPlugin = FlutterSerialCommunication();

DeviceInfo device = DeviceInfo(); // DeviceInfo from getAvailableDevices()
int baudRate = 0; // Your device's baud rate
bool isConnectionSuccess = await _flutterSerialCommunicationPlugin.connect(device, baudRate);
  • Disconnect:
final _flutterSerialCommunicationPlugin = FlutterSerialCommunication();

await _flutterSerialCommunicationPlugin.disconnect();
  • Write:
final _flutterSerialCommunicationPlugin = FlutterSerialCommunication();

bool isMessageSent = await _flutterSerialCommunicationPlugin.write(Uint8List.fromList([0xBB, 0x00, 0x22, 0x00, 0x00, 0x22, 0x7E]));
debugPrint("Is Message Sent:  $isMessageSent");
  • Read (Listener):
final _flutterSerialCommunicationPlugin = FlutterSerialCommunication();

EventChannel eventChannel = _flutterSerialCommunicationPlugin.getSerialMessageListener();
eventChannel.receiveBroadcastStream().listen((event) {
  debugPrint("Received From Native:  $event");
});
  • Device Connection Status (Listener):
final _flutterSerialCommunicationPlugin = FlutterSerialCommunication();

EventChannel eventChannel = _flutterSerialCommunicationPlugin.getDeviceConnectionListener();
eventChannel.receiveBroadcastStream().listen((event) {
  debugPrint("Received From Native:  $event");
});

Implementation

カテゴリー

依存関係

依存関係一覧 1 件

  • plugin_platform_interface^2.0.2

ソースリポジトリ

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

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