Bluetooth SPP communication bug fixed.

This commit is contained in:
dxl
2020-04-28 12:23:30 +08:00
parent 477c07514b
commit c7df53edef
3 changed files with 32 additions and 6 deletions
@@ -1,7 +1,11 @@
package cn.proxgrind.com;
import android.annotation.SuppressLint;
import android.util.Log;
import androidx.annotation.NonNull;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -33,6 +37,26 @@ public class SppHasBlock extends AbsBluetoothSpp {
@Override
public InputStream getInput() {
// return new InternalIn();
return inputStream;
}
/*class InternalIn extends InputStream {
@Override
public int read() throws IOException {
if (inputStream == null) return -1;
return inputStream.read();
}
@Override
public int read(@NonNull byte[] b, int off, int len) throws IOException {
if (inputStream == null) return -1;
int lenRecv = inputStream.available();
if (lenRecv <= 0) return -1;
Log.d("***", "长度:" + lenRecv);
return inputStream.read(b, off, lenRecv);
//Log.d("****", "接收: " + HexUtil.toHexString(recvMsg, offset, length));
}
}*/
}