I have gone through this note: PSoC 4 BLE Troubleshooting Guide – KBA220490
Got the below mentioned reference:
14. If I set the MTU of the connection as 23 bytes and Server GATT characteristic size to 512 bytes (maximum value), I can send larger values using the GATT Write Long Characteristic Value operation. However, if the MTU size is 512 bytes, I can use the simple GATT write request. What are the differences between these two write operations?
A) The maximum length of an attribute value is 512 octets
If you are using a Write request, you can write up to (max negotiated MTU) – 3 bytes. Thus, if the negotiated MTU size is 512 bytes, the maximum value which you can write is 509 bytes in a single write operation.
In the Write long method, you can write a maximum value up to the maximum attribute length, that means up to 512 bytes.
Application example: Suppose your Peripheral is a CyBLE device and has a Central device (mobile phone, CyBLE etc.). Some mobile phones have the MTU size restricted to a particular value, say 23. The negotiated MTU size becomes 23 regardless of the MTU size of your Peripheral device because your Central device's MTU size is 23. If you want to write a value to the GATT Server characteristic which is greater than 23 bytes, the only option is write long
Note: Negotiated MTU size means the minimum of (MTU size of Central, MTU size of Peripheral). This negotiated MTU size will be used for the rest of the communication between Central and Peripheral.
We found the below event in BLE for long characteristic value : CYBLE_EVT_GATTS_EXEC_WRITE_REQ.
Is there any application note, to write this procedure ?
is there any reference code available ?
Please check this:
UART_DBG_PutString("\n BLE: CYBLE_EVT_GATTS_EXEC_WRITE_REQ ");
errorcode=CyBle_GattsWriteAttributeValue(&write_characteristic, 0, &cyBle_connHandle, CYBLE_GATT_DB_PEER_INITIATED);
err_rsp.attrHandle = write_characteristic.attrHandle;
err_rsp.errorCode = errorcode;
err_rsp.opcode = (uint8) CYBLE_GATT_WRITE_REQ;
UART_DBG_PutString("Long characteristic written by GATT client. The written values are:\n\r");
/*Compute the total length of the long characteristic*/
write_data_len = write_data_len + execwriteReqparam->baseAddr[i].handleValuePair.value.len;