<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.newlc.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>NewLC - Confussion over Active Object and User::WaitForRequest - Comments</title>
 <link>http://www.newlc.com/topic-4584</link>
 <description>Comments for &quot;Confussion over Active Object and User::WaitForRequest&quot;</description>
 <language>en</language>
<item>
 <title>Re: problem continues...</title>
 <link>http://www.newlc.com/topic-4584#comment-12996</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Hi&lt;br /&gt;&lt;br /&gt;The code snippet as shown looks ok in isolation but when using asynchronous functionality one can&#039;t always be sure if its ok or not without being aware of the bigger design, similarly its difficult to comment on if an active or non active object should be used.&lt;br /&gt;&lt;br /&gt;You could put some debugging statments into your code in an attempt to identify where any problem might be originating from. If you have codewarrior there is also the possiblity to debug it on hardware.&lt;/div&gt;</description>
 <pubDate>Sun, 09 Jan 2005 23:02:29 +0100</pubDate>
 <dc:creator>Mr. Buttington F. Phucque Lewis</dc:creator>
 <guid isPermaLink="false">comment 12996 at http://www.newlc.com</guid>
</item>
<item>
 <title>problem continues...</title>
 <link>http://www.newlc.com/topic-4584#comment-12995</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;hi mungbeans&lt;br /&gt;&lt;br /&gt; As suggest yesterday, I converted the class to a non active class replacing all the SetActive() with something like&lt;br /&gt;&lt;div class=&quot;codeheader&quot;&gt;Code:&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;TRequestStatus temp&amp;#40;KErrNone&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;iClient-&amp;gt;Connect&amp;#40;temp&amp;#41;;//asynchronus calls&lt;br /&gt; &amp;nbsp; &amp;nbsp;User&amp;#58;&amp;#58;WaitForRequest&amp;#40;temp&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;if&amp;#40;temp.Int&amp;#40;&amp;#41; != KErrNone&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; User&amp;#58;&amp;#58;Leave&amp;#40;temp.Int&amp;#40;&amp;#41;&amp;#41;;&lt;/div&gt;&lt;br /&gt;I am not able to understand where the error comes up, as I can&#039;t debug bluetooth application on pc due to lack of hardware, but on phone I get the error &lt;br /&gt;App Closed&lt;br /&gt;CamTimerBT&lt;br /&gt;where CamTimerBT is my application name. I have no idea how to remove this error and where it comes from, can you give some idea as to what might cause such kind of problems.&lt;br /&gt;Here is the main code segment that on invokation causes all the problem&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;codeheader&quot;&gt;Code:&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;void CObjectExchangeClient&amp;#58;&amp;#58;ConnectL&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;if &amp;#40;iState == EWaitingToGetDevice &amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iStatus=TRequestStatus&amp;#40;KErrNone&amp;#41;;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iServiceSearcher-&amp;gt;SelectDeviceByDiscoveryL&amp;#40;iStatus&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iState = EGettingDevice;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;User&amp;#58;&amp;#58;WaitForRequest&amp;#40;iStatus&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iState=EWaitingToSend;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if&amp;#40;iStatus.Int&amp;#40;&amp;#41; != KErrNone&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; User&amp;#58;&amp;#58;Leave&amp;#40;iStatus.Int&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iStatus=TRequestStatus&amp;#40;KErrNone&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iServiceSearcher-&amp;gt;FindServiceL&amp;#40;iStatus&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;User&amp;#58;&amp;#58;WaitForRequest&amp;#40;iStatus&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iState = EGettingConnection;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if&amp;#40;iStatus.Int&amp;#40;&amp;#41; != KErrNone&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; User&amp;#58;&amp;#58;Leave&amp;#40;iStatus.Int&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;// &amp;nbsp; &amp;nbsp; return;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ConnectToServerL&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iState = EWaitingToSend;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if&amp;#40;iStatus.Int&amp;#40;&amp;#41; != KErrNone&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; User&amp;#58;&amp;#58;Leave&amp;#40;iStatus.Int&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;else&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;User&amp;#58;&amp;#58;Leave&amp;#40;KErrInUse&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;void CObjectExchangeClient&amp;#58;&amp;#58;ConnectToServerL&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;TObexBluetoothProtocolInfo protocolInfo;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp;protocolInfo.iTransport.Copy&amp;#40;KServerTransportName&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;protocolInfo.iAddr.SetBTAddr&amp;#40;iServiceSearcher-&amp;gt;BTDevAddr&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;protocolInfo.iAddr.SetPort&amp;#40;iServiceSearcher-&amp;gt;Port&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp;if &amp;#40;iClient&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delete iClient;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iClient = NULL;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;iClient = CObexClient&amp;#58;&amp;#58;NewL&amp;#40;protocolInfo&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;TRequestStatus temp&amp;#40;KErrNone&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;//iStatus=TRequestStatus&amp;#40;KErrNone&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;iClient-&amp;gt;Connect&amp;#40;temp&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;User&amp;#58;&amp;#58;WaitForRequest&amp;#40;temp&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; if&amp;#40;temp.Int&amp;#40;&amp;#41; != KErrNone&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; User&amp;#58;&amp;#58;Leave&amp;#40;temp.Int&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;CAknInformationNote* informationNote = new &amp;#40;ELeave&amp;#41; CAknInformationNote;&lt;br /&gt; &amp;nbsp; &amp;nbsp;informationNote-&amp;gt;ExecuteLD&amp;#40;KTEMP&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;#125;&lt;/div&gt;&lt;br /&gt;problem is in ConnectToServerL() function most probably, the Popupdoesn&#039;t pop if put at current position but pops if put b4 if (iClient).&lt;/div&gt;</description>
 <pubDate>Wed, 05 Jan 2005 07:28:41 +0100</pubDate>
 <dc:creator>vardhman</dc:creator>
 <guid isPermaLink="false">comment 12995 at http://www.newlc.com</guid>
