featuremgmt/featuremgr/src/serverexe/featmgrsession.h
changeset 0 08ec8eefde2f
child 6 5ffdb8f2067f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef FEATMGRSESSION_H
       
    22 #define FEATMGRSESSION_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include "featmgrclientserver.h"
       
    27 #include "featmgrserver.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CFeatMgrFeatureRegistry;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 * Contains pending request if feature info is not ready.
       
    36 */
       
    37 NONSHARABLE_CLASS(CFeatMgrPendingRequest) : public CBase
       
    38     {
       
    39     public:
       
    40         /**
       
    41         * Two-phased constructor.
       
    42         */
       
    43         static CFeatMgrPendingRequest* NewL(const RMessage2& aMessage);
       
    44         
       
    45         /**
       
    46         * Destructor.
       
    47         */
       
    48         virtual ~CFeatMgrPendingRequest();
       
    49 	
       
    50 	private:
       
    51 	    /**
       
    52         * C++ default constructor.
       
    53         */
       
    54         CFeatMgrPendingRequest();
       
    55         
       
    56         /**
       
    57         * ConstructL
       
    58         */
       
    59 	    void ConstructL(const RMessage2& aMessage);
       
    60 	        
       
    61 	public: // data
       
    62 	
       
    63 	    // The offset of a component link object within elements that form the list.
       
    64 	    static const TInt iOffset;
       
    65 	    
       
    66 	    // Message for later completion is stored here.
       
    67         RMessage2 iMessage; 
       
    68 	    
       
    69 	private: // data
       
    70 	
       
    71 	    // A link object encapsulates a pointer to the next link object in the list.
       
    72 	    TSglQueLink iLink;       
       
    73 	
       
    74 	};
       
    75 
       
    76 
       
    77 // CLASS DECLARATION
       
    78 
       
    79 /**
       
    80 *  Represents a session for a client thread on the server-side.
       
    81 *  A session acts as a channel of communication between the client 
       
    82 *  and the server. 
       
    83 *
       
    84 */
       
    85 NONSHARABLE_CLASS(CFeatMgrSession) : public CSession2
       
    86     {
       
    87     public:  // Constructors and destructor
       
    88         
       
    89         /**
       
    90         * Two-phased constructor.
       
    91         */
       
    92         static CFeatMgrSession* NewL(CFeatMgrServer& aServer, CFeatMgrFeatureRegistry& aRegistry);
       
    93         
       
    94         /**
       
    95         * Destructor.
       
    96         */
       
    97         virtual ~CFeatMgrSession();
       
    98         
       
    99 #ifdef EXTENDED_FEATURE_MANAGER_TEST
       
   100         /**
       
   101         * 2nd phase construct for sessions - called by the CServer framework
       
   102         */
       
   103         void CreateL();
       
   104 #endif // EXTENDED_FEATURE_MANAGER_TEST
       
   105         
       
   106         
       
   107     public: // New functions
       
   108         
       
   109         /**
       
   110         * Called by the server when feature info is ready.
       
   111         * Calls request handling functions for pending requests.
       
   112         */
       
   113         void ServicePendingRequestsL();
       
   114         
       
   115         /**
       
   116         * Called by the server when existing feature has changed or new one added.
       
   117         * Completes client notification requests if such exist for feature changed.
       
   118         */
       
   119         void ServiceNotifications( TFeatureServerEntry& aFeature, TFeatureChangeType aType );
       
   120 
       
   121     	/**
       
   122     	* Panics client thread.
       
   123     	*
       
   124     	* @param aMessage Message that is being handled
       
   125     	* @param aPanic Panic type
       
   126     	*/
       
   127     	static void PanicClient( const RMessage2& aMessage, TFeatMgrPanic aPanic );
       
   128         
       
   129     
       
   130     public: // Functions from base classes
       
   131  
       
   132     protected:  // New functions
       
   133         
       
   134     protected:  // Functions from base classes
       
   135         
       
   136         /**
       
   137         * From CSession2
       
   138         *
       
   139         * @param aMessage The message containing the client request
       
   140         */
       
   141         virtual void ServiceL( const RMessage2& aMessage );
       
   142 
       
   143     private:
       
   144 
       
   145         /**
       
   146         * C++ default constructor.
       
   147         */
       
   148         CFeatMgrSession(CFeatMgrServer& aServer, CFeatMgrFeatureRegistry& aRegistry);
       
   149 
       
   150         /**
       
   151         * By default Symbian 2nd phase constructor is private.
       
   152         */
       
   153         void ConstructL();
       
   154 
       
   155         /**
       
   156         * Calls matching function of CFeatMgrServer for handling the request.
       
   157         *
       
   158         * @param aMessage The message containing the client request
       
   159         */
       
   160         void DispatchMessageL( const RMessage2& aMessage );
       
   161         
       
   162     private:    // Data
       
   163         
       
   164         /**
       
   165     	* Feature Manager server reference. 
       
   166     	*/
       
   167     	CFeatMgrServer& iFeatMgrServer; 
       
   168     	
       
   169         /**
       
   170     	* Feature Manager feature handler reference. 
       
   171     	*/
       
   172     	CFeatMgrFeatureRegistry& iRegistry;
       
   173     	
       
   174     	/**
       
   175     	* Linked list of CFeatMgrPendingRequest objects.
       
   176     	*/
       
   177     	TSglQue<CFeatMgrPendingRequest> iList; 
       
   178 
       
   179         /**
       
   180         * Array of IDs of supported features.
       
   181         */
       
   182         RFeatureUidArray iNotifyFeatures;
       
   183         
       
   184         /**
       
   185         * Request-message used for signaling client.
       
   186         */
       
   187         RMessagePtr2 iNotifyMessage;
       
   188 
       
   189     };
       
   190     
       
   191 #endif      // FEATMGRSESSION_H 
       
   192             
       
   193 // End of File