@@ -37,3 +37,3 @@ package com.qianmi.vemkit; | ||
| mSerialPort = new SerialPort(new File(file), baudrate, 0); | ||
| mReceived = new Thread(new TcnReceivedRunner(mSerialPort.getInputStream(), this.getReactApplicationContext())); | ||
| mReceived = new Thread(new TcnReceivedRunner(mSerialPort, this.getReactApplicationContext())); | ||
| mReceived.start(); | ||
@@ -40,0 +40,0 @@ params.putBoolean("value", true); |
@@ -18,2 +18,4 @@ package com.qianmi.vemkit.tcn; | ||
| import android_serialport_api.SerialPort; | ||
| /** | ||
@@ -28,8 +30,8 @@ * 串口返回值监听 | ||
| private FileInputStream fis = null; | ||
| private SerialPort mSerialPort = null; | ||
| private ReactApplicationContext reactApplicationContext = null; | ||
| public TcnReceivedRunner(InputStream inputStream, ReactApplicationContext reactApplicationContext) { | ||
| this.fis = (FileInputStream) inputStream; | ||
| public TcnReceivedRunner(SerialPort sp, ReactApplicationContext reactApplicationContext) { | ||
| this.mSerialPort = sp; | ||
| this.reactApplicationContext = reactApplicationContext; | ||
@@ -41,7 +43,3 @@ } | ||
| while (true) { | ||
| if (null == fis) { | ||
| Log.d(getClass().getSimpleName(), "FileInputStream is null "); | ||
| return; | ||
| } | ||
| // FileInputStream fis = (FileInputStream) mSerialPort.getInputStream(); | ||
| FileInputStream fis = (FileInputStream) mSerialPort.getInputStream(); | ||
| try { | ||
@@ -48,0 +46,0 @@ byte[] buffer = new byte[128]; |
+1
-1
| { | ||
| "name": "qm-vemkit", | ||
| "version": "0.0.25", | ||
| "version": "0.0.26", | ||
| "main": "index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
203111
-0.07%630
-0.47%