| Reply | « Previous Thread | Next Thread » |
|
Hi,
I am working with the BTObjectExchange sample, and whish to make it send two messages instead of one, upon user-input "send message". How do I avoid that the second send call interrupts the first? is there some sort of "the-message-is-now-delivered" message to check for, or something similar to windows "PostMessage" that I can use? Or perhaps a seperate thread?! I'm new to epoc programming - any help apprechiated ! Paul |
|
As far as i can tell the sample is using an EPOC "Active Object" to send the message asynchronously. It may be worth looking at the Symbian documentation if you're not familiar with the concept of these active objects.
In essence, the active objects allow calls to run asynchronously (although only one at a time). The active scheduler calls the RunL function on completion of each asynchronous call. So if you want to send two messages, you could add another state into the RunL such that when "Waiting to Send" successfully completes (ie. first object sent), you can then change to your newly added state (e.g. EWaitingToSend2) send another object (by calling SendObjectL, or you're own modified method). Once you become familiar with the concept of active objects, what you want to achieve is not too difficult. An alternative solution (a bit of a quick hack) would be to wait for the asynchronous event to complete immediatley after calling it by using User::WaitForAnyRequest() for example (in the SendObjectL() method): ... iClient->Put(*iCurrObject, iStatus); // send the first object User::WaitForAnyRequest(); // wait for this to complete iClient->Put(*iAdditionalObject, iStatus); // send another object SetActive(); // let the active scheduler handle completion of this request, as in the original example ... This would work, and is quick and easy to implement, but can result in your application becoming unresponsive if the first request takes long to complete. It's much better to go the active object route if you want a responsive application. Hope this helps. |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|