Git Product home page Git Product logo

Comments (4)

MoldovanRaduOctavian22 avatar MoldovanRaduOctavian22 commented on July 17, 2024

Hello @weliem and @Kindzer

I'm in a similar situation to the one described above, I use my Android app to write the CCC descriptor to 0100 in order to enable notifications, but when I run my BLE server on the RaspberryPi it sometimes seems to misinterpret the writing of that descriptor and not enable the characteristic notifications. I found this out by monitoring the DBUS Bluez messages:

When notifications get enabled and things work fine, the StartNotify method gets called when I write the CCC descriptor:

Type=method_call Endian=l Flags=1 Version=1 Cookie=2651 Sender=:1.16 Destination=:1.99 Path=/org/bluez/dbz_application/service_0/char_1 Interface=org.bluez.GattCharacteristic1 Member=StartNotify UniqueName=:1.16 MESSAGE "" { };

When the notifications don't trigger, the WriteValue for the descriptor method gets called:

Type=method_call Endian=l Flags=0 Version=1 Cookie=2844 Sender=:1.16 Destination=:1.107 Path=/org/bluez/dbz_application/service_0/char_1/desc_0 Interface=org.bluez.GattDescriptor1 Member=WriteValue UniqueName=:1.16 MESSAGE "aya{sv}" { ARRAY "y" { BYTE 1; BYTE 0; }; ARRAY "{sv}" { DICT_ENTRY "sv" { STRING "device"; VARIANT "o" { OBJECT_PATH "/org/bluez/hci0/dev_74_B0_0A_B8_27_BF"; }; }; DICT_ENTRY "sv" { STRING "link"; VARIANT "s" { STRING "LE"; }; }; DICT_ENTRY "sv" { STRING "mtu"; VARIANT "q" { UINT16 517; }; }; }; };

The problem gets encountered randomly, when I run my program notifications either work fine or not at all and I didn't find any particular reason for this.

I have also noticed that running the BLE server functionality by itself never made me run into this issue. I use the library to create a BLE server into a program that does many other things, and works on several threads. This is the cases in which the issue appears infrequently.

Did you find any cause for the problem ?

I'll try my best to find a solution and reach you out if I discover something.

from bluez_inc.

weliem avatar weliem commented on July 17, 2024

Please share the code where you create your services and characteristics so that I can try to reproduce the issue.

from bluez_inc.

MoldovanRaduOctavian22 avatar MoldovanRaduOctavian22 commented on July 17, 2024

Please share the code where you create your services and characteristics so that I can try to reproduce the issue.

I have found the problem for my case. Bluez automatically creates CCC notification descriptor when you create a characteristic that has the 'notify' flag, but I thought that I have to manually create the CCC descriptor in code. Once I removed the code that creates the descriptor, the notifications started to work fine. It must have had a conflict between the 2 descriptors, the CCC one and the one that I was creating.

from bluez_inc.

Kindzer avatar Kindzer commented on July 17, 2024

Hi everyone, I found out the issue after I got access to Android application source code. It turned out that the Android application is made with wrong approach. All requests are handled with Thread.sleep() which can probably work with rtos, but not with linux. I tried to make some changes there and made it work.

The second problem is that notification are actually enabled only on android side and there were no actual write requests to ccc descriptors for enabling them on linux side.

from bluez_inc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.