CYBLE416045-02 iOS Development Issue

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
TW_Chia
Level 3
Level 3
First like received 25 replies posted 10 sign-ins

We have done the application to connect with the BLE device for Windows and Android.

We have started to devlop app for iOS devices.

However, we encountered some issue.

For the BLE device, we have 2 custom characteristics.

  1. A Write Characteristic

    - allow the computing device to send control information to the BLE peripheral device.

    - this has the option Write without Response selected

  1. A read Characteristic

    - allow logged BLE device data to be sent to the computing device

    - BLE device data is periodically sent out to the computing device .

    - Computing device will need to subscribe to this characteristic to be able to read the data.

Issue with iOS

- After one subscribe to the read characteristic, any data sent via the write characteristic will not be received by the BLE device.

- Before one subscribes to the read characteristic, data can be sent via the write characteristic to the BLE device.

- Another issue is after subscribing the read characteristic, the BLE connection will disconnect after 30 secs.

1 Solution
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello, 

Please refer to the attached working project. I have done the below change in the code.

************************************************************************
case CY_BLE_EVT_GATTS_WRITE_REQ: //Write with response

Cy_BLE_GATTS_WriteRsp(cy_ble_connHandle[0]);

break;

case CY_BLE_EVT_GATTS_WRITE_CMD_REQ: //Write without response
{
************************************************************************

Thanks,

P Yugandhar.

View solution in original post

0 Likes
11 Replies
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

Could you please let me know your observations with the Cysmart APP ?

Make sure that you are updating the data of the specified attributes in the GATT Database of a GATT Server.
Please refer to the Cy_BLE_GATTS_WriteAttributeValuePeer and Cy_BLE_GATTS_WriteAttributeValueLocal apis for more information. These functions are used to write to the value field of the specified attribute in the GATT database of a GATT Server.

Please let me know if this helps.

Thanks,
P Yugandhar.

0 Likes

Good day Yugandhar,

Observations on ioS Cysmart App

i. After connecting to the device,  select GattDB and and select unknown services. Next click on the characteristics with a read and notify properties follow by selecting  Notify. 

with these one can see the data sent out from the BLE device. Hence, there should be no issue with the write functions.

After 30 secs. disconnection will occur.

Hopefully, you can enlighten me on the possible issue.

 

Thank you.

0 Likes
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

Make sure that you have sent a Write Response to GATT Client using Cy_BLE_GATTS_WriteRsp(cy_ble_connHandle[0]) api in CY_BLE_EVT_GATTS_WRITE_REQ event at the peripheral side.

Thanks,
P Yugandhar.

0 Likes

Good afternoon Yugandhar,

Thank you for your reply.

I have tried using Cy_BLE_GATTS_WriteRsp(cy_ble_connHandle[0]) .

However, disconnection still occurs 30s after selecting notify for the read characteristic.

 

FYI

0 Likes

Good day,

Is it possible that you sent me a solution to test on my hardware which you have tested and that the connection is not disrupted after 30 secs.

 

Thank you. 

0 Likes
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello, 

Please refer to the CE222046_GATT_OUT Code example from the PSoC Creator. 

If possible, you can share your PSoC6 BLE Peripheral project. I will test at my end.

Thanks,

P Yugandhar. 

0 Likes
lock attach
Attachments are accessible only for community members.

Good day,

 

Thank you for the example.

I have also attached my project files.

 

Best regards,

 

0 Likes
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello, 

Please refer to the attached working project. I have done the below change in the code.

************************************************************************
case CY_BLE_EVT_GATTS_WRITE_REQ: //Write with response

Cy_BLE_GATTS_WriteRsp(cy_ble_connHandle[0]);

break;

case CY_BLE_EVT_GATTS_WRITE_CMD_REQ: //Write without response
{
************************************************************************

Thanks,

P Yugandhar.

0 Likes

Good afternoon Yugandhar,

Thank you very much. Yes, indeed the disconnection issue is resolved.

I would like to understand more.

Is this event CY_BLE_EVT_GATTS_WRITE_REQ called when one sends Notify request?

One will need to send this Cy_BLE_GATTS_WriteRsp(cy_ble_connHandle[0]) in response to the request.

Am I right on this?

0 Likes
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

If the client wants to receive notifications or indications, then the client must write to the client characteristic configuration descriptor(enabling the Notify from client device). For this write operation, central device will expects a write response from the peripheral device.

Thanks,
P Yugandhar.

0 Likes

Good day Yugandhar,

 

Thank you for the explanation. I  greatly appreciate it.

 

Have a great weekend.

0 Likes