@Override public void connect(String mac){ if (!isAvailable() || !isEnabled()){ throw new RuntimeException("Bluetooth is not avaliable!"); } if (mBluetoothAdapter.isDiscovering()){ mBluetoothAdapter.cancelDiscovery(); } if (mBluetoothService != null){ mBluetoothService.connect(mBluetoothAdapter.getRemoteDevice(mac)); } }
@Override public void reConnect(String mac) { if (!isAvailable() || !isEnabled()){ throw new RuntimeException("Bluetooth is not avaliable!"); } if (mBluetoothAdapter.isDiscovering()){ mBluetoothAdapter.cancelDiscovery(); } if (getConnectionState() == State.STATE_DISCONNECTED && mBluetoothService != null && mac != null){ mBluetoothService.connect(mBluetoothAdapter.getRemoteDevice(mac)); } }