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

패키지 상세v0.2.8

flutter_serial_communication

시리얼 통신을 위한 라이브러리입니다. 현재 Android USB(OTG)를 사용하여 Android에서 아두이노 및 기타 USB 시리얼 하드웨어와 통신할 수 있으며, root 권한 없이도 사용 가능합니다.

Android
30일 다운로드
2.1천
좋아요
32
Pub 점수
160

패키지 설치

flutter pub add flutter_serial_communication

패키지 개요

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

USB OTG를 통해 안드로이드 기기에서 시리얼 통신을 가능하게 하는 플러터 패키지로, 루트 접근 없이 아두이노 및 기타 USB 시리얼 하드웨어와 상호작용할 수 있습니다. 안드로이드의 USB 호스트 API를 활용하여 데이터 교환을 위한 신뢰할 수 있는 연결을 설정합니다. 이 라이브러리는 센서나 마이크로컨트롤러와 같은 외부 하드웨어와 시리얼 프로토콜을 통해 인터페이스하는 앱을 개발하는 개발자를 위해 설계되었습니다. 안드로이드에서 플러터 앱의 시리얼 포트 설정과 처리를 간소화합니다.

사용 사례

  • USB OTG를 통해 아두이노에 연결
  • 외부 하드웨어에서 센서 데이터 읽기
  • 시리얼 프로토콜을 통한 사물인터넷 장치 제어
  • 산업 또는 실험실 자동화 앱 개발
  • 임베디드 시스템을 위한 모바일 인터페이스 구축

주요 기능

  • 안드로이드에서의 USB OTG 지원
  • 루트 액세스 권한 필요 없음
  • 시리얼 포트 관리를 위한 간단한 API
  • 실시간 데이터 스트리밍
  • 크로스 플랫폼 호환성(안드로이드 전용)
  • 내장형 오류 처리

적합한 대상

  • 사물인터넷 앱 개발자
  • 하드웨어 인터페이싱 프로젝트
  • 교육 로보틱스
  • 임베디드 시스템 제어 앱
  • 안드로이드 전용 시리얼 통신 요구 사항

고려 사항

  • 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

소스 저장소

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

아직 데이터가 없습니다.