No write request received when characteristic max length is 0

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
8 posts / 0 new
Last post
apoudret
Offline
Last seen:1 year 5 months ago
Joined:2017-09-22 08:33
No write request received when characteristic max length is 0

Hello,

I have configured my device as a peripheral. It provides a service, which contains a characteristic and a descriptor which both have the READ+WRITE permissions.
The characteristic and the descriptor are created with a max length of 0 and the GATTS_FLAG_CHAR_READ_REQ flag, since I use requests and not attribute storage.

When a remote device connects to the peripheral and reads or writes the descriptor, it works correctly, I get a BLE_EVT_GATTS_READ_REQ/BLE_EVT_GATTS_WRITE_REQ event.
When the remote device tries to read the characteristic, I also get the BLE_EVT_GATTS_READ_REQ event.
However when the remote device tries to write the characteristic, I do not get any event.

If I increase the max length of the characteristic it works, but I suppose this will allocate extra memory which I do not intend to use.
I was wondering if this is a of the SDK? Because it works correctly with a descriptor, and it also works when reading the characteristic (and I can send an answer with data).

Best regards,
Andy

Device:
PM_Dialog
Offline
Last seen:3 days 6 hours ago
Staff
Joined:2018-02-08 11:03
Hi apoudret,

Hi apoudret,

Could you please let me know which service are you using into your project? Did you make a custom service? It is highly recommended the max length of the writable characteristic not be equal to zero. When you write to a characteristic, you will get back an event, and if the length is 0, you will not able to get it. So, please try to change the max length of the characteristic, and let me know if you are able to get the event. Be aware that is not an issue of the SDK.

Thanks, PM_Dialog

apoudret
Offline
Last seen:1 year 5 months ago
Joined:2017-09-22 08:33
Hello,

Hello,

Indeed this is a custom service.
为什么这个SDK只存在的限制characteristics and not for descriptors?I haven't seen this limitation with other SDKs (ESP32/TI).
I guess specifying a max length would take extra memory. I will not use this memory since I do not want to use attribute storage but write requests. Is there an equivalent of the BLE_EVT_GATTS_READ_REQ flag for writing?

Thanks,
Andy

PM_Dialog
Offline
Last seen:3 days 6 hours ago
Staff
Joined:2018-02-08 11:03
Hi apoudret,

Hi apoudret,

I am searching your issue and I will get back to you with a proper answer as soon as possible.

Thanks, PM_Dialog

apoudret
Offline
Last seen:1 year 5 months ago
Joined:2017-09-22 08:33
Hello PM_Dialog,

Hello PM_Dialog,

Do you have any update on this issue?

Best regards,
Andy

PM_Dialog
Offline
Last seen:3 days 6 hours ago
Staff
Joined:2018-02-08 11:03
Hi apoudret,

Hi apoudret,

Sorry for the delay, I was trying to replicate your issue. If the max length of the descriptor is equal to zero, you will get both write and read requests, as you have already mentioned. In case of the characteristics, if the max length is equal to zero, you will get only read requests and but not write requests. This is not a limitation of the SDK, but this is the way that the BLE stack handles the max length of the characteristic. If you want to get a write request, the max length of the characteristic should be equal or more than 1. Regarding you second question, there isn’t any equivalent of the BLE_EVT_GATTS_READ_REQ flag for writing

Thanks, PM_Dialog

apoudret
Offline
Last seen:1 year 5 months ago
Joined:2017-09-22 08:33
Hello,

Hello,

Yes this is a limitation of your BLE stack, which is part of your SDK. I don't see any mention of this limitation in the standard BLE core specification.
Which max length value should I consider using for a generic descriptor?

Best regards,
Andy

PM_Dialog
Offline
Last seen:3 days 6 hours ago
Staff
Joined:2018-02-08 11:03
Hi apoudret,

Hi apoudret,

There isn’t a standard value for the max length of the descriptor. The max length depends on the implementation of the descriptor.

Thanks, PM_Dialog