</item>
<item>
 <title>Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584#comment-12994</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;P.S. Guest above==mungbeans&lt;/div&gt;</description>
 <pubDate>Tue, 04 Jan 2005 23:12:29 +0100</pubDate>
 <dc:creator>Mr. Buttington F. Phucque Lewis</dc:creator>
 <guid isPermaLink="false">comment 12994 at http://www.newlc.com</guid>
</item>
<item>
 <title>Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584#comment-12993</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Hi, yes that would work but bear in mind that if WaitForRequest takes a long time to be signalled your code, depending upon how it is architected, could hang i.e. if there&#039;s a UI it could be unresponsive.&lt;br /&gt;&lt;br /&gt;There are ways of making asynchronous calls appear synchronous but more complex than simply using WaitForRequest.&lt;/div&gt;</description>
 <pubDate>Tue, 04 Jan 2005 23:11:13 +0100</pubDate>
 <dc:creator>Anonymous</dc:creator>
 <guid isPermaLink="false">comment 12993 at http://www.newlc.com</guid>
</item>
<item>
 <title>Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584#comment-12992</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;hi mungbeans&lt;br /&gt;&lt;br /&gt;Thanks for the information. What I needed was to implement a function whose call returns only when the sending stuff(Put) which is asynchronus is completed, with Active Objects that is not AFAIK easy to do because all the function returns and then RunL get invoked later etc. So I will make a non Active Object class for my purpose and use WaitForRequest at those places where setActive was being called, will that work?&lt;/div&gt;</description>
 <pubDate>Tue, 04 Jan 2005 20:02:23 +0100</pubDate>
 <dc:creator>vardhman</dc:creator>
 <guid isPermaLink="false">comment 12992 at http://www.newlc.com</guid>
</item>
<item>
 <title>Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584#comment-12991</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Hi mungbeans and Guest,&lt;br /&gt;&lt;br /&gt;I think you are right..... I was slightly messed with the concept..... thanks for clearing the dark area.....&lt;br /&gt;&lt;br /&gt;Dennis&lt;/div&gt;</description>
 <pubDate>Tue, 04 Jan 2005 19:22:42 +0100</pubDate>
 <dc:creator>dennis_george</dc:creator>
 <guid isPermaLink="false">comment 12991 at http://www.newlc.com</guid>
