Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
<?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 task
PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-DCB8CA27-F64F-4B78-831D-F88B1AD7E38B" xml:lang="en"><title>Create
the client class</title><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context> <p>Create the client-side service support class, derived from <codeph>REikAppServiceBase</codeph>, <codeph>RApaAppServiceBase</codeph>, or a suitable System-GUI specialization of this class. This will have the
following responsibilities:</p> <ul>
<li><p>Implementing the client API </p></li>
<li><p>Organizing calls to and from the server over IPC</p></li>
<li><p>Any necessary security checks on the server. For example, restricting
the data sent to a server having particular capabilities.</p></li>
<li><p>Parameter checking from the server. Parameters returned from the server
application must be checked to ensure that they are valid.</p></li>
<li><p>Time-out support for IPC calls to the server.</p></li>
</ul><p>The reason for these checks is that the client cannot be sure that
the server application is using the appropriate server-side service support
classes and may instead be trying to weaken the system by implementing the
IPC handling itself.</p><p>This example shows the client interface for a chat
service implemented in two parts. The active object class <codeph>CChatter</codeph> is
the main client interface. It uses a class <codeph>RInterAppChat</codeph>,
derived from <codeph>REikAppServiceBase</codeph>, which handles the client-side
IPC for the chat service. </p><codeblock xml:space="preserve">class RInterAppChat : public REikAppServiceBase
{
public:
TInt Send(const TDesC& aMessage);
void Receive(TRequestStatus& aStatus, TDes& aMessage);
void CancelReceive();
private:
TUid ServiceUid() const;
};
class MChatterReceiver
{
public:
virtual void Receive(const TDesC&) = 0;
};
class CChatter : public CActive
{
public:
CChatter(MChatterReceiver& aReceiver);
~CChatter();
void ConstructL(TUid aAppUid);
void SendL(const TDesC& aMsg);
private:
void Queue();
void RunL();
void DoCancel();
public:
RInterAppChat iSub;
TBuf<KMaxMyMessage> iBuf;
MChatterReceiver& iReceiver;
};</codeblock></context>
</taskbody></task>