Create the client-side service support class, derived from REikAppServiceBase, RApaAppServiceBase, or a suitable System-GUI specialization of this class. This will have the following responsibilities:
Implementing the client API
Organizing calls to and from the server over IPC
Any necessary security checks on the server. For example, restricting the data sent to a server having particular capabilities.
Parameter checking from the server. Parameters returned from the server application must be checked to ensure that they are valid.
Time-out support for IPC calls to the server.
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.
This example shows the client interface for a chat service implemented in two parts. The active object class CChatter is the main client interface. It uses a class RInterAppChat, derived from REikAppServiceBase, which handles the client-side IPC for the chat service.
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; };
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.