epoc32/include/mw/aknserverapp.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000 (2010-03-16)
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* 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
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  Server applications framework.
williamr@2
    15
 *
williamr@2
    16
 *
williamr@2
    17
*/
williamr@2
    18
williamr@2
    19
williamr@2
    20
#ifndef AKNSERVERAPP_H
williamr@2
    21
#define AKNSERVERAPP_H
williamr@2
    22
williamr@2
    23
#include <EikServerApp.h>
williamr@2
    24
williamr@2
    25
/**
williamr@2
    26
 * Allows a server app client to connect to a new server app, which
williamr@2
    27
 * will be chained from the client app, giving it the appearance
williamr@2
    28
 * of being embedded within the client.
williamr@2
    29
 *
williamr@2
    30
 * Series 60 client-side service IPC implementations should be
williamr@2
    31
 * derived from this class.
williamr@2
    32
 */
williamr@2
    33
class RAknAppServiceBase : public REikAppServiceBase
williamr@2
    34
    {
williamr@2
    35
public:
williamr@2
    36
    /**
williamr@2
    37
    * Launch a new server app instance, which will be chained
williamr@2
    38
    * from the current application.
williamr@2
    39
    * Note, this function can only be used from the context of
williamr@2
    40
    * an application thread, as it depends on the existence of
williamr@2
    41
    * a CEikonEnv object.
williamr@2
    42
    * If you want to launch a chained server app in a situation
williamr@2
    43
    * where a CEikonEnv does not exist, use REikAppServiceBase::ConnectNewChildAppL()
williamr@2
    44
    * instead.
williamr@2
    45
    * @param aAppUid The UID of the server app which you wish to
williamr@2
    46
    * launch.
williamr@2
    47
    */
williamr@2
    48
    IMPORT_C void ConnectChainedAppL(TUid aAppUid);
williamr@2
    49
    /**
williamr@2
    50
    * Close the server app session.
williamr@2
    51
    */
williamr@2
    52
    IMPORT_C void Close();
williamr@2
    53
    };
williamr@2
    54
williamr@2
    55
williamr@2
    56
/**
williamr@2
    57
 * Interface for monitoring the lifetime of a server app.
williamr@2
    58
 * This class adds Series 60 common behavior to the handling
williamr@2
    59
 * of server app exits.
williamr@2
    60
 */
williamr@2
    61
class MAknServerAppExitObserver : public MApaServerAppExitObserver
williamr@2
    62
    {
williamr@2
    63
public: // from MApaServerAppExitObserver
williamr@2
    64
    /**
williamr@2
    65
    * Handle the exit of a connected server app.
williamr@2
    66
    * This implementation provides Series 60 default behavior
williamr@2
    67
    * for handling of the EAknCmdExit exit code. Derived classes
williamr@2
    68
    * should base-call this implementation if they override this
williamr@2
    69
    * function.
williamr@2
    70
    * @param aReason The reason that the server application exited.
williamr@2
    71
    * This will either be an error code, or the command id that caused
williamr@2
    72
    * the server app to exit.
williamr@2
    73
    */
williamr@2
    74
    IMPORT_C virtual void HandleServerAppExit(TInt aReason);
williamr@2
    75
    };
williamr@2
    76
williamr@2
    77
williamr@2
    78
/**
williamr@2
    79
 * Base class for server app service IPC implementations.
williamr@2
    80
 * This class provides notifications of service creation and
williamr@2
    81
 * destruction to the server, to give the server the ability
williamr@2
    82
 * to handle the case where all clients have closed their
williamr@2
    83
 * sessions.
williamr@2
    84
 */
williamr@2
    85
