This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Receive GATT Notifications with SimpleBLEPeripheral code

Other Parts Discussed in Thread: CC2540

Hi!

I'm working with CC2540 Mini Development Kit and I would like to know how can I receive notifications from the Master (HostTestRelease code) in the Slave device (SimpleBLEPeripheral code). I can send them calling GATT_Notification function in HostTestRelease code but I don't know how and where to receive them with SimpleBLEPeripheral code. The access to GATT_processEvent  function is denied and there are only simpleProfile_WriteAttrCB and simpleProfile_ReadAttrCB callback functions available.

Thanks in advance!

Lara

  • Your application needs to call GATT_RegisterForInd during initialization and pass in its task ID. This will cause notification and indication messages to be sent to your application.

  • I've tried what you suggested but it seems that doesn't work. I've just added  GATT_RegisterForInd( simpleBLEPeripheral_TaskID )  sentence in SimpleBLEPeripheral_Init function. Then I put a breakpoint in SimpleBLEPeripheral_ProcessEvent , where System Event Messages (SYS_EVENT_MSG) are received and I debugged the code; but the execution does not stop at that point when the Master device sends the notification. Maybe there is something missing but I can't find it out.

    Thanks anyway!

    Lara

  • One more step I forgot to mention: before calling GATT_RegisterForInd, you must call GATT_InitClient in your application Init function. The code should look like this:

     

      // Initialize GATT Client
      VOID GATT_InitClient();
     
      // Register to receive notifications
      GATT_RegisterForInd( appTaskId );

  • This time it works!

    Thank you very much!