1 Reply Latest reply on Mar 1, 2018 2:23 AM by AnjanaM_61

    BLE Write Offset




      We are currently using the BCM4343W chip to handle ble and wifi and using SDK 4.1.


      In our BLE profile, we have a characteristic that is used to setup the WiFi.

      Obviously, this characteristic is quite big and has 114 Bytes (SSID, Password, Security Type, Static config, etc...)


      During our tests, we have no issue to write into this characteristic when using an iOS app.

      While using an Android app, the writing is made in smaller chunks, therefore, we get:

      • 5 write callbacks (each of 20 bytes long and the last one of 14 bytes


      As for the read, we were expecting to get an incremental offset in order to copy the data properly in the characteristic value.

      But it is not the case... we get at each callback an offset of 0... Therefore we don't know how we can detect that the write request is not completed hence, the action behind fails because of that.


      Is that normal? Shouldn't the offset be incremented in such cases?

      We are testing with a generic Android app, is that the app that should increase the offset?


      Snip of my Write Callback function:

      // Verify that size constraints have been met
      if ((ble_gatt_db_ext_attr_tbl[i].max_len >= p_write_request->val_len) && (p_write_request->val_len > 0))
           // Value fits within the supplied buffer; copy over the value at position: Offset
           gatt_db_ext_attr_tbl[i].cur_len = p_write_request->val_len;
           memcpy(ble_gatt_db_ext_attr_tbl[i].p_data, p_write_request->p_val, p_write_request->val_len);
           status = WICED_BT_GATT_SUCCESS;
           WPRINT_BT_APP_INFO(("[BLE-WRITE]: Write Request: conn_id:%d hdl:0x%x prep:%d offset:%d len:%d\n ", currentConnection.conn_id, p_write_request->handle, p_write_request->is_prep, p_write_request->offset, p_write_request->val_len));
           // Offset is always 0


      Thank you for your feedback!

        • 1. Re: BLE Write Offset



          In BLE the size of normal GATT writes depends on the negotiated MTU size set in the connection.

          Probably in case of Android app, the MTU might have set to 23, that is why you were able to see GATT writes happening in (MTU-3) 20 bytes chunks. If you want to send whole data in one single write operation, please check whether your android phone supports MTU size to be set to (datasize + 3) bytes.