Symbian3/SDK/Source/GUID-1D6DD213-1EEC-58D2-8311-7A1AF77960C1.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

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