bearermanagement/S60MCPR/inc/s60mpmpolicyinterfaces.h
changeset 0 5a93021fdf25
child 24 05bc53fe583b
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: This header defines inteface needed by MCPR to use MPM.
       
    15 *
       
    16 */
       
    17 
       
    18 /**
       
    19 @file s60mpmpolicyinterfaces.h
       
    20 This header defines inteface needed by MCPR to use MPM.
       
    21 */
       
    22 #ifndef S60MPMPOLICYINTERFACES_H
       
    23 #define S60MPMPOLICYINTERFACES_H
       
    24 
       
    25 // Reusing MPM function code definitions
       
    26 #include <rmpm.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class PolicyRequest;
       
    30 class CMPMPolicyRequests;
       
    31 
       
    32 /**
       
    33  * Notication interface of S60MCPR
       
    34  */
       
    35 class MMPMPolicyNotificationUser
       
    36     {
       
    37     public:
       
    38         /**
       
    39         * Notification
       
    40         * 
       
    41         * @param aNotification notification buffer from MPM.
       
    42         */
       
    43         virtual void PolicyNotification( TMpmNotification& aNotification ) = 0;
       
    44     };
       
    45 
       
    46 /**
       
    47  *  Callback class.
       
    48  *
       
    49  *  @since xx
       
    50  */
       
    51 class MMPMPolicyRequestsUser
       
    52     {
       
    53     friend class PolicyRequest;
       
    54 public:
       
    55     virtual void PolicyResponse( PolicyRequest& aCompletedRequest ) = 0;
       
    56 protected:
       
    57     virtual void Delete() = 0;
       
    58     };
       
    59 
       
    60 /**
       
    61  * Lists the supported MPM operations of the MPM API wrapper
       
    62  * In order to simplify cancellation, match the cancellable requests to MPM's AsyncRequests. 
       
    63  */
       
    64 namespace S60MCPRMPMOperations
       
    65     {
       
    66     enum TPolicyServerOperations
       
    67         {
       
    68         EPolicyRequestChooseBestIAP = EMPMChooseBestIAP,
       
    69         EPolicyRequestReselectBestIAP = EMPMReselectBestIAP,
       
    70         EPolicyRequestProcessError = EMPMProcessError,
       
    71         EPolicyRequestWaitNotification = EMPMWaitNotification,
       
    72         EPolicyRequestIAPConnectionStarted = 200,
       
    73         EPolicyRequestIAPConnectionStopped,
       
    74         EPolicyRequestApplicationJoinsConnection,
       
    75         EPolicyRequestApplicationLeavesConnection,
       
    76         EPolicyRequestApplicationConnectionEnds,
       
    77         EPolicyRequestConnect,
       
    78         EPolicyRequestRegisterPrefIAPNotif,
       
    79         EPolicyRequestUnregisterPrefIAPNotif,
       
    80         EPolicyRequestApplicationMigratesToCarrier,
       
    81         EPolicyRequestApplicationIgnoredTheCarrier,
       
    82         EPolicyRequestApplicationAcceptedTheCarrier,
       
    83         EPolicyRequestApplicationRejectedTheCarrier,
       
    84         };
       
    85     }
       
    86 
       
    87 /**
       
    88  *  Request container class.
       
    89  */
       
    90 class PolicyRequest
       
    91     {
       
    92     public:
       
    93         /**
       
    94          * c++ constructor 
       
    95          */
       
    96         PolicyRequest()
       
    97             :   iConnPref(NULL),
       
    98                 iIapId(0),
       
    99                 iConnId(0),
       
   100                 iAppUid(KNullUid),
       
   101                 iError(KErrNone),
       
   102                 iPolicyPref(NULL),
       
   103                 iStatus(KErrNone),
       
   104                 iUser(NULL)
       
   105             {}
       
   106 
       
   107         /**
       
   108          * Deletes heap data. 
       
   109          */
       
   110         void Cleanup()
       
   111             {
       
   112             delete iConnPref;
       
   113             delete iPolicyPref;
       
   114             // below is type specific destructor of iUser that handles the cleanup of derived object
       
   115             if( iUser )
       
   116                 iUser->Delete(); 
       
   117             }
       
   118         
       
   119         /**
       
   120          * Does not actually cancel MPM request but prevents
       
   121          * PolicyResponse() -calls to request originator. 
       
   122          */
       
   123         void Cancel()
       
   124             {
       
   125             if( iUser )
       
   126                 iUser->Delete();
       
   127             iUser = NULL;
       
   128             }
       
   129 
       
   130     public:
       
   131         // Information for MPM  
       
   132         S60MCPRMPMOperations::TPolicyServerOperations iRequestType;
       
   133         TConnPref*              iConnPref;
       
   134         TUint                   iIapId;
       
   135         TConnectionId           iConnId;
       
   136         TUid                    iAppUid;
       
   137         TInt                    iError;
       
   138         // Information from MPM
       
   139         TConnPref*              iPolicyPref;
       
   140         TBMNeededAction         iNeededAction;
       
   141         TInt                    iStatus;
       
   142         // Interface back to requestor.
       
   143         MMPMPolicyRequestsUser* iUser;
       
   144     };
       
   145 
       
   146 #endif  // S60MPMPOLICYINTERFACES_H
       
   147 
       
   148 // End of File
       
   149