I didn’t know if I should post this here or in the FCM section, so here it goes:
First of all, this is how my application should behave:
- GPRS connection should always be active (I do it using WIP GPRS bearer).
- One socket is connected to UART 1 when it is active.
- GSM data calls should always be accepted. When a data call is active, it has to be connected to UART 1 (automatically answered with ats0>=2).
So far it is easy, but here comes the problem:
- The data coming from the GSM call has to be monitored for certain purposes.
This means that I need to subscribe to GSM flow with adl_fcmSubscribe. Obviously, I can’t subscribe to GSM flow while WIP is using GPRS flow.
How I do it:
- Subscribe to GSM call events with adl_callSubscribe.
- Establish GPRS connection with WIP.
- Open sockets, etc…
When I get ADL_CALL_EVENT_RING_DATA:
- Close sockets.
- Disconnect with wip_bearerStop (I get WIP_BERR_OK_INPROGRESS).
- After 1 second, and without waiting for WIP_BEV_STOPPED event, subscribe to GSM flow with adl_fcmSubscribe (this is why ats0 is set to >=2, so that I can subscribe the flow before the call is answered).
I have been unable to think of a better way to do it. Anyway, this works, but only the first time.
The second (and subsequent) times, adl_fcmSubscribe returns ADL_FCM_RET_ERROR_GSM_GPRS_ALREADY_OPENNED. And in fact, it is correct, as WIP library never gets past WIP_BERR_OK_INPROGRESS, so I guess it gets stuck somewhere in there and doesn’t release GPRS flow.
Anyone has experienced something similar, or is it just me?
By the way, I initialize the WIP library in my adl_main function with wip_netInit and never terminate it. I’ve tried terminating it too with same results.