All Projects → F1ReKing → Android Serialport

F1ReKing / Android Serialport

Licence: apache-2.0
『Android Lib』 Android平台上的usb串口调试库,支持串口号、波特率、数据位、校验位、停止位、流控等参数设置,能够控制数据的收发

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android Serialport

Cserialport
基于C++的轻量级开源跨平台串口类库Lightweight cross-platform serial port library based on C++
Stars: ✭ 296 (+80.49%)
Mutual labels:  serialport
Cserialport
The latest modified version of Remon Spekreijse's serial port class
Stars: ✭ 64 (-60.98%)
Mutual labels:  serialport
Googleserialport
Android串口通信:抱歉,学会它真的可以为所欲为 ! ! !
Stars: ✭ 130 (-20.73%)
Mutual labels:  serialport
Scriptcommunicator serial Terminal
Scriptable cross-platform data terminal which supports: serial port, UDP, TCP, SPI, I2C and CAN.
Stars: ✭ 462 (+181.71%)
Mutual labels:  serialport
Node Escpos
🖨️ ESC/POS Printer driver for node
Stars: ✭ 752 (+358.54%)
Mutual labels:  serialport
Swiftygpio
A Swift library for hardware projects on Linux/ARM boards with support for GPIOs/SPI/I2C/PWM/UART/1Wire.
Stars: ✭ 1,188 (+624.39%)
Mutual labels:  serialport
pyrealtime
Realtime data processing and plotting pipelines in Python
Stars: ✭ 62 (-62.2%)
Mutual labels:  serialport
Rubyserial
FFI Ruby library for RS-232 serial port communication
Stars: ✭ 142 (-13.41%)
Mutual labels:  serialport
Ninjaterm
A serial port terminal that's got your back.
Stars: ✭ 24 (-85.37%)
Mutual labels:  serialport
P5.serialport
Serial Port API and Server for p5.js
Stars: ✭ 120 (-26.83%)
Mutual labels:  serialport
Androidserialport
Android串口通信示例
Stars: ✭ 497 (+203.05%)
Mutual labels:  serialport
Android Serialport Api
Fork自Google开源的Android串口通信Demo,修改成Android Studio项目
Stars: ✭ 715 (+335.98%)
Mutual labels:  serialport
Usbserial
Usb serial controller for Android
Stars: ✭ 1,301 (+693.29%)
Mutual labels:  serialport
Serialtool
A cross platform Serial-Port/TCP/UDP debugging tool.
Stars: ✭ 384 (+134.15%)
Mutual labels:  serialport
Wbuart32
A simple, basic, formally verified UART controller
Stars: ✭ 133 (-18.9%)
Mutual labels:  serialport
Blynk Library
Blynk library for embedded hardware. Works with Arduino, ESP8266, Raspberry Pi, Intel Edison/Galileo, LinkIt ONE, Particle Core/Photon, Energia, ARM mbed, etc.
Stars: ✭ 3,305 (+1915.24%)
Mutual labels:  serialport
React Native Serialport
React Native - Usb Serial Port Communication For Android Platform
Stars: ✭ 72 (-56.1%)
Mutual labels:  serialport
Node Bluetooth
🔷😬Bluetooth serial port communication for Node.js
Stars: ✭ 145 (-11.59%)
Mutual labels:  serialport
Serialporthelper
Android串口通讯助手,使用C++实现。
Stars: ✭ 141 (-14.02%)
Mutual labels:  serialport
Androidserialport
Android Serial Port , 基本的Android 串口通信库
Stars: ✭ 99 (-39.63%)
Mutual labels:  serialport

Android-SerialPort

此项目移植于谷歌官方串口库android-serialport-api,但该项目仅支持串口名称及波特率,所以在项目的基础上添加支持数据位、数据位、停止位、流控等配置。

License

下载

Get it on Google Play

酷安:https://www.coolapk.com/apk/251882

引入

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency

dependencies {
        implementation 'com.github.F1ReKing:Android-SerialPort:1.5.1'
}

使用

1. 查询串口列表

SerialPortHelper#getAllDevices();
// 查询串口设备地址列表
SerialPortHelper#getAllDeicesPath();

2. 配置串口参数

SerialPortHelper#Builder(String port, int baudRate).build(); //支持配置串口号,波特率(默认值115200)
setStopBits(int stopBits); // 支持设置停止位 默认值为2
setDataBits(int dataBits); // 支持设置数据位 默认值为8
setParity(int parity); // 支持设置检验位 默认值为0
setFlowCon(int flowCon); // 支持设置流控 默认值为0
setFlags(int flags); // 支持设置标志 默认值为0,O_RDWR  读写方式打开

3. 打开串口

SerialPortHelper#open();

4. 关闭串口

SerialPortHelper#close();

4. 发送数据

SerialPortHelper#sendBytes(byte[] bytes); // 支持发送byte[]
SerialPortHelper#sendHex(String hex); // 支持发送Hex
SerialPortHelper#sendTxt(String txt); // 支持发送ASCII码

5. 接收数据

public interface ISerialPortDataListener {
	// 接收数据回调
    void onDataReceived(byte[] bytes);
   	// 发送数据回调
    void onDataSend(byte[] bytes);
}

6. 回调

//  串口打开状态监听
void setIOpenSerialPortListener(IOpenSerialPortListener IOpenSerialPortListener);

// 串口消息监听
void setISerialPortDataListener(ISerialPortDataListener ISerialPortDataListener);

版本更新记录

1.1

  • 优化api
  • 支持设置可选参数,并配置默认值

1.0

  • 基础功能、支持设置串口号、波特率、数据位、校验位、停止位、流控等配置
  • 支持发送、接收数据

License

Copyright 2019 F1ReKing. 

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Stargazers over time

Stargazers over time

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].