epoc32/include/mw/aknserverapp.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
     1.1 --- a/epoc32/include/mw/aknserverapp.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/mw/aknserverapp.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,172 @@
     1.4 -aknserverapp.h
     1.5 +/*
     1.6 +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description:  Server applications framework.
    1.19 + *
    1.20 + *
    1.21 +*/
    1.22 +
    1.23 +
    1.24 +#ifndef AKNSERVERAPP_H
    1.25 +#define AKNSERVERAPP_H
    1.26 +
    1.27 +#include <EikServerApp.h>
    1.28 +
    1.29 +/**
    1.30 + * Allows a server app client to connect to a new server app, which
    1.31 + * will be chained from the client app, giving it the appearance
    1.32 + * of being embedded within the client.
    1.33 + *
    1.34 + * Series 60 client-side service IPC implementations should be
    1.35 + * derived from this class.
    1.36 + */
    1.37 +class RAknAppServiceBase : public REikAppServiceBase
    1.38 +    {
    1.39 +public:
    1.40 +    /**
    1.41 +    * Launch a new server app instance, which will be chained
    1.42 +    * from the current application.
    1.43 +    * Note, this function can only be used from the context of
    1.44 +    * an application thread, as it depends on the existence of
    1.45 +    * a CEikonEnv object.
    1.46 +    * If you want to launch a chained server app in a situation
    1.47 +    * where a CEikonEnv does not exist, use REikAppServiceBase::ConnectNewChildAppL()
    1.48 +    * instead.
    1.49 +    * @param aAppUid The UID of the server app which you wish to
    1.50 +    * launch.
    1.51 +    */
    1.52 +    IMPORT_C void ConnectChainedAppL(TUid aAppUid);
    1.53 +    /**
    1.54 +    * Close the server app session.
    1.55 +    */
    1.56 +    IMPORT_C void Close();
    1.57 +    };
    1.58 +
    1.59 +
    1.60 +/**
    1.61 + * Interface for monitoring the lifetime of a server app.
    1.62 + * This class adds Series 60 common behavior to the handling
    1.63 + * of server app exits.
    1.64 + */
    1.65 +class MAknServerAppExitObserver : public MApaServerAppExitObserver
    1.66 +    {
    1.67 +public: // from MApaServerAppExitObserver
    1.68 +    /**
    1.69 +    * Handle the exit of a connected server app.
    1.70 +    * This implementation provides Series 60 default behavior
    1.71 +    * for handling of the EAknCmdExit exit code. Derived classes
    1.72 +    * should base-call this implementation if they override this
    1.73 +    * function.
    1.74 +    * @param aReason The reason that the server application exited.
    1.75 +    * This will either be an error code, or the command id that caused
    1.76 +    * the server app to exit.
    1.77 +    */
    1.78 +    IMPORT_C virtual void HandleServerAppExit(TInt aReason);
    1.79 +    };
    1.80 +
    1.81 +
    1.82 +/**
    1.83 + * Base class for server app service IPC implementations.
    1.84 + * This class provides notifications of service creation and
    1.85 + * destruction to the server, to give the server the ability
    1.86 + * to handle the case where all clients have closed their
    1.87 + * sessions.
    1.88 + */
    1.89 +class CAknAppServiceBase : public CApaAppServiceBase
    1.90 +    {
    1.91 +public:
    1.92 +    /**
    1.93 +    * Constructor
    1.94 +    */
    1.95 +    IMPORT_C CAknAppServiceBase();
    1.96 +    /**
    1.97 +    * Destructor
    1.98 +    */
    1.99 +    IMPORT_C ~CAknAppServiceBase();
   1.100 +
   1.101 +protected: // from CSession2
   1.102 +    /**
   1.103 +    * Override of CSession2::CreateL().
   1.104 +    * If further overridden, this function must be base-called.
   1.105 +    */
   1.106 +    IMPORT_C void CreateL();
   1.107 +    /**
   1.108 +    * Override of CSession2::ServiceL().
   1.109 +    * If further overridden, this function must be base-called.
   1.110 +    * @param aMessage The client message
   1.111 +    */
   1.112 +    IMPORT_C void ServiceL(const RMessage2& aMessage);
   1.113 +    /**
   1.114 +    * Override of CSession2::ServiceError().
   1.115 +    * If further overridden, this function must be base-called.
   1.116 +    * @param aMessage The client message.
   1.117 +    * @param aError The error code to which occured during message servicing
   1.118 +    */
   1.119 +    IMPORT_C void ServiceError(const RMessage2& aMessage,TInt aError);
   1.120 +    };
   1.121 +
   1.122 +
   1.123 +/**
   1.124 + * Base class for server app's servers.
   1.125 + * Series 60 applications that want to implement services should
   1.126 + * derive their server class from this.
   1.127 + * This class already supports the standard Series 60 services,
   1.128 + * and is instantiated by default if an application is launched
   1.129 + * as a server app, but does not override CAknApp::NewServerAppL().
   1.130 + */
   1.131 +class CAknAppServer : public CEikAppServer
   1.132 +    {
   1.133 +public: // from CAknAppServer
   1.134 +    /**
   1.135 +    * Destructor
   1.136 +    */
   1.137 +	IMPORT_C ~CAknAppServer();
   1.138 +    /**
   1.139 +    * Second stage construction.
   1.140 +    * Derived classes may override this to add extra second
   1.141 +    * stage constuction, but they must base-call.
   1.142 +    * @param aFixedServerName the name that this server will have,
   1.143 +    * must be passed through in the base-call.
   1.144 +    */
   1.145 +    IMPORT_C void ConstructL(const TDesC& aFixedServerName);
   1.146 +    /**
   1.147 +    * Create a new service implementation.
   1.148 +    * This implementation creates common Series 60 services.
   1.149 +    * Derived classes can override this to add support for specific
   1.150 +    * services that they support. They must base-call for any
   1.151 +    * service UIDs that they do not support.
   1.152 +    * @param aServiceType the UID of the service that has been requested
   1.153 +    * @return a new service instance of the type requested
   1.154 +    */
   1.155 +    IMPORT_C CApaAppServiceBase* CreateServiceL(TUid aServiceType) const;
   1.156 +public: // new
   1.157 +    /**
   1.158 +    * Allows the server to handle the case when all client sessions
   1.159 +    * have closed.
   1.160 +    * The default implementation provides the Series 60 policy of
   1.161 +    * closing the server application. If this is not appropriate for
   1.162 +    * a server app, it should override this function to provide its
   1.163 +    * own behavior.
   1.164 +    */
   1.165 +    IMPORT_C virtual void HandleAllClientsClosed();
   1.166 +public: // not exported
   1.167 +    void HandleSessionClose();
   1.168 +    void HandleSessionOpen();
   1.169 +private:
   1.170 +    TInt iSessionCount;
   1.171 +    };
   1.172 +
   1.173 +
   1.174 +#endif
   1.175 +
   1.176 +// End of file.