discoverServices() returning null service?
See original GitHub issueHi. I’m facing with discoverServices() error.
BLE logs below. Just tell if You need something more… Or what is wrong in this code?
final Subscription subscription = bleDevice.establishConnection(false)
.takeUntil(disconnectTriggerSubject)
.flatMap(new Func1<RxBleConnection, Observable<RxBleDeviceServices>>() {
@Override
public Observable<RxBleDeviceServices> call(RxBleConnection rxBleConnection) {
Log.d(TAG, "BLE connection to " + bleMac + " done!");*
// Add this connection to a map for later use
connectionMap.put(bleMac, rxBleConnection);
return rxBleConnection.discoverServices();
}
})
.map(new Func1<RxBleDeviceServices, ConnectedDevice>() {
@Override
public ConnectedDevice call(RxBleDeviceServices rxBleDeviceServices) {
Log.d(TAG, "Got service BLE from " + bleMac);
BluetoothGattService ngService = null;
for (BluetoothGattService service : rxBleDeviceServices.getBluetoothGattServices()) {
Log.e(TAG, "ngServices UUID: " + service.getUuid());
Log.e(TAG, "ngServices Instance Id: " + service.getInstanceId());
if (NG_SERVICE_UUID.equals(service.getUuid())) {
ngService = service;
break;
}
}
// If there are no proper service, just throw an error
if (ngService == null) {
throw new IllegalArgumentException("Connected device not a proper ng device");
}
BLE LOGS:
E/BleManager: isConnected: RxBleConnectionState{DISCONNECTED}
D/BluetoothGatt: connect() - device: E5:07:96:5E:94:CD, auto: false
D/BluetoothGatt: registerApp()
D/BluetoothGatt: registerApp() - UUID=04b2518b-01e4-4160-9296-461bfea33036
D/BluetoothGatt: onClientRegistered() - status=0 clientIf=14
D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=14 device=E5:07:96:5E:94:CD
D/BleManager: BLE connection to E5:07:96:5E:94:CD done!
D/BluetoothGatt: discoverServices() - device: E5:07:96:5E:94:CD
D/BluetoothGatt: onSearchComplete() = Device=E5:07:96:5E:94:CD Status=0
D/BleManager: Got service BLE from E5:07:96:5E:94:CD
E/BleManager: Connected device not a proper ng device
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
discoverServices() returning null service? · Issue #242 - GitHub
Hi. I'm facing with discoverServices() error. BLE logs below. Just tell if You need something more.. Or what is wrong in this code ......
Read more >BluetoothGatt.discoverServices() returns null - Stack Overflow
I'm using Android studio to make a simple app, that connects to a ble device and reveives data from it. Already checked the...
Read more >src/com/android/bluetooth/gatt/GattService.java - Google Git
if (service == null) return new ArrayList<BluetoothDevice>();. return service. ... Log.e(TAG, "discoverServices() - No connection for " + address + "..."); }.
Read more >BluetoothGatt - Android Developers
GATT write operation is not permitted ... public boolean discoverServices () ... or null if the requested service is not offered by the...
Read more >QLowEnergyController Class | Qt Bluetooth 6.4.1
This process is started via discoverServices() and has finished once the ... This function returns a null pointer if no service with serviceUuid...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
But you can check on the device that does not exhibit the bug if a
Generic Attribute Service
is discovered.Never seen this behaviour