I couldn't able to understand your issue correctly.
Do you mean , your project will work perfectly till (say ) 12 hrs, later some point of time, it will stop connecting to the Central device or won't work as expected?
Could you please share your project and steps to reproduce to test at our side?
Yes, my project works perfectly and, later some point of time (3hrs, 12hrs or 18hrs..), it will stop.
My sensor is always bleprofile_Discoverable() active.
A client can connect to it with an other CYW20736 or a smartphone.
When the point of time is delayed my sensor application seems working (I can push button and change led's color) but the BLEis not discoverable (I can't see it with my smartphone)...It's seems that only the BLE layer is not active...
In hello_sensor_advertisement_stopped() callback, I have tried to replace bleprofile_Discoverable(HIGH) by a set_adv(1) function (i can't remeber the function) but the problem is unchanged..
I have tried with bleprofile_Discoverable(LOW) the problem seem solved (my board is always running and works since 5 days).
I hope the problem was the use of LOW_UNDIRECTED in place of HIGH_UNDIRECTED..
Does it exist a function which return the state of the BLE device (scanning or not)?
If yes, I could periodically use it and restart the scan if it stoped
The API bleprofile_Discoverable() should work with HIGH_UNDIRECTED as well. Not sure why its failing after few hours.
Q) Does it exist a function which return the state of the BLE device (scanning or not)?
A) Do you mean scanning or advertising? If about advertising, you may try the API - bleprofile_GetDiscoverable(void); (/WICED-Smart-SDK/include/bleprofile.h) . Check if it helps your requirement.