ARMmbed / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things
https://mbed.com
Other
4.67k stars 2.98k forks source link

Cordio BLE stack: No callback comes to the application for Descriptor Read and Write #9771

Closed cy-kishore closed 5 years ago

cy-kishore commented 5 years ago

When a GATT client reads or writes to the Characteristic descriptor application does not receive any read and write callback.

The below function GattServer::insert_descriptor in CordioGattserver.cpp does not set callback bits. Can you please check. Probably below bits need to be set for descriptors as well.

attribute_it->settings = ATTS_SET_READ_CBACK; attribute_it->settings |= ATTS_SET_WRITE_CBACK;

Issue request type

[ ] Question
[ ] Enhancement
[X ] Bug
ciarmcom commented 5 years ago

Internal Jira reference: https://jira.arm.com/browse/MBOCUSTRIA-898

desmond-blue commented 5 years ago

Duplicate of #9732 @akkishore1 We already merged the fix by this pull request #9748, could you check if this solve your issue? Thanks.

cy-kishore commented 5 years ago

Hi, This issue is different from #9732. #9732 is for Readcallback for Characteristics. This issue is there are no callbacks coming when we read or write to characteristic descriptors. I think you need to have similar callback bits set in GattServer::insert_descriptor function in CordioGattserver.cpp

desmond-blue commented 5 years ago

I apologize that I misunderstood this description, we will look into it.

desmond-blue commented 5 years ago

Hi @pan- ,

My thought for what we need to change is

pan- commented 5 years ago

@desmond-blue IIRC correctly it is asked that users set their properties for these descriptor types; the only exception being CCCD as they are implicitly instantiated if a characteristic is able to notify or indicate. More generally, I believe the whole GattServer API needs a refresh as it is not built on sane grounds.

desmond-blue commented 5 years ago

@pan- Even if users set the read/write properties, current GattServer::insert_descriptor() API doesn't check this and doesn't set callback. I would like to propose this fix, would you take a look at it?

Or do you already have a plan for refreshing this API?

Thanks for your help.

pan- commented 5 years ago

@desmond-blue Happy to approve your fix as it solves one of the issue. It must be stretched out that it does not solve the case when the value of the descriptor being read needs to be generated at access time or authorisation/rejection of a descriptor write. For that we would need an API refresh.

desmond-blue commented 5 years ago

Thanks @pan- , so we could use this PR #9948 for this issue now, and we may need to raise other tasks for GattServer API refreshing?

cy-kishore commented 5 years ago

Fixed on master branch of mbed. Verified the same.