Symbian3/PDK/Source/GUID-1D6DD213-1EEC-58D2-8311-7A1AF77960C1.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-1D6DD213-1EEC-58D2-8311-7A1AF77960C1" xml:lang="en"><title>How
       
    13 to issue requests</title><shortdesc>This document describes how an active object issues a request for
       
    14 a service.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    15 <p>Once the active object has been constructed, a request can be issued. In
       
    16 the following code fragment, the active object provides the function <codeph>IssueRequest()</codeph> to
       
    17 invoke the encapsulated service function.</p>
       
    18 <codeblock id="GUID-9C89E661-AD2E-520A-8E8D-F6D4E667706A" xml:space="preserve">void CExampleActiveObject::IssueRequest()
       
    19     {
       
    20         // Request the service
       
    21     iServiceProvider-&gt; RequestTheService(iStatus);
       
    22         // Indicate request has been issued
       
    23     SetActive();
       
    24     }</codeblock>
       
    25 <ul>
       
    26 <li id="GUID-8359DED4-C349-51AF-8771-111716DC49B3"><p>Pass the <codeph>TRequestStatus</codeph> object,
       
    27 provided by the active objects's <codeph>CActive</codeph> base class, to the
       
    28 service function. As part of its processing, the service function sets this
       
    29 to <codeph>KRequestPending</codeph>, indicating that the request has been
       
    30 issued but is not yet complete.</p> </li>
       
    31 <li id="GUID-E3652D72-749D-577D-8ED3-9FCEDCB2CCA9"><p>Set the base class's
       
    32 active request flag, using the function <codeph>SetActive()</codeph>, to indicate
       
    33 that the active object is currently active. The flag is reset by the active
       
    34 scheduler before handling a completed request, or by the active object base
       
    35 class as part of the cancellation protocol.</p> </li>
       
    36 </ul>
       
    37 <section id="GUID-213A1B18-AD81-478A-BC14-F8030F9AF095"><title>Completing a request</title> <p>At some point, the service
       
    38 provider's processing completes and it calls <codeph>RThread::RequestComplete()</codeph> passing
       
    39 the request status object and the service provider's return code, a value
       
    40 other than <codeph>KRequestPending</codeph>. This results in the active object's <codeph>iStatus</codeph> member
       
    41 being set to the return code value and a signal that the request is complete.</p> </section>
       
    42 </conbody></concept>