1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| package com.example.serial;
|
| public class RS485Control {
| static {
| System.loadLibrary("serial");
| }
|
| public static native int openSerialPort(String path, long baudRate, int dataBits, int parity, int stopBits, int flowControl);
| public static native int closeSerialPort();
|
| public static native int sendToPort(String msg, int len);
| public static native String recvFromPort(int len, int timeout);
|
| public static native int changeState(int state); //
|
| public static native String saveToFile(String msg, int len, String fileName);
|
| }
|
|