</item>
<item>
 <title>Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584#comment-12990</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Hi Dennis,&lt;br /&gt;&lt;br /&gt;After reading a big pdf from symbian.com regarding Active Objects and Schedulars I came to realize that Guest is saying correct. &lt;br /&gt;What actually happens is that when SetActive is called the IStatus variable that is internal to Active Object is set to KRequestPending and then after doing the processing the iStatus variable is changed accordingly and RunL is invoked and soon..&lt;br /&gt;&lt;br /&gt;Hi Guest, thanks for all that information, kindly give me some advice on whether this is workable, I change the class and not derive it using Active Object and then after issuing a Put i simply call User::WaifForRequest as the question of calling setActive doesn&#039;t arise.&lt;br /&gt;&lt;br /&gt;It would be great if you can see the code once and tell me if that will work.&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;codeheader&quot;&gt;Code:&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;/* Copyright &amp;#40;c&amp;#41; 2002, Nokia Mobile Phones. All rights reserved */&lt;br /&gt;#include&amp;lt;aknnotewrappers.h&amp;gt;&lt;br /&gt;#include &amp;quot;ObjectExchangeClient.h&amp;quot;&lt;br /&gt;#include &amp;quot;ObjectExchangeServiceSearcher.h&amp;quot;&lt;br /&gt;#include &amp;quot;BTObjectExchange.pan&amp;quot;&lt;br /&gt;&lt;br /&gt;CObjectExchangeClient* CObjectExchangeClient&amp;#58;&amp;#58;NewL&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;CObjectExchangeClient* self = NewLC&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;CleanupStack&amp;#58;&amp;#58;Pop&amp;#40;self&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;return self;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;CObjectExchangeClient* CObjectExchangeClient&amp;#58;&amp;#58;NewLC&amp;#40;&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;CObjectExchangeClient* self = new &amp;#40;ELeave&amp;#41; CObjectExchangeClient&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;CleanupStack&amp;#58;&amp;#58;PushL&amp;#40;self&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;self-&amp;gt;ConstructL&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;return self;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;CObjectExchangeClient&amp;#58;&amp;#58;CObjectExchangeClient&amp;#40;&amp;#41;&lt;br /&gt;&amp;#58; CActive&amp;#40;CActive&amp;#58;&amp;#58;EPriorityStandard&amp;#41;,&lt;br /&gt; &amp;nbsp;iState&amp;#40;EWaitingToGetDevice&amp;#41;,&lt;br /&gt; &amp;nbsp;filename&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;CActiveScheduler&amp;#58;&amp;#58;Add&amp;#40;this&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;void CObjectExchangeClient&amp;#58;&amp;#58;ConstructL&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;iServiceSearcher = CObjectExchangeServiceSearcher&amp;#58;&amp;#58;NewL&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;void CObjectExchangeClient&amp;#58;&amp;#58;SetFileName&amp;#40;const TDesC&amp;amp; fullFileName,const TDesC&amp;amp; filename1&amp;#41;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;iCurrObject = &amp;nbsp;CObexFileObject&amp;#58;&amp;#58;NewL&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; iCurrObject-&amp;gt;SetNameL&amp;#40;_L&amp;#40;&amp;quot;HelloWorld.bmp&amp;quot;&amp;#41;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; filename.Set&amp;#40;fullFileName&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;void CObjectExchangeClient&amp;#58;&amp;#58;MakePacket&amp;#40;&amp;#41;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; iCurrObject-&amp;gt;InitFromFileL&amp;#40;filename&amp;#41;;&lt;br /&gt;&amp;#125;&lt;br /&gt;&lt;br /&gt;CObjectExchangeClient&amp;#58;&amp;#58;~CObjectExchangeClient&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;Cancel&amp;#40;&amp;#41;;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp;if &amp;#40;iState != EWaitingToGetDevice &amp;amp;&amp;amp; iClient&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iClient-&amp;gt;Abort&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp;delete iCurrObject;&lt;br /&gt; &amp;nbsp; &amp;nbsp;iCurrObject = NULL;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp;delete iServiceSearcher;&lt;br /&gt; &amp;nbsp; &amp;nbsp;iServiceSearcher = NULL;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp;delete iClient;&lt;br /&gt; &amp;nbsp; &amp;nbsp;iClient = NULL;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;void CObjectExchangeClient&amp;#58;&amp;#58;DoCancel&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void CObjectExchangeClient&amp;#58;&amp;#58;RunL&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;if &amp;#40;iStatus != KErrNone&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;switch &amp;#40;iState&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case EGettingDevice&amp;#58;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if &amp;#40;iStatus = KErrCancel&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case EGettingService&amp;#58;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case EGettingConnection&amp;#58;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case EDisconnecting&amp;#58;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iState = EWaitingToGetDevice;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case EWaitingToSend&amp;#58;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iState = EWaitingToGetDevice;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;default&amp;#58;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Panic&amp;#40;EBTObjectExchangeUnexpectedLogicState&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;else&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;switch &amp;#40;iState&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case EGettingDevice&amp;#58;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// found a device now search for a suitable service&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iState = EGettingService;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iStatus = KRequestPending; &lt;br /&gt;// this means that the RunL can not be called until&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;// this program does something to iStatus&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iServiceSearcher-&amp;gt;FindServiceL&amp;#40;iStatus&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SetActive&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case EGettingService&amp;#58;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iState = EGettingConnection;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ConnectToServerL&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case EGettingConnection&amp;#58;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iState = EWaitingToSend;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case EWaitingToSend&amp;#58;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case EDisconnecting&amp;#58;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iState = EWaitingToGetDevice;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;default&amp;#58;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Panic&amp;#40;EBTObjectExchangeSdpRecordDelete&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void CObjectExchangeClient&amp;#58;&amp;#58;ConnectL&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;if &amp;#40;iState == EWaitingToGetDevice &amp;amp;&amp;amp; !IsActive&amp;#40;&amp;#41;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iServiceSearcher-&amp;gt;SelectDeviceByDiscoveryL&amp;#40;iStatus&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iState = EGettingDevice;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SetActive&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;else&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;User&amp;#58;&amp;#58;Leave&amp;#40;KErrInUse&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;void CObjectExchangeClient&amp;#58;&amp;#58;ConnectToServerL&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;TObexBluetoothProtocolInfo protocolInfo;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp;protocolInfo.iTransport.Copy&amp;#40;KServerTransportName&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;protocolInfo.iAddr.SetBTAddr&amp;#40;iServiceSearcher-&amp;gt;BTDevAddr&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;protocolInfo.iAddr.SetPort&amp;#40;iServiceSearcher-&amp;gt;Port&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp;if &amp;#40;iClient&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delete iClient;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iClient = NULL;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;iClient = CObexClient&amp;#58;&amp;#58;NewL&amp;#40;protocolInfo&amp;#41;;&lt;br /&gt;&lt;br /&gt; &amp;nbsp; &amp;nbsp;iClient-&amp;gt;Connect&amp;#40;iStatus&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;SetActive&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;void CObjectExchangeClient&amp;#58;&amp;#58;SendMessageL&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;if &amp;#40;iState != EWaitingToSend&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;User&amp;#58;&amp;#58;Leave&amp;#40;KErrDisconnected&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;/*&lt;br /&gt; &amp;nbsp; &amp;nbsp;else if &amp;#40;IsActive&amp;#40;&amp;#41;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;User&amp;#58;&amp;#58;Leave&amp;#40;KErrInUse&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;br /&gt; &amp;nbsp; &amp;nbsp;iClient-&amp;gt;Put&amp;#40;*iCurrObject, status&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;SetActive&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;iCurrObject=NULL;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;void CObjectExchangeClient&amp;#58;&amp;#58;StopL&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;if &amp;#40;iClient &amp;amp;&amp;amp; iClient-&amp;gt;IsConnected&amp;#40;&amp;#41;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iClient-&amp;gt;Abort&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iState = EWaitingToGetDevice;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;void CObjectExchangeClient&amp;#58;&amp;#58;DisconnectL&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;if &amp;#40;iState == EWaitingToGetDevice&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;if &amp;#40;iState == EWaitingToSend&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//iLog.LogL&amp;#40;_L&amp;#40;&amp;quot;Disconnecting&amp;quot;&amp;#41;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iState = EDisconnecting;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iClient-&amp;gt;Disconnect&amp;#40;iStatus&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SetActive&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;else&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;User&amp;#58;&amp;#58;Leave&amp;#40;KErrInUse&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;TBool CObjectExchangeClient&amp;#58;&amp;#58;IsBusy&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;return IsActive&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;br /&gt;TBool CObjectExchangeClient&amp;#58;&amp;#58;IsConnected&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;return iState == EWaitingToSend;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Tue, 04 Jan 2005 19:15:51 +0100</pubDate>
 <dc:creator>vardhman</dc:creator>
 <guid isPermaLink="false">comment 12990 at http://www.newlc.com</guid>
