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 ?

 

  • 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.

    What exactly do you mean by this?

    I am not aware of any events generated on the peripheral when the central has finished it's service discovery, if that is what you mean? What do you need to do at this point in time? Is it something that you see from the sniffer trace of the two original devices?

    BR,
    Edvin

  • Not sure if this is helpful, but if you bond the devices, then a subscribed notification is persisted across reconnections. You can therefore send a notification immediately after the connection has been established in that case.

  • Hello Edvin,

    I in fact now can connect to the black-box-central, but need good luck for it - connection procedure isn't deterministic as expected. In only a few cases the central opens notification - and all works fine this case. I can send my cookie without notifictation enabled as well, but there is only a short time for it - the window opens for about 500ms after end of GATT enumeration.
    On any earlier or later attempts the connection is dismissed by the central. And how long GATT enumeration takes depends on BT traffic.
    The idea - if I can (re)start a timer (say 300ms) whenever GATT enumeration takes place I would get a really good chance to hit the timing window when this timer expires. 

    Reconnection
    This box of bunches I havn't opened yet... coming soon.

  • Hello Edvin,

    finally I've found a solution. Add this line to 'prj.conf

    CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION=n          # n: allow sending notification messages without having notifications enabled

    disables the check (in gatt.c) and one can send notifications independent from beeing enabled before.

    Best regards - Matthias

Related