Symbian3/PDK/Source/GUID-D5AB2689-44B7-5E81-888A-48C622AAE21B.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Tue, 30 Mar 2010 16:16:55 +0100
changeset 6 43e37759235e
parent 5 f345bda72bc4
child 9 59758314f811
permissions -rw-r--r--
Week 12 contribution of example code"

<?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-D5AB2689-44B7-5E81-888A-48C622AAE21B" xml:lang="en"><title>Server_App_Minimal:
A Minimal Server Application Example</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<section><title>Download</title> <p>Click on the following link to download
the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-4dedeed8-6e3c-4526-b563-d392c1a304b1.zip" scope="external"> ServerApp.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-4dedeed8-6e3c-4526-b563-d392c1a304b1.html" scope="peer">browse</xref> to view the example code. </p> </section>
<section><title>Description</title> <p>This example demonstrates a minimal <xref href="GUID-F395C299-6C79-5A0E-8FCF-7931D8405E8A.dita">server application</xref> making
use of a minimal UI application. </p> <p>The example application consists
of three sub-projects: </p> <ol id="GUID-CF779D0D-BC35-5FDF-BCC3-58679A2BD3DF">
<li id="GUID-27ABE9A8-A246-5126-BF41-ADEFB26E21F8"><p>A <b>harness</b> project
which uses the Client API to generate a client request and trigger the server
application </p> </li>
<li id="GUID-4E5B08FF-D3C9-5C67-A407-CD7CAAD3F72F"><p>A <b>service_support</b> project
consisting of Service Client Support and Service Implementation Support. Both
client-side and server application-side support are built into a single DLL
which encapsulates the IPC protocol between client and server. </p> </li>
<li id="GUID-F34A779B-2FD0-546E-AE26-97B82762AD2C"><p>A <b>server_application</b> project
that provides the entry point into the server application. This sub-project
consists of the Server class and of the actual Application. </p> </li>
</ol> </section>
<section><title>Service support classes</title> <p> <b> Service Client Support
class (Client API)</b>  </p> <p>Client side service support is provided through
an <xref href="GUID-92F2DA99-0954-3399-9005-F3E817CB7E72.dita"><apiname>REikAppServiceBase</apiname></xref> derived class, <codeph>RServAppService</codeph>.
This class implements the following required functions: </p> <ul>
<li id="GUID-4918FF70-90AF-5241-9822-89B5BB7A9461"><p> <codeph>RApaAppServiceBase::ServiceUid()</codeph>,
a pure virtual function </p> </li>
<li id="GUID-EFC0DB79-934C-59C6-8077-8C4A16D4C749"><p> <codeph>RServAppService::Send()</codeph> which
sends a request to the server </p> </li>
</ul> <p> <b>Service Implementation Support class (Server Implementation API)</b>  </p> <p>A <xref href="GUID-90450078-D05F-3EEB-8A5E-B7110943DD33.dita"><apiname>CApaAppServiceBase</apiname></xref> derived
class, <codeph>CServAppSession</codeph>, provides Service Implementation Support
(support for the sessions connected to the server). The main purpose of this
class is to override the pure virtual function <codeph>CSession2::ServiceL()</codeph>,
such that a call to the appropriate service support code is made. </p> <p>In
this example, <codeph>CServAppSession</codeph> defines a pure virtual function, <codeph>Display()</codeph>,
the functionality of which is implemented in the server application. </p> </section>
<section><title> Server application classes </title> <p> <b>Server class</b>  </p> <p>The
server class <codeph>CServAppServer</codeph> is derived from <xref href="GUID-F51AEC8F-2D7B-34AB-B2DE-E151D10263D1.dita"><apiname>CEikAppServer</apiname></xref> and
implements the function <codeph>CApaAppServer::CreateServiceL()</codeph>.
This function instantiates a session to handle the client request (by implementing
an appropriate service). </p> <p> <b>Session class</b>  </p> <p> <codeph>CMinimalSession</codeph> is
a <xref href="GUID-90450078-D05F-3EEB-8A5E-B7110943DD33.dita"><apiname>CApaAppServiceBase</apiname></xref> derived class that represents the
session connected to the server. In order to handle the client request, this
session class overrides the pure virtual function <codeph>CServAppSession::Display()</codeph>.
Thus, the client request is implemented. </p> <p> <b>UI classes</b>  </p> <p>Application
class </p> <p>Document class </p> <p>Application UI class </p> <p>View class </p> <p>These
four classes are almost the same as those in the minimal UI application example.
A couple of slight modifications have been made: </p> <ul>
<li id="GUID-C1B60851-0901-5DF1-9C56-8A03E37C14FF"><p> <codeph>CEikApplication::NewAppServerL()</codeph> has
been overridden in the Application class <codeph>CExampleApplication</codeph> to
launch a new server application instance. </p> </li>
<li id="GUID-6146169E-6C6D-513A-9ED6-AC33538ABAFD"><p> <codeph>CExampleAppView::Draw()</codeph> has
been altered so that it produces an empty view. </p> </li>
</ul> </section>
<section><title> Summary of class hierarchy of the classes used </title> <fig id="GUID-AE7AA305-82B4-5BD3-87BF-A3E3D61F2DD1">
<title>              Key Classes            </title>
<image href="GUID-6C2A9928-5E5D-5F41-89C1-49C0EF14F900_d0e175704_href.png" placement="inline"/>
</fig> <p> <b>Service Support</b>  </p> <p> <xref href="GUID-2E824A1A-078A-3D43-8B49-DF6328330B51.dita"><apiname>RApaAppServiceBase</apiname></xref> -&gt; <xref href="GUID-92F2DA99-0954-3399-9005-F3E817CB7E72.dita"><apiname>REikAppServiceBase</apiname></xref> -&gt; <codeph>RServAppService</codeph>  </p> <p> <xref href="GUID-90450078-D05F-3EEB-8A5E-B7110943DD33.dita"><apiname>CApaAppServiceBase</apiname></xref> -&gt; <codeph>CServAppSession</codeph>  </p> <p> </p> <p> <b>Server
Application</b>  </p> <p> <xref href="GUID-A056179D-64B3-3674-92F5-DE9B7749D450.dita"><apiname>CApaAppServer</apiname></xref> -&gt; <xref href="GUID-F51AEC8F-2D7B-34AB-B2DE-E151D10263D1.dita"><apiname>CEikAppServer</apiname></xref> -&gt; <codeph>CServAppServer</codeph>  </p> <p> <codeph>CServAppSession</codeph> -&gt; <codeph>CMinimalSession</codeph>  </p> <p> <xref href="GUID-C0297A58-2E39-3211-A2B4-C334192CE2A7.dita"><apiname>CApaApplication</apiname></xref> -&gt; <xref href="GUID-E36E2F07-09E7-32BC-BB83-14DF9232E7D9.dita"><apiname>CEikApplication</apiname></xref> -&gt; <codeph>CExampleApplication</codeph>  </p> <p> <xref href="GUID-B33A8A56-D1BE-3E3D-B5AC-F644A5C764DB.dita"><apiname>CEikDocument</apiname></xref> -&gt; <codeph>CExampleDocument</codeph>  </p> <p> <xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita"><apiname>CEikAppUi</apiname></xref> -&gt; <codeph>CExampleAppUi</codeph>  </p> <p> <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita"><apiname>CCoeControl</apiname></xref> -&gt; <codeph>CExampleAppView</codeph>  </p> </section>
</conbody></concept>