Skip to content

Commit

Permalink
Merge pull request #2 from datahop/integration.1
Browse files Browse the repository at this point in the history
check if already gatt connected
  • Loading branch information
srene authored Jun 28, 2021
2 parents ef1c500 + 690317a commit da29eb4
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,14 @@ private boolean connect(final String address) {
return false;
}

List<BluetoothDevice> devices = mBluetoothManager.getConnectedDevices(BluetoothProfile.GATT);
for (BluetoothDevice d : devices) {
if (d.getAddress().equals(address)) {
Log.d(TAG, "Device Connected");
return true;
}
}

device = mBluetoothAdapter.getRemoteDevice(address);
if (device == null) {
Log.d(TAG, "Device not found. Unable to connect.");
Expand Down

0 comments on commit da29eb4

Please sign in to comment.