bearermanagement/S60MCPR/inc/s60mpmrequests.h
changeset 0 5a93021fdf25
child 11 68f0c7cd80ec
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     1 /*
       
     2 * Copyright (c) 2008-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: Interface to Mobility Policy Manager definitions.
       
    15 *
       
    16 */
       
    17 
       
    18 /**
       
    19 @file s60mpmrequests.h
       
    20 Interface to Mobility Policy Manager definitions.
       
    21 */
       
    22 
       
    23 #ifndef S60MPMREQUESTS_H
       
    24 #define S60MPMREQUESTS_H
       
    25 
       
    26 // System includes
       
    27 #include <e32base.h>
       
    28 //#include <ss_log.h>
       
    29 #include <rmpm.h>
       
    30 
       
    31 // User includes
       
    32 #include "s60mpmpolicyinterfaces.h"
       
    33 #include "s60mcprmpmlog.h"
       
    34 
       
    35 // Namespaces
       
    36 using namespace S60MCPRMPMOperations;
       
    37 
       
    38 // Forward declaration
       
    39 class CMPMPolicyNotifications;
       
    40 
       
    41 /**
       
    42 *  S60 NetMCPR MPM interface management Class inherits from CActive
       
    43 */
       
    44 NONSHARABLE_CLASS( CMPMPolicyRequests ) 
       
    45     :   public CActive, 
       
    46         public MMPMPolicyNotificationUser
       
    47     {
       
    48     public:
       
    49         /**
       
    50          * Two-phased constructor.
       
    51          * @param aUser reference to class implementing MMPMPolicyNotificationsUser interface  
       
    52          */
       
    53         static CMPMPolicyRequests *NewL( MMPMPolicyNotificationUser& aUser );
       
    54 
       
    55         /**
       
    56          * Asynchronous destructor.
       
    57          * At the point of return the object may or may not be deleted
       
    58          * but MUST NOT be used by the owner anymore.
       
    59          */
       
    60         void RequestDelete();
       
    61         
       
    62         /**
       
    63          * Notifies MPM a certain IAP started.
       
    64          * forward the call to MPM
       
    65          *
       
    66          * @param aIapId IAP Id of the connection.
       
    67          */
       
    68         void IAPConnectionStartedL( const TUint32 aIapId );
       
    69 
       
    70         /**
       
    71         * Notifies MPM a certain IAP stopped.
       
    72         * forward the call to MPM
       
    73         * 
       
    74         * @param aIapId IAP Id of the connection.
       
    75         */
       
    76         void IAPConnectionStoppedL( const TUint32 aIapId );
       
    77 
       
    78         /**
       
    79         * Notifies MPM of new RConnection joining to connection
       
    80         * forward the call to MPM
       
    81         * 
       
    82         * @param aIapId IAP Id of the connection.
       
    83         */
       
    84         void ApplicationJoinsConnectionL( const TUint32 aIapId );
       
    85 
       
    86         /**
       
    87         * Notifies MPM that RConnection is leaving the connection provider
       
    88         * forward the call to MPM
       
    89         * 
       
    90         * @param aIapId IAP Id of the connection.
       
    91         */
       
    92         void ApplicationLeavesConnectionL( const TUint32 aIapId );
       
    93         
       
    94         /**
       
    95         * Notifies MPM that RConnection is closing down
       
    96         * forward the call to MPM
       
    97         */
       
    98         void ApplicationConnectionEndsL();
       
    99         
       
   100         /**
       
   101          * Register to Preferred IAP Notifications which are delivered through 
       
   102          * the CMPMPolicyNotification -class's PolicyNotification -call.
       
   103          */
       
   104         void RegisterPreferredIAPNotificationL();
       
   105 
       
   106         /**
       
   107          * Unregister from Preferred IAP Notifications. 
       
   108          */
       
   109         void UnregisterPreferredIAPNotificationL();
       
   110 
       
   111         /**
       
   112          * Informs MPM that application want to ignore the carrier.
       
   113          * @param aIapId Ignored IAP 
       
   114          */
       
   115         void ApplicationIgnoredTheCarrierL( const TUint32 aIapId );
       
   116         
       
   117         /**
       
   118          * Informs MPM that application wants to migrate to carrier. 
       
   119          * @param aIapId IAP to migrate to 
       
   120          */
       
   121         void ApplicationMigratesToCarrierL( const TUint32 aIapId);
       
   122         
       
   123         /**
       
   124          * Informs MPM that application rejected the carrier
       
   125          * @param aIapId Rejected IAP 
       
   126          */
       
   127         void ApplicationRejectedTheCarrierL( const TUint32 aIapId );
       
   128         
       
   129         /**
       
   130          * Informs MPM that application accepted the carrier
       
   131          * @param aIapId Accepted IAP  
       
   132          */
       
   133         void ApplicationAcceptedTheCarrierL( const TUint32 aIapId);
       
   134 
       
   135         /**
       
   136         * Request for best iap from MPM
       
   137         * 
       
   138         * @param aConnPref connection preference chosen by user
       
   139         * @param aConnId ID of a connection
       
   140         * @param aAppUid application uid of the application using the connection
       
   141         * @param aPolicyPref connection preference chosen by MPM
       
   142         * @param aUser object requesting the answer
       
   143         */
       
   144         void ChooseBestIAPL( TConnPref*            aConnPref,
       
   145                             const TUid&           aAppUid,
       
   146                             TConnPref*            aPolicyPref,
       
   147                             MMPMPolicyRequestsUser* aUser );
       
   148 
       
   149         /**
       
   150         * Cancel Request for best iap from MPM
       
   151         */
       
   152         void CancelReselectBestIAP();
       
   153 
       
   154         /**
       
   155         * Cancel Request for best iap from MPM
       
   156         */
       
   157         void CancelChooseBestIAPL();
       
   158 
       
   159         /**
       
   160         * Cancel ProcessError request.
       
   161         */
       
   162         void CancelProcessError();
       
   163         
       
   164         /**
       
   165          * Request MPM to choose another IAP
       
   166          * 
       
   167          * @param aPolicyPref connection preference chosen by MPM
       
   168          * @param aUser object requesting the answer.
       
   169          */
       
   170         void ReselectIAPL( TConnPref*              aPolicyPref,
       
   171                            MMPMPolicyRequestsUser* aUser );
       
   172 
       
   173         /**
       
   174         * Request MPM to process the error
       
   175         *
       
   176         * @param anError error occured at connection
       
   177         * @param aUser object requesting the answer
       
   178         */
       
   179         void ProcessErrorL( TInt&                   anError,
       
   180                             MMPMPolicyRequestsUser* aUser );
       
   181 
       
   182         /**
       
   183         * Destructor.
       
   184         */
       
   185         virtual ~CMPMPolicyRequests();
       
   186         
       
   187     public: // from MMPMPolicyNotificationUser
       
   188         /**
       
   189         * Called by AO listening MPM notifications.
       
   190         * @param aNotification Generic nsotification structure class
       
   191         */
       
   192         virtual void PolicyNotification( TMpmNotification& aNotification );
       
   193 
       
   194     private:
       
   195         /**
       
   196         * C++ default constructor.
       
   197         */
       
   198         CMPMPolicyRequests();
       
   199 
       
   200         /**
       
   201         * 2nd phase constructor.
       
   202         * 
       
   203         * @param aUser reference to class implementing MMPMPolicyNotificationsUser interface  
       
   204         */
       
   205         void ConstructL( MMPMPolicyNotificationUser& aUser );
       
   206 
       
   207     private: // from CActive
       
   208 
       
   209         /**
       
   210         * Active Object RunL.
       
   211         * @since 5.2
       
   212         */
       
   213         void RunL();
       
   214 
       
   215         /**
       
   216         * Active Object DoCancel. 
       
   217         * CActive::Cancel() must not be called.
       
   218         * CMPMPolicyRequests::DoCancel() must not be called.
       
   219         * CMPMPolicyRequests::CancelRequest( TMpmAsynchCodes ) is ok.
       
   220         * @since 5.2
       
   221         */
       
   222         void DoCancel();
       
   223         
       
   224         /**
       
   225         * Active Object RunError
       
   226         * @since 5.2
       
   227         * @param aError Error Leave code from RunL()
       
   228         */
       
   229         TInt RunError( TInt aError );
       
   230 
       
   231     private: // private methods
       
   232         
       
   233         /**
       
   234         * Cancels asynchronous request.
       
   235         * @param aRequestCode asynchronous request to be cancelled.
       
   236         * @since 5.2
       
   237         */
       
   238         void CancelRequest( TMpmAsynchCodes aRequestCode );
       
   239 
       
   240         /**
       
   241          * Creates a request with iapid and connid and takes it forward.
       
   242          * @param TMpmAsynchCodes a request type
       
   243          * @param aIapId IAP
       
   244          * @since 5.2
       
   245          */
       
   246         void CreatePolicyRequestL( TPolicyServerOperations aRequestCode, 
       
   247                                    const TUint32& aIapId );
       
   248 
       
   249         /**
       
   250         * Issue the first request in the policy data list
       
   251         * @since 5.2
       
   252         */
       
   253         
       
   254         void IssueRequest();
       
   255         /**
       
   256         * Delete object asynchronously
       
   257         * @since 5.2
       
   258         */
       
   259         void IssueDeleteRequest();
       
   260 
       
   261     private:
       
   262         // policy request list
       
   263         RArray<PolicyRequest>       iPolicyRequests;
       
   264         // client handle to mpm
       
   265         RMPM                        iMpm;
       
   266         TConnectionId               iConnId;
       
   267         // handle MPM notifications
       
   268         //CBearerManPolicyNotif*      iBearerManPolicyNotif;
       
   269         TBool                       iCommitedToDeleteItself;
       
   270         CMPMPolicyNotifications*    iPolicyNotifications;
       
   271         MMPMPolicyNotificationUser* iPolicyNotificationsUser;
       
   272     };
       
   273 
       
   274 #endif // S60MPMREQUESTS_H
       
   275