Arm Mbed OS support forum

GATT Server Notifications not received

I’m in the process of designing a device that will act as a GATT server, streaming on five characteristics at roughly 33Bps. I’ve established the GATT service and set up my characteristics, and while they can be read from, notifications are not being sent to connected clients.

I’ve created a custom class for my service - a summary of the definition is as follows.

class GATTService {
public:
    GattService() : 
        _raw_char(
            "236fd558-ed37-4d21-a791-2119aede27bb",0,
            sizeof(Payload),
            sizeof(Payload),
            (GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ) ,
            NULL,
            0,
            false),
        _server(NULL),
        _ble(NULL),
        _event_queue(NULL),
        _gatt_service(
            "4f815c30-e3ff-4c1a-a81d-339698ced987",
             _raw_characteristic,
            1
         )

    void start(BLE &ble_interface, events::EventQueue &event_queue)
    {

        _ble = &ble_interface;
        _server = &ble_interface.gattServer();
        _event_queue = &event_queue;

        _server->addService(_gatt_service);

        _server->onDataSent(as_cb(&Self::when_data_sent));
        _server->onDataRead(as_cb(&Self::when_data_read));

        _server->onUpdatesEnabled(as_cb(&Self::when_update_enabled));
        _server->onUpdatesDisabled(as_cb(&Self::when_update_disabled));
        _server->onConfirmationReceived(as_cb(&Self::when_confirmation_received));

    }

     void setValue(Payload payload){

        bool enabled = false;
        _server->areUpdatesEnabled(_raw_char, &enabled);
        if(enabled){
            _server->write(_raw_char.getValueHandle(), (uint8_t*)&payload, sizeof(payload), false);
        }
    }

private:
     GattCharacteristic _raw_char;
     GattService _gatt_service;
     GattServer* _server;
     BLE* _ble;
     events::EventQueue *_event_queue;

Through debugging, I know that AttsHandleValueNtf() is being called as expected, but there is simply no notification being sent and the clients do not receive the updated value.

Hi David,

Have you enabled notification via your client? Which is controlled by CCCD.

Regards,
Desmond

I have, yes. The callback to say that the client is registered for notifications also fires, but the notifications themselves aren’t generated.