</item>
<item>
 <title>Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584#comment-12989</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Yes the active scheduler uses WaitForAnyRequest but if you are using an active object you should not put any calls in to this nor to WaitForRequest in your active object code. Nor should you be declaring any additional TRequestStatus.&lt;br /&gt;&lt;br /&gt;Varhdman, I presume CObjectExchangeClient must be an active object as you have a SetActive() call in there. &lt;br /&gt;You should not be declaring that TRequestStatus and you should not be calling User::WaitForRequest.&lt;br /&gt;&lt;br /&gt;You should pass the active object&#039;s iStatus to iClient-&amp;gt;Put() and call SetActive() and your active object&#039;s RunL() should then get called. &lt;br /&gt;If you don&#039;t want RunL to get called there&#039;s no point in CobjectExchangeClient being an active object.&lt;br /&gt;&lt;br /&gt;Declaring your own TRequestStatus and calling WaitForRequest() would be ok if CObjectExchangeClient wasn&#039;t an active object but then your code could lock up, hence that&#039;s the advantage of using active objects.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;User::WaitForRequest() and User::WaitForAnyRequest() are used when you are not using active objects.&lt;/div&gt;</description>
 <pubDate>Tue, 04 Jan 2005 19:09:44 +0100</pubDate>
 <dc:creator>Mr. Buttington F. Phucque Lewis</dc:creator>
 <guid isPermaLink="false">comment 12989 at http://www.newlc.com</guid>
