Other Parts Discussed in Thread: CC2650, BLE-STACK, CC2540EMK-USB
Hi,
I am developing my own app for the CC2650 STK in Android Studio. To do this I've downloaded the Android Source Code from git.
However this is a version from 2015. Is there a newer one anywhere?
I have adapted the code slightly and the scanning for devices works fine. If I want to connect to the device, I get an error, saying that my BluetoothLeService is a null object, when I try to call the connect method. I don't really understand as I have the same code that is used in the Android source code from TI.
Did anyone have a similar problem before?
This is my onConnect() method, which is called from my MainActivity
void onConnect() {
if (mNumDevs > 0) {
int connState = btManager.getConnectionState(mBluetoothDevice,
BluetoothGatt.GATT);
switch (connState) {
case BluetoothGatt.STATE_CONNECTED:
mBluetoothLeService.disconnect(null);
break;
case BluetoothGatt.STATE_DISCONNECTED:
boolean ok = mBluetoothLeService.connect(mBluetoothDevice.getAddress());
if (!ok) {
setError("Connect failed");
}
break;
default:
setError("Device busy (connecting/disconnecting)");
break;
}
}
}
Thank you for you help!
Best, Claudia