2 Replies Latest reply on Aug 10, 2015 10:26 AM by kwang

    Multiple Notifications after write to GATT DB/write handler question

      Hello everybody,

       

      we're working on an iOS app that will transfer and receive data via Bluetooth LE over custom services and characteristics. These are implemented using SDK 2.2.0 on an BCM90276S module. This will transfer the data via PUART to a MCU.

       

      If the app writes to a characteristic, the write handler is called and the received data is transferred to the MCU, this does work. If the MCU wants to communicate with the app, it writes data via PUART into the BLE module, which works, too.

      This puts the received data into the GATT DB and sends a notification.

      Now the app gets multiple notifications and is confused - as are we.

       

      So I have two questions:

      This is the code that sends the Notification after receiving it from the PUART:

      BLEPROFILE_DB_PDU tempPDU;
      bleprofile_ReadHandle(handle, &tempPDU); //read to tempPDU
      memcpy(tempPDU.pdu, data, tempPDU.len); //memcpy new data to tempPDU
      bleprofile_WriteHandle(handle, &tempPDU); //write new data to GATT DB
      if (blecm_getAvailableTxBuffers() > 0) //check if TX buffer is not full
      {
      bleprofile_sendNotification(handle, data, length); //sent notification
      }
      
      

      Does bleprofile_WriteHandle automatically generate a notification if the characteristic has a LEGATTDB_CHAR_PROP_NOTIFY?

       

      And does a bleprofile_WriteHandle issue a write_handle_callback?

      I'm registering one, that will send the received characteristic via PUART:

      legattdb_regWriteHandleCb((LEGATTDB_WRITE_CB)my_ble_write_handler);
      
      

       

      Would a possible work around be the following:

      legattdb_deRegWriteHandleCb((LEGATTDB_WRITE_CB)my_ble_write_handler);
      bleprofile_WriteHandle(handle, &tempPDU);
      legattdb_regWriteHandleCb((LEGATTDB_WRITE_CB)my_ble_write_handler);
      
      

       

      Thanks for your help!

       

      Best regards

      Hannes Baumgart