- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using CYBLE416045-02 as a BLE logger device.
I have a read characteristic defined as shown. It has both Read and Notify selected.
This read mode should have the ability to send out data periodically as notifications.
In addition, it can also allow read on demand.
The following is my function to do the above said.
For notification, I am able to send out uint8_t data array of any size.
However, for the on demand read, the size is somehow limited to the 16 bytes that was set during configuration.
I would like to inquire if there is any possibility of making this on demand read to be of any size depending on the amount of data that is written into it.
Thank you
void SetCustomAttributeValue ( uint16 *pnData, uint16 nDataSize, bool bNotify)
{
if(bNotify)
{
cy_stc_ble_gatts_handle_value_ntf_t notificationPacket;
notificationPacket.connHandle = cy_ble_connHandle[0];
notificationPacket.handleValPair.value.val = (uint8 *)pnData;
notificationPacket.handleValPair.value.len = nDataSize;
notificationPacket.handleValPair.attrHandle = CY_BLE_LOGGER_CONTROL_DATA_CHAR_HANDLE;
/* To register the service change in the Database of the GATT Server */
// apiGattErrCode =
Cy_BLE_GATTS_WriteAttributeValueLocal(¬ificationPacket.handleValPair);
Cy_BLE_GATTS_Notification(¬ificationPacket);
}
else
{
cy_stc_ble_gatt_handle_value_pair_t cyDataChar;
cyDataChar.attrHandle = CY_BLE_LOGGER_CONTROL_DATA_CHAR_HANDLE;
cyDataChar.value.val = (uint8 *)pnData;
cyDataChar.value.len = nDataSize;
Cy_BLE_GATTS_WriteAttributeValueLocal(&cyDataChar);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @TW_Chia
The length of the read characteristic cannot be changed programmatically because once the service is discovered by client .Client will be able to read data of the defined length set in ble component at the peripheral side.
For notifications whatever length set in the ble component at peripheral side is the maximum length to send the data to client.
Thanks
Pratiksha V
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
You can also change the value of "length" in the BLE component and also Please have look at the "CE222046_Throughput_Measurement " GATT_OUT example project in the PSoC Creator to understand how to send data from PSoC6 peripheral to central device over BLE custom service.
Please let me know if this helps.
Thanks,
Pratiksha V
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good day PratikshaV,
Thank you for your reply. I need to have the length for this read characteristic changed programmatically.
This is because the length of data to be read will be different for different mode set.
Please advice.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @TW_Chia
The length of the read characteristic cannot be changed programmatically because once the service is discovered by client .Client will be able to read data of the defined length set in ble component at the peripheral side.
For notifications whatever length set in the ble component at peripheral side is the maximum length to send the data to client.
Thanks
Pratiksha V
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Pratiksha,
Thank you for the information.
Best regards,