I have a peripheral running the S110 stack, which presents a characteristic to which I want the central (running S120) to be able to do a long write. What I've been trying goes something like this:
- Split up the data into < 18 byte chunks.
- Create a ble_gattc_write_params_t for each chunk, with:
- write_op set to BLE_GATT_OP_PREP_WRITE_REQ
- handle set to the characteristic handle
- flags set to 0
- offset, len, and p_value set according to the chunk
- Create a final ble_gattc_write _params_t, with:
- write_op set to BLE_GATT_OP_EXEC_WRITE_REQ
- handle set to the characteristic handle
- flags set to BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE
- offset and len set to 0
- p_value set to an unused buffer
- Send each ble_gattc_write_params_t, in order, with sd_ble_gattc_write(). Wait for a BLE_GATTC_EVT_WRITE_RSP event before sending the next.
Based on what I've read, this should work, but I never get the WRITE_RSP event. sd_ble_gattc_write() returns NRF_SUCCESS for the first call (it isn't called again).
A working example would be a great help, but I'll settle for informed speculation if that's what you can offer!
Kind Regards, Michael