How to establish notifications without a subscription?

My task looks like Case ID: 115570, but now running nRF SDK 2.1.3 on nRF52840-DK.

My GATT server (Peripheral) has to send a special msg (see log) right after CONNECT_IND using a notification service to the Central. The Central itself cannot be changed (old BT 4.2 device, no source code...).
But I cannot send notifications without a subscription. 


[00:00:17.341,705] <inf> PP: Connected to con 0x20001388: 72:04:D2:F5:8F:47 (random)
[00:00:17.939,605] <inf> PP: Sende ACK
[00:00:17.939,636] <dbg> remote: send_ack: conn 0x20001388 msg bc5301dd
[00:00:17.939,666] <wrn> bt_gatt: Device is not subscribed to characteristic

How can I enable sending notification messages without having a subscription from Central using SDK 2.1.3 ?

 

  • Hello Edvin,

    it's not at all confusing, the matter is clear. Thanks for your explanations.
    Nevertheless I have to solve the problem, i.e. overcome the problems of a buggy BLE firmware of a black-box device I cannot change.

    After a closer look it seems to be a time critical problem as well. Now I'm looking for a solution to get an event on my Pheripheral when GATT profile enumeration is initiated or is done.
    Any suggestions?

    Thanks - Matthias

  • Hello Matthias,

    I understand. Unfortunately, a black box central is more difficult than a black box peripheral.

    Do you have access to a black box peripheral that goes with this black box central?

    It sounds like you are able to connect to your central. This means that the central decides to connect to your peripheral (it is always the central that initiates the connection). How did you know what you needed in order for the central to connect?

    I am just trying to catch up with what you already know, and perhaps we can figure out a way to understand what your central is looking for.

    BR,

    Edvin

  • Yes, indeed I have both - the black-box central as well as the black-box peripheral (the one I'm going to substitute now).

    After CONNECT_IND (central) and exploring the GATT profile, the peripheral has to send a special value (probably in a short opened time window). After receiving this cookie the central sends another special value, so the peripheral knows the central fits. Only this way both sides keep the connection, otherwise it will be dropped.

    Unfortunately my central "forgets" to enable notification - the channel, where the cookie from the peripheral is expected.

    The image taken from wireshark shows, how to connect successfully - both black-boxes (central and pheripheral)

    The "aa5501aa" is the cookie sent from peripheral to central. The central answers 2x with "aa5501bb"

  • Hello Matthias,

    The reason the central "forgets" to send an enable notifications message can be caused by anything. We don't know what code is running on it. For all we know the central application logic could be something like:

    Only enable notifications if the BLE address belongs to a specific company (since I can see from your screenshot that the device uses a vendor specific BLE address (many call them MAC address). That is why you can see "company name" followed by 3 bytes in the address field, instead of just 6 bytes in the address field.

    Nonetheless, if you have the peripheral blackbox as well, did you try to connect to it using nRF Connect for Desktop -> Bluetooth Low Energy, and look at all the services and characteristics that it has? Do you have all those characteristics in your peripheral application?

    BR,

    Edvin

  • Hello Edwin,

    finally I've managed to fake nearly all of them - advertising packet, scan response, device address, GATT profile 0x180A (DIS) and 0x1000 the customer functions, where the secret cookies should be exchanged.
    For GATT inspection I did use the GATT Browser from Renesas (very useful because displayed data do not disappear when device is disconnected - but don't forget to switch to light theme on iOS, otherwise the font vanishes...).
    Some entries in 0x180A (DIS) are missing, and I couldn't figure out how to add a user description to each GATT function.
    The black-box central tries to connect to my nordic implementation, and after a few attemps it works sometimes. But it seems to me to be a timing problem - the central opens a short timing window after it has discovered the peripheral GATT profile - this small window I have to hit with my cookie.
    But when thsi window opens depends on how much traffic is on the air.

    So it would be greate to have an event when GATT profiling is in progress or finished - is there a possibility to get a user callback function involved?

    Thanks in advance - Matthias

Related