diff -r 89d6a7a84779 -r 25a17d01db0c Symbian3/PDK/Source/GUID-DCB8CA27-F64F-4B78-831D-F88B1AD7E38B.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/PDK/Source/GUID-DCB8CA27-F64F-4B78-831D-F88B1AD7E38B.dita Fri Jan 22 18:26:19 2010 +0000 @@ -0,0 +1,60 @@ + + + + + +Create +the client class +

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; + };
+
\ No newline at end of file