API C# WriteCharacteristic during connection loss CySmart dongle

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

cross mob
D_Sd_3235936
Level 4
Level 4
25 sign-ins 50 questions asked 25 replies posted

In short: the API does not seem to generate a failure event in case of a write during connection loss.

Flow:

After connection established,  I shutdown the peer device.

Following that, I write WriteCharacteristic onto the inactive peer device, (I get no error on the write function itself.)

Setting a timeout of 33 seconds, (32 is max on most devices)

Listening to the OnCharacteristicWrite event for all timeout duration, according to documentation this one should tell me if the write was done.

Timeout ends,  I never get an event saying write failed, nothing from the dongle is indicating an issue.

Is there someway to verify connection is lost via GAP/GATT, or I must assume connection lost on retry?

Help me out guys!
Thanks!

 

This is following my attempts to find a solution to:
https://community.infineon.com/t5/PSoC-4/In-CySmart-API-getting-a-CONNECTION-TIMEOUT-event/td-p/3450...

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

Hello @D_Sd_3235936 ,

Once the BLE devices are connected and after connection, if no data is transferring between the devices(Master and slave) then empty packets will be transferred for every connection interval in order to keep the connection. If you shutdown the peripheral device then the central device will keeps on sending the empty packets until the supervision timeout occurs, and due to no response from the peripheral device, the central device will be disconnected after supervision timeout. So, if you send the write request then you won't receive a write failed event instead you will receive the 'Connection Terminated Notification' event with CONNECTION_TIMEOUT reason in the cysmart app.
Please refer to the attached BLE Air logs(I set the connection interval to 7.5ms and super vision timeout to 5seconds at the central side). From the air logs, you can observe that the Central device sending the empty packets until the super vision timeout (5 seconds) occurs.

Thanks,
P Yugandhar.

0 Likes
D_Sd_3235936
Level 4
Level 4
25 sign-ins 50 questions asked 25 replies posted

'Connection Terminated Notification' event with CONNECTION_TIMEOUT .

I am looking for that event in the API reference guide , but was not able to  find it.

How do I get it? 

What function invokes it?

The CySmart App is defiantly receiving it.

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

Hello,

ICyBleMgr: BLE Manager Provides APIs to scan, connect and to perform other GAP central operations. For the disconnection, cyApiErr Disconnect (ICyBleDevice device) is used to disconnect from a BLE device. Please refer to the Page 54 & 173 for more information.
Please refer to the attached Cysmart sample code.

Thanks,
P Yugandhar.

0 Likes

Thanks, ,



Neither me or the peer device sends a disconnect.



Connection is lost due to peer device shut down.



API does not indicate anything in that case.



Can you please verify the code example get any indication on peer device
being shutdown (after connection) ?



When using CySmart it is immediately indicates TIMEOUT event. How does
CySmart 1.3 know? Can you look at it code ? Can you provide the code?

Does CySmart even uses the API/DLL? If so can you look at the event it uses
for connection timeout?



It is very important to us to know if link is dead as we are uploading FW
via FOTA

0 Likes

I went through the attached example and unfortunately it does not support disconnection event.

Is there another example available? that supports all the events of the API?

 

0 Likes