You Are Here:

Community: Developer Discussion Boards

#1 Old OBEX send (series 60 SDK - 7650) - 2002-09-19, 07:38

Join Date: Mar 2003
Posts: 28
betasuppe
Offline
Registered User
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
Reply With Quote

#2 Old RE: OBEX send (series 60 SDK - 7650) - 2002-09-20, 09:09

Join Date: Mar 2003
Posts: 2
dharker
Offline
Registered User
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 With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia