Component A (use B api function)
Component B (exposes api functions)
Component B handle “Data Connection”, it open GPRS context and activate data. I use built in ` le_data_ConnectService() and then le_data_Request() for this. Naturally if connection is down, Component B can take time to ativate.
Componet A, instead, watch for some events (motion) and if needed it call Componet B for connection.
My question is, how to avoid blocking A while calling B apis during works?
Sorry for my questin but i cant find a clear documenation on this. I’ve tried calling B methods from A using thread but got a problem here… cause the le_data_ConnectService(); needs to be called from the main thread. So i Receive an error.
Yes, from component A i can create a Thread to alert Component B that “data connection” is needed, and i can set this to high priority. But anyway … when calling B api… (Connect)… in this function i call le_data_ConnectService(), and it goves me an error: le_data_ConnectService must be called from main thread…
The only way i found is using a Timer in B to check is something changes… and start actions based on some variable changed. I’m using this approach in another component… but this fill the code of timers…
if calling in main thread means calling a direct function from extern, via a method… then this will block until connection established. And I dont want this, cause this will block other part of code that must flow normally without wait…