some internal testing which does not hurt in master
This commit is contained in:
parent
0076bbf572
commit
14ef5202e1
|
@ -21,6 +21,8 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.io.PipedInputStream;
|
||||||
|
import java.io.PipedOutputStream;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
@ -177,6 +179,13 @@ class PebbleIoThread extends GBDeviceIoThread {
|
||||||
} else {
|
} else {
|
||||||
mIsTCP = false;
|
mIsTCP = false;
|
||||||
BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(btDeviceAddress);
|
BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(btDeviceAddress);
|
||||||
|
if (btDevice.getType() == BluetoothDevice.DEVICE_TYPE_LE) {
|
||||||
|
LOG.info("Ok this seems to be a LE Pebble, will try something that does not work :P");
|
||||||
|
mInStream = new PipedInputStream(new PipedOutputStream()); // fake so that io blocks
|
||||||
|
mOutStream = new PipedOutputStream(new PipedInputStream()); // fake so that io blocks
|
||||||
|
//new PebbleLESupport(this.getContext(),btDeviceAddress); // secret branch :P
|
||||||
|
}
|
||||||
|
else {
|
||||||
ParcelUuid uuids[] = btDevice.getUuids();
|
ParcelUuid uuids[] = btDevice.getUuids();
|
||||||
if (uuids == null) {
|
if (uuids == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -189,6 +198,7 @@ class PebbleIoThread extends GBDeviceIoThread {
|
||||||
mInStream = mBtSocket.getInputStream();
|
mInStream = mBtSocket.getInputStream();
|
||||||
mOutStream = mBtSocket.getOutputStream();
|
mOutStream = mBtSocket.getOutputStream();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
gbDevice.setState(originalState);
|
gbDevice.setState(originalState);
|
||||||
|
@ -361,7 +371,7 @@ class PebbleIoThread extends GBDeviceIoThread {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (e.getMessage().contains("socket closed")) { //FIXME: this does not feel right
|
if (e.getMessage() != null && e.getMessage().contains("socket closed")) { //FIXME: this does not feel right
|
||||||
LOG.info(e.getMessage());
|
LOG.info(e.getMessage());
|
||||||
mIsConnected = false;
|
mIsConnected = false;
|
||||||
int reconnectAttempts = prefs.getInt("pebble_reconnect_attempts", 10);
|
int reconnectAttempts = prefs.getInt("pebble_reconnect_attempts", 10);
|
||||||
|
|
Loading…
Reference in New Issue