52ky 发表于 2022-5-10 11:19:54

Android 串口编程原理和实现方式.docx

说到串口编程就不得不提JNI,就不得不提JavaAPI中的文件描述符类:FileDescriptor。下面我将分别分析讲解JNI、FileDescriptor、串口的一些知识点和实现源码。这里主要参考开源项目。
? ?串口编程基础知识点: 串口编程,我们只需要对串口进行一系列设置,然后打开串口即可。这些操作我们可以参考串口调试助手的源码来学习。在Java中,如果要实现串口的读写功能,只需要操作文件设备类:FileDescriptor,其他的事情由驱动来完成。当然,如果你想了解,你还得看驱动代码。这里不打算解释驱动,只是简单描述应用层的实现。
Android 串口编程原理和实现方式(附源码).docx

(When it comes to serial programming, we have to mention JNI and the file descriptor class in Java API: filedescriptor. Next, I will analyze and explain some knowledge points and implementation source code of JNI, filedescriptor and serial port respectively. Here we mainly refer to open source projects.
? ? Basic knowledge of serial port programming: for serial port programming, we only need to make a series of settings for the serial port, and then open the serial port. We can refer to the source code of serial port debugging assistant to learn these operations. In Java, if you want to realize the read-write function of the serial port, you only need to operate the file device class: filedescriptor, and the driver completes other things. Of course, if you want to know, you have to look at the driver code. We do not intend to explain the driver here, but simply describe the implementation of the application layer.
Android serial programming principle and Implementation (with source code) docx)




页: [1]
查看完整版本: Android 串口编程原理和实现方式.docx