</item>
<item>
 <title>Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584#comment-12988</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;As I already said... I am not quite sure but the document says.....&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;quoteheader&quot;&gt;Quote&lt;/div&gt;&lt;div class=&quot;quote&quot;&gt;static void WaitForRequest(TRequestStatus&amp;amp; aStatus);&lt;br /&gt;Description&lt;br /&gt;Waits for a specific asynchronous request to complete. The current thread waits on its request semaphore.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;So it says the &lt;b&gt;current thread waits &lt;/b&gt;..... Moreover Active Scheduler uses WaitForAnyRequest not WaitForRequest....&lt;br /&gt;&lt;br /&gt;Please correct me if I am wrong&lt;br /&gt;&lt;br /&gt;Dennis&lt;/div&gt;</description>
 <pubDate>Tue, 04 Jan 2005 18:59:38 +0100</pubDate>
 <dc:creator>dennis_george</dc:creator>
 <guid isPermaLink="false">comment 12988 at http://www.newlc.com</guid>
</item>
<item>
 <title>Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584#comment-12987</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;&lt;div class=&quot;quoteheader&quot;&gt;Quote from: Anonymous&lt;/div&gt;&lt;div class=&quot;quote&quot;&gt;&amp;gt;&amp;gt; * You can wait till the request is finished..... using User::WaitForRequest() &lt;br /&gt;&lt;br /&gt;No that is totally wrong. You do not call User::WaitForRequest in an active object. That is done for you by the active scheduler.&lt;br /&gt;&lt;br /&gt;If you do this there&#039;s absolutley no point in using an active object.&lt;/div&gt;</description>
 <pubDate>Tue, 04 Jan 2005 18:53:24 +0100</pubDate>
 <dc:creator>Anonymous</dc:creator>
 <guid isPermaLink="false">comment 12987 at http://www.newlc.com</guid>
</item>
<item>
 <title>Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584#comment-12986</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;&amp;gt;&amp;gt; * You can wait till the request is finished..... using User::WaitForRequest() &lt;br /&gt;&lt;br /&gt;No that is totally wrong. You do not call User::WaitForRequest in an active object. That is done for you by the active scheduler.&lt;br /&gt;&lt;br /&gt;If CObjectExchangeClient is an active object you must get rid of the TRequestStatus status( KErrNone ) as it already has one defined and you must get rid of the User::WaitForRequest.&lt;/div&gt;</description>
 <pubDate>Tue, 04 Jan 2005 18:51:14 +0100</pubDate>
 <dc:creator>Anonymous</dc:creator>
 <guid isPermaLink="false">comment 12986 at http://www.newlc.com</guid>
