sysstatemgmt/systemstatemgr/sus/inc/sussimadaptation.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 #include <e32base.h>
       
    18 #include "ssmadaptation.h"
       
    19 #include "ssmdebug.h"
       
    20 #include "ssmadaptationcmn.h"
       
    21 
       
    22 
       
    23 #ifndef __SUSSIMADAPTATION_H__
       
    24 #define __SUSSIMADAPTATION_H__
       
    25 
       
    26 
       
    27 /**
       
    28 CSimAdaptationRequests
       
    29 CSimAdaptationObservers
       
    30 
       
    31 These classes implement the Sim Adaptation related functionality as part of 
       
    32 Adaptation server.These classes implement an active object to route the requests
       
    33 and notifications to Adaptation plugins loaded by CSsmAdaptationServer.
       
    34 These classes are also responsible for queueing the requests and pooling
       
    35 the notification requests  when requests are received from multiple clients
       
    36 Adaptation server handles only one request from each session and uses 
       
    37 Cancel() methods to cancel any of the session's requests made before.
       
    38 The queueing mechanism is to handle multiple clients at a time not to handle
       
    39 multiple requests from one particular clients session.
       
    40 
       
    41 @internalComponent
       
    42 */
       
    43 
       
    44 
       
    45 class CSimAdaptationRequests : public CActive
       
    46 {
       
    47 public:
       
    48     static CSimAdaptationRequests* NewL(MSimAdaptation& aAdaptation);
       
    49 	~CSimAdaptationRequests();
       
    50 
       
    51 
       
    52 	void Release();
       
    53 	void DoGetSimOwnedL(const RMessage2& aMessage);
       
    54 	void DoGetSimCancel(const RMessage2& aMessage);
       
    55 
       
    56 	MSimAdaptation& Adaptation();
       
    57 	
       
    58 protected:
       
    59 	void RunL();
       
    60 	TInt RunError( TInt aError );
       
    61 	void DoCancel();
       
    62 
       
    63 private:
       
    64 	CSimAdaptationRequests(MSimAdaptation& aAdaptation);
       
    65 	void SubmitOrQueueL(const RMessage2 &aMessage);	 		
       
    66 	void WriteResponseDataToClientMessageL();
       
    67 	void Submit(CAdaptationMessage*& aMessage);
       
    68 
       
    69 private:
       
    70 	CAdaptationMessage *iCurrentMessage;
       
    71 	RSsmAdaptationRequestQueue iPendingRequestsQueue;	
       
    72 
       
    73 	MSimAdaptation& iSimAdaptation;
       
    74 
       
    75 	TBool iSimOwnershipStatus;
       
    76 	TBool iSimChangedStatus;
       
    77 	
       
    78 	TPckgBuf<TBool> iSimOwnedPckg;
       
    79 };
       
    80 
       
    81 /**
       
    82 Internal class for maintaining observers for notifications.Whenever a client 
       
    83 registers for  SimAdaptation notifications it will be added to the observers
       
    84 list and it will be notified when CSimAdaptationObservers receives notification
       
    85 from the Sim Adaptation plugin loaded by CSsmAdaptationServer.Once client receives 
       
    86 the notification it has to register again for getting further notification.  
       
    87 
       
    88 @internalComponent
       
    89 */
       
    90 
       
    91 class RSimAdaptationObserversList
       
    92 	{
       
    93 public:
       
    94 	void AddObserverL(CAdaptationMessage *aNotificationMessage);
       
    95 	void Close();
       
    96 	TInt Count();
       
    97 	void NotifyAndRemoveAll(TSsmSimEventType aEventType,TInt aCompleteCode);
       
    98 	void RemoveObserver(CAdaptationMessage *);
       
    99 private:
       
   100 	RPointerArray<CAdaptationMessage > iObservers;
       
   101 	};
       
   102 
       
   103 
       
   104 /**
       
   105 CSimAdaptationRequests
       
   106 CSimAdaptationObservers
       
   107 
       
   108 These classes implement the Sim Adaptation related functionality as part of 
       
   109 Adaptation server.These classes implement an active object to route the requests
       
   110 and notifications to Adaptation plugins loaded by CSsmAdaptationServer.
       
   111 These classes are also responsible for queueing the requests and pooling
       
   112 the notification requests  when requests are received from multiple clients
       
   113 Adaptation server handles only one request from each session and uses 
       
   114 Cancel() methods to cancel any of the session's requests made before.
       
   115 The queueing mechanism is to handle multiple clients at a time not to handle
       
   116 multiple requests from one particular clients session.
       
   117 
       
   118 @internalComponent
       
   119 */
       
   120 
       
   121 
       
   122 class CSimAdaptationObservers : public CActive
       
   123 {
       
   124 public:
       
   125     static CSimAdaptationObservers* NewL(MSimAdaptation& aAdaptation);
       
   126 	~CSimAdaptationObservers();
       
   127 
       
   128 	void DoGetLastSimEvent(const RMessage2& aMessage);	
       
   129 	void DoNotifySimEventL(const RMessage2& aMessage);
       
   130 	void DoNotifySimEventCancelL(const RMessage2& aMessage);
       
   131 
       
   132 protected:
       
   133 	void RunL();
       
   134 	TInt RunError( TInt aError );
       
   135 	void DoCancel();
       
   136 
       
   137 	
       
   138 private:
       
   139 	CSimAdaptationObservers(MSimAdaptation& aAdaptation);
       
   140 	void WriteResponseDataToClientMessage();
       
   141 	
       
   142 	void StartNotification();
       
   143 		
       
   144 private:
       
   145 	MSimAdaptation& iSimAdaptation;
       
   146 
       
   147 	RSimAdaptationObserversList iObserversList;
       
   148 	
       
   149 	//Added for temp purposes
       
   150 	TPckgBuf<TSsmSimEventType> iEventPckg;	
       
   151 };
       
   152 
       
   153 
       
   154 
       
   155 
       
   156 #endif // __SUSSIMADAPTATION_H__