When you call StopScan API, the CYBLE_EVT_GAPC_SCAN_START_STOP API should be triggered, Only after this event is triggered, you need to call the ConnectDevice API.
Also, you can use the CyBle_GetState API to see the state of the device then and there,
What does the state CYBLE_STATE_STOPPED mean? Is it indicating the scanning has stopped?
Thanks a lot !!..