public BluetoothGattClient GattConnect(bool autoConnect) { BluetoothGattClient client = null; if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) { int ret = BluetoothLeImplAdapter.Instance.GattConnect(_remoteAddress, autoConnect); if (ret != (int)BluetoothError.None) { Log.Error(Globals.LogTag, "Failed to create GATT Connection with remote device- " + (BluetoothError)ret); } else { client = BluetoothGattClient.CreateClient(_remoteAddress); } } else { BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); } return(client); }