|
|
@@ -5,12 +5,14 @@ import android.serialport.SerialPort; |
|
|
|
import android.util.Log; |
|
|
|
|
|
|
|
import com.serotonin.modbus4j.serial.SerialMessage; |
|
|
|
import com.serotonin.modbus4j.sero.util.ArrayUtils; |
|
|
|
|
|
|
|
import java.io.BufferedInputStream; |
|
|
|
import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.lang.reflect.Array; |
|
|
|
import java.util.concurrent.ScheduledFuture; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
@@ -99,10 +101,15 @@ public class ShaoMaSave implements Runnable{ |
|
|
|
/*int available = inputStream.available(); |
|
|
|
if (available == 0) continue;*/ |
|
|
|
if (inputStream == null) continue; |
|
|
|
byte[] received = new byte[1024]; |
|
|
|
int size = inputStream.read(received); |
|
|
|
if (size>0&&serialInter!=null) |
|
|
|
serialInter.readData(path,received,size); |
|
|
|
byte[] received = new byte[1]; |
|
|
|
String x=""; |
|
|
|
int t = 1; |
|
|
|
while (t>0){ |
|
|
|
t= inputStream.read(received); |
|
|
|
x+=new String(received); |
|
|
|
} |
|
|
|
if (x!="") |
|
|
|
serialInter.readData(path,received,t); |
|
|
|
Thread.sleep(20); |
|
|
|
}catch (InterruptedException e){ |
|
|
|
Log.e(Tag,"线程异常"+e.toString()); |
|
|
|