1 Star 1 Fork 0

sclimin / Android-SerialPort

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
Clone or Download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

Android-SerialPort

License

介绍

Android端串口工具,借鉴了minicomAndroid源码。( 正常操作,没做权限处理)

使用

// 默认阻塞读写,可设置非阻塞
SerialPort serialPort = SerialPort.newBuilder("/dev/ttyS0", true);
// or
SerialPort serialPort = SerialPort.newBuilder("/dev/ttyS0")
        .setBaudRate(115200)
        .setBits(SerialPort.BIT8)
        .setParity(SerialPort.PARITY_ODD)
        .setHardwareFlow(false)
        .setSoftwareFlow(true)
        .build();
try {
    serialPort.open();
    // 非阻塞模式,没数据立即返回0
    serialPort.read(...);
    serialPort.write(...);
    serialPort.close();
} catch (IOException e) {
    e.printStackTrace();
}

License

   Copyright 2020 sclimin

   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.

Repository Comments ( 0 )

Sign in to post a comment

About

Android端串口工具 expand collapse
Apache-2.0
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
1
https://git.oschina.net/sclimin/Android-SerialPort.git
git@git.oschina.net:sclimin/Android-SerialPort.git
sclimin
Android-SerialPort
Android-SerialPort
master

Search

103111 552b83b3 1850385 103110 ed87a847 1850385