Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BLE] Subscription/Notification does not work #24

Closed
8 tasks
ThumbGen opened this issue Jun 27, 2019 · 8 comments
Closed
8 tasks

[BLE] Subscription/Notification does not work #24

ThumbGen opened this issue Jun 27, 2019 · 8 comments
Labels
bug Something isn't working more-info-needed More information needs to be provided by the issue author

Comments

@ThumbGen
Copy link

Please check all of the platforms you are having the issue on (if platform is not listed, it is not supported)

  • iOS
  • [ X] Android
  • UWP
  • .NET Standard

Feature Library

  • Core
  • [ X] BluetoothLE
  • Locations
  • HTTP Transfers
  • Notifications
  • Sensors

Version of OS(s) listed above with issue

Android 8.0

Version of Library

1.0.0.244-beta

Expected Behavior

Subscribing to notifications should work.

Actual Behavior

None of the 3 GATT clients I've tried is able to subscribe to the "notifiable" characteristics offered by a Shiny GATT server.

The problem is reproducible with the latest Shiny-Samples project too (I saw there are notifications there too).

@aritchie
Copy link
Member

Please file a reproducible case where possible. This is still in beta, so I need help, not just issues. The GATT server is not completed fully yet obviously.

@ThumbGen
Copy link
Author

The best case possible is your own excellent Samples project:

In Sample.BlePeripherals.MainViewModel, there's

                            this.notifications = sb.AddCharacteristic
                            (
                                NotifyCharacteristicUuid,
                                cb => cb.SetNotification(cs =>
                                {
                                    var subs = cs.Characteristic.SubscribedCentrals.Count;

                                    var @event = cs.IsSubscribing ? "Subscribed" : "Unsubcribed";
                                    this.Write($"Device {cs.Peripheral.Uuid} {@event}");
                                    this.Write($"Charcteristic Subcribers: {subs}");

                                    if (subs == 0)
                                        this.StopTimer();
                                    else
                                        this.StartTimer();
                                })
                            );

Using the "Bluetooth LE Explorer" app from Windows Store I've managed to list the characteristic, it is correctly displayed as "notifiable", but attempting to subscribe to it fails. The code inside the "SetNotification" subscription handler is never called.

@fryette
Copy link

fryette commented Jun 27, 2019

I also experienced this issue, but in my case it was incorrect configuration for device which advertise characteristic. Check is it everything OK with nrfConnect application(check it on iOS and Android store), and if even nrfConnect fail -something wrong with your BLE configuration

@ThumbGen
Copy link
Author

I have just tried the ACR Bluetooth LE app and the problem exists there too (other apps like BLE Sim work correctly).

Reading https://stackoverflow.com/questions/17910322/android-ble-api-gatt-notification-not-received
I've noticed this sentence:

"All of the writeGattDescriptors must come first and complete before you issue any readCharacteristic calls."

No idea, I thought this might help...

@aritchie
Copy link
Member

@ThumbGen Did you try anything from the link you provided?

@aritchie aritchie added bug Something isn't working unverified This issue has not been verified by a maintainer pinned labels Jun 29, 2019
@aritchie
Copy link
Member

This is working fine for me using iOS nrf connect to android shiny gatt server running in the sample app. Was there an exception? Anything in the output window.

@aritchie aritchie added could not reproduce more-info-needed More information needs to be provided by the issue author and removed unverified This issue has not been verified by a maintainer labels Jun 30, 2019
@ThumbGen
Copy link
Author

ThumbGen commented Jul 1, 2019

Sorry for the delayed reply, indeed it was a problem on my side.
I had to add the CCCD flag with notifications on the subscriber side; now the notifications are working and are absolutely awesome!

Thank you!

@lock
Copy link

lock bot commented Aug 22, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working more-info-needed More information needs to be provided by the issue author
Projects
None yet
Development

No branches or pull requests

3 participants