kongqw / Androidserialport
Android串口通信示例
Stars: ✭ 497
Programming Languages
java
68154 projects - #9 most used programming language
Labels
Projects that are alternatives of or similar to Androidserialport
Androidserialport
Android Serial Port , 基本的Android 串口通信库
Stars: ✭ 99 (-80.08%)
Mutual labels: serialport, serial-ports
Node Serialport
Access serial ports with JavaScript. Linux, OSX and Windows. Welcome your robotic JavaScript overlords. Better yet, program them!
Stars: ✭ 5,015 (+909.05%)
Mutual labels: serialport, serial-ports
Ninjaterm
A serial port terminal that's got your back.
Stars: ✭ 24 (-95.17%)
Mutual labels: serialport, serial-ports
Cserialport
基于C++的轻量级开源跨平台串口类库Lightweight cross-platform serial port library based on C++
Stars: ✭ 296 (-40.44%)
Mutual labels: serialport, serial-ports
Cserialport
The latest modified version of Remon Spekreijse's serial port class
Stars: ✭ 64 (-87.12%)
Mutual labels: serialport, serial-ports
Rubyserial
FFI Ruby library for RS-232 serial port communication
Stars: ✭ 142 (-71.43%)
Mutual labels: serialport, serial-ports
Common
Yet another serial port debugger.
Stars: ✭ 245 (-50.7%)
Mutual labels: serialport, serial-ports
Libserial
Serial Port Programming in C++
Stars: ✭ 201 (-59.56%)
Mutual labels: serialport, serial-ports
etherport-client
Client-side virtual serial port for Etherport. Used to implement firmata-compatible boards and relays.
Stars: ✭ 20 (-95.98%)
Mutual labels: serial-ports, serialport
serial.nim
A Nim library for accessing serial ports.
Stars: ✭ 59 (-88.13%)
Mutual labels: serial-ports, serialport
pyrealtime
Realtime data processing and plotting pipelines in Python
Stars: ✭ 62 (-87.53%)
Mutual labels: serialport
SerialPorts.jl
SerialPort IO streams in Julia backed by pySerial.
Stars: ✭ 28 (-94.37%)
Mutual labels: serial-ports
osx-ch341-serial
CH340/CH341 based USB to Serial Port Adapter driver for Mac OSX
Stars: ✭ 17 (-96.58%)
Mutual labels: serialport
pySerialTransfer
Python package to transfer data in a fast, reliable, and packetized form
Stars: ✭ 78 (-84.31%)
Mutual labels: serialport
说明
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 {
compile 'com.github.kongqw:AndroidSerialPort:1.0.1'
}
查看串口
SerialPortFinder serialPortFinder = new SerialPortFinder();
ArrayList<Device> devices = serialPortFinder.getDevices();
打开串口
初始化
mSerialPortManager = new SerialPortManager();
添加打开串口监听
mSerialPortManager.setOnOpenSerialPortListener(new OnOpenSerialPortListener() {
@Override
public void onSuccess(File device) {
}
@Override
public void onFail(File device, Status status) {
}
});
添加数据通信监听
mSerialPortManager.setOnSerialPortDataListener(new OnSerialPortDataListener() {
@Override
public void onDataReceived(byte[] bytes) {
}
@Override
public void onDataSent(byte[] bytes) {
}
});
打开串口
- 参数1:串口
- 参数2:波特率
- 返回:串口打开是否成功
boolean openSerialPort = mSerialPortManager.openSerialPort(device.getFile(), 115200);
发送数据
- 参数:发送数据 byte[]
- 返回:发送是否成功
boolean sendBytes = mSerialPortManager.sendBytes(sendContentBytes);
关闭串口
mSerialPortManager.closeSerialPort();
PS:传输协议需自行封装
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].