</item>
<item>
 <title>Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584#comment-12985</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Thanks for the quick replies. I have much clear idea of things now. I think what I need to do is to change the code to remove this active schedular thing and make everything use User::WaitForRequest&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;quoteheader&quot;&gt;Quote&lt;/div&gt;&lt;div class=&quot;quote&quot;&gt;After this you can do two things&lt;br /&gt;* Do your usual stuff (Normal Scenario).... whenever your request is fulfilled you will be notified (RunL)&lt;br /&gt;&lt;br /&gt;* You can wait till the request is finished..... using User::WaitForRequest()&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;As you mention here denis, when I try the second approach i.e calling the following code.&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;codeheader&quot;&gt;Code:&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;void CObjectExchangeClient&amp;#58;&amp;#58;SendMessageL&amp;#40;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp;if &amp;#40;iState != EWaitingToSend&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;User&amp;#58;&amp;#58;Leave&amp;#40;KErrDisconnected&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;/*&lt;br /&gt; &amp;nbsp; &amp;nbsp;else if &amp;#40;IsActive&amp;#40;&amp;#41;&amp;#41;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;User&amp;#58;&amp;#58;Leave&amp;#40;KErrInUse&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt; &amp;nbsp; &amp;nbsp;TRequestStatus status&amp;#40; KErrNone &amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;iClient-&amp;gt;Put&amp;#40;*iCurrObject, status&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;SetActive&amp;#40;&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;User&amp;#58;&amp;#58;WaitForRequest&amp;#40;status&amp;#41;;&lt;br /&gt; &amp;nbsp; &amp;nbsp;iCurrObject=NULL;&lt;br /&gt; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;/div&gt;&lt;br /&gt;The code program hangs. Otherwise when I comment the SetActive(), then also the program hangs. Correct me if I am wrong but from all the discussion here and the codes performance I can only understand that if I extend CActive then I cannot use WaitForRequest.&lt;/div&gt;</description>
 <pubDate>Tue, 04 Jan 2005 18:06:35 +0100</pubDate>
 <dc:creator>vardhman</dc:creator>
 <guid isPermaLink="false">comment 12985 at http://www.newlc.com</guid>
</item>
<item>
 <title>Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584#comment-12984</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Active objects are managed and controled by an &lt;b&gt;Active Scheduler&lt;/b&gt;... So first thing you do in your code is to register your active objects with the Active Scheduler using the function &lt;b&gt;CActiveScheduler::Add()&lt;/b&gt;.... &lt;br /&gt;&lt;br /&gt;Next thing you want to avail a functionality of a service provider, in your case the iClient [iClient-&amp;gt;Put(*iCurrObject, status); ]. After requesting you have to tell the Active Scheduler that you are listening for some event.... you do this by changing your state to active by &lt;b&gt;SetActive()&lt;/b&gt; function.....&lt;br /&gt;&lt;br /&gt;After this you can do two things&lt;br /&gt;* Do your usual stuff (Normal Scenario).... whenever your request is fulfilled you will be notified (RunL)&lt;br /&gt;&lt;br /&gt;* You can wait till the request is finished..... using User::WaitForRequest()&lt;br /&gt;&lt;br /&gt;Dennis&lt;/div&gt;</description>
 <pubDate>Tue, 04 Jan 2005 17:50:51 +0100</pubDate>
 <dc:creator>dennis_george</dc:creator>
 <guid isPermaLink="false">comment 12984 at http://www.newlc.com</guid>
</item>
<item>
 <title>Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584#comment-12983</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;As far as I know whenever you are using active objects and you are requesting for any service from a service provider you have to set the state of the Active Object as Active which is done by &lt;b&gt;SetActive()&lt;/b&gt;... &lt;br /&gt;&lt;br /&gt;So if you want to wait till the request is finished then you use the function &lt;b&gt;WaitForRequest()&lt;/b&gt;.....&lt;br /&gt;&lt;br /&gt;Dennis&lt;/div&gt;</description>
 <pubDate>Tue, 04 Jan 2005 17:41:21 +0100</pubDate>
 <dc:creator>dennis_george</dc:creator>
 <guid isPermaLink="false">comment 12983 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584#comment-12982</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;If you are using an active object you MUST NOT call User::WaitForRequest() and MUST call SetActive().&lt;br /&gt;&lt;br /&gt;If the code you have shown below is a function inside an active object then it is very wrong as you are also declaring a TRequestStatus.&lt;/div&gt;</description>
 <pubDate>Tue, 04 Jan 2005 17:20:46 +0100</pubDate>
 <dc:creator>Guest</dc:creator>
 <guid isPermaLink="false">comment 12982 at http://www.newlc.com</guid>
</item>
<item>
 <title>Confussion over Active Object and User::WaitForRequest</title>
 <link>http://www.newlc.com/topic-4584</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;&lt;/div&gt;&lt;p&gt;&lt;a href=&quot;http://www.newlc.com/topic-4584&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.newlc.com/topic-4584#comments</comments>
 <category domain="http://www.newlc.com/forums/nokia-series-60">Nokia S60</category>
 <pubDate>Tue, 04 Jan 2005 15:46:58 +0100</pubDate>
 <dc:creator>vardhman</dc:creator>
 <guid isPermaLink="false">5398 at http://www.newlc.com</guid>
</item>
</channel>
</rss>