class CAknAppServiceBase : public CApaAppServiceBase
williamr@2
    86
    {
williamr@2
    87
public:
williamr@2
    88
    /**
williamr@2
    89
    * Constructor
williamr@2
    90
    */
williamr@2
    91
    IMPORT_C CAknAppServiceBase();
williamr@2
    92
    /**
williamr@2
    93
    * Destructor
williamr@2
    94
    */
williamr@2
    95
    IMPORT_C ~CAknAppServiceBase();
williamr@2
    96
williamr@2
    97
protected: // from CSession2
williamr@2
    98
    /**
williamr@2
    99
    * Override of CSession2::CreateL().
williamr@2
   100
    * If further overridden, this function must be base-called.
williamr@2
   101
    */
williamr@2
   102
    IMPORT_C void CreateL();
williamr@2
   103
    /**
williamr@2
   104
    * Override of CSession2::ServiceL().
williamr@2
   105
    * If further overridden, this function must be base-called.
williamr@2
   106
    * @param aMessage The client message
williamr@2
   107
    */
williamr@2
   108
    IMPORT_C void ServiceL(const RMessage2& aMessage);
williamr@2
   109
    /**
williamr@2
   110
    * Override of CSession2::ServiceError().
williamr@2
   111
    * If further overridden, this function must be base-called.
williamr@2
   112
    * @param aMessage The client message.
williamr@2
   113
    * @param aError The error code to which occured during message servicing
williamr@2
   114
    */
williamr@2
   115
    IMPORT_C void ServiceError(const RMessage2& aMessage,TInt aError);
williamr@2
   116
    };
williamr@2
   117
williamr@2
   118
williamr@2
   119
/**
williamr@2
   120
 * Base class for server app's servers.
williamr@2
   121
 * Series 60 applications that want to implement services should
williamr@2
   122
 * derive their server class from this.
williamr@2
   123
 * This class already supports the standard Series 60 services,
williamr@2
   124
 * and is instantiated by default if an application is launched
williamr@2
   125
 * as a server app, but does not override CAknApp::NewServerAppL().
williamr@2
   126
 */
williamr@2
   127
class CAknAppServer : public CEikAppServer
williamr@2
   128
    {
williamr@2
   129
public: // from CAknAppServer
williamr@2
   130
    /**
williamr@2
   131
    * Destructor
williamr@2
   132
    */
williamr@2
   133
	IMPORT_C ~CAknAppServer();
williamr@2
   134
    /**
williamr@2
   135
    * Second stage construction.
williamr@2
   136
    * Derived classes may override this to add extra second
williamr@2
   137
    * stage constuction, but they must base-call.
williamr@2
   138
    * @param aFixedServerName the name that this server will have,
williamr@2
   139
    * must be passed through in the base-call.
williamr@2
   140
    */
williamr@2
   141
    IMPORT_C void ConstructL(const TDesC& aFixedServerName);
williamr@2
   142
    /**
williamr@2
   143
    * Create a new service implementation.
williamr@2
   144
    * This implementation creates common Series 60 services.
williamr@2
   145
    * Derived classes can override this to add support for specific
williamr@2
   146
    * services that they support. They must base-call for any
williamr@2
   147
    * service UIDs that they do not support.
williamr@2
   148
    * @param aServiceType the UID of the service that has been requested
williamr@2
   149
    * @return a new service instance of the type requested
williamr@2
   150
    */
williamr@2
   151
    IMPORT_C CApaAppServiceBase* CreateServiceL(TUid aServiceType) const;
williamr@2
   152
public: // new
williamr@2
   153
    /**
williamr@2
   154
    * Allows the server to handle the case when all client sessions
williamr@2
   155
    * have closed.
williamr@2
   156
    * The default implementation provides the Series 60 policy of
williamr@2
   157
    * closing the server application. If this is not appropriate for
williamr@2
   158
    * a server app, it should override this function to provide its
williamr@2
   159
    * own behavior.
williamr@2
   160
    */
williamr@2
   161
    IMPORT_C virtual void HandleAllClientsClosed();
williamr@2
   162
public: // not exported
williamr@2
   163
    void HandleSessionClose();
williamr@2
   164
    void HandleSessionOpen();
williamr@2
   165
private:
williamr@2
   166
    TInt iSessionCount;
williamr@2
   167
    };
williamr@2
   168
williamr@2
   169
williamr@2
   170
#endif
williamr@2
   171
williamr@2
   172
// End of file.