bearermanagement/mpm/inc/mpmconnmonreqs.h
changeset 0 5a93021fdf25
child 36 04408506c6e0
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     1 /*
       
     2 * Copyright (c) 2005-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: MPM class used for ConnMon requests
       
    15 *
       
    16 */
       
    17 
       
    18 /**
       
    19 @file mpmconnmonreqs.h
       
    20 MPM class used for ConnMon requests.
       
    21 */
       
    22 
       
    23 #ifndef MPMCONNMONREQS_H
       
    24 #define MPMCONNMONREQS_H
       
    25 
       
    26 //  INCLUDES
       
    27 #include <e32base.h>
       
    28 #include <rconnmon.h>
       
    29 #include "mpmconnmonevents.h"
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33 *  MPM class definition for ConnMon requests.
       
    34 *
       
    35 *  @lib MPMServer.exe
       
    36 *  @since 3.1
       
    37 */
       
    38 class CMPMConnMonReqs : public CActive
       
    39     {
       
    40 
       
    41     public:    // Constructors and destructor
       
    42 
       
    43         /**
       
    44         * Two-phased constructor.
       
    45         */
       
    46         static CMPMConnMonReqs* NewL( CMPMConnMonEvents& aParent,
       
    47                                       RConnectionMonitor& aConnMon,
       
    48                                       TUint aConnId,
       
    49                                       CMPMServerSession& aSession );
       
    50 
       
    51         /**
       
    52         * Destructor.
       
    53         */
       
    54         virtual ~CMPMConnMonReqs();
       
    55 
       
    56     public: // New functions
       
    57         
       
    58         /**
       
    59         * Starts IapAvailability request towards Connection monitor. 
       
    60         * Calls active sceduler wait to wait until the request completes.
       
    61         * This is used when first session is starting and MPMServer registers 
       
    62         * to ConnMonitor services. In this case the information 
       
    63         * will not be accurate, unless the session creation waits for the 
       
    64         * first update from ConnMon. 
       
    65         *
       
    66         * If registering to ConnMon is moved to MPMServer start, 
       
    67         * remove this function.
       
    68         *
       
    69         * @since 3.1
       
    70         */
       
    71         void AvailableIapsSync();
       
    72         
       
    73         /**
       
    74         * Requests available IAPs from Connection monitor.
       
    75         * This also includes scanning available WLAN networks.
       
    76         * @param aCallback Type of callback to use after completing 
       
    77         * @param aForceRefreshIntervalSeconds
       
    78         * @since 3.2
       
    79         */
       
    80         void RefreshAvailableIAPs( TWlanScanCallback aCallback, TInt aForceRefreshIntervalSeconds );
       
    81 
       
    82         /**
       
    83         * Compare request object connection ids
       
    84         * @since 3.1
       
    85         * @param aReq1
       
    86         * @param aReq2
       
    87         * @return ETrue if ids are equal, otherwise EFalse
       
    88         */
       
    89         static TBool CompareConnIds( const CMPMConnMonReqs& aReq1,
       
    90                                      const CMPMConnMonReqs& aReq2 );
       
    91 
       
    92         /**
       
    93         * Marks the request as obsolete but allows it run to its completion
       
    94         * @since 3.2
       
    95         */
       
    96         void MyCancel();
       
    97 
       
    98     private:
       
    99         /**
       
   100         * Completes the error case and handles cancellation.
       
   101         * @since 3.2
       
   102         */
       
   103         void ErrorCallbackL( TInt aStatus );
       
   104             
       
   105     public: // Functions from base classes
       
   106 
       
   107         /**
       
   108         * From CActive. Cancels request.
       
   109         * @since 3.1
       
   110         */
       
   111         void DoCancel();
       
   112 
       
   113         /**
       
   114         * From CActive. Run when request completes.
       
   115         * @since 3.1
       
   116         */
       
   117         void RunL();
       
   118 
       
   119         /**
       
   120         * From CActive. Run if RunL leaves.
       
   121         * @since 3.1
       
   122         * @param aError Error that caused leave.
       
   123         * @return KErrNone
       
   124         */
       
   125         TInt RunError( TInt aError );
       
   126 
       
   127     private: // New methods
       
   128 
       
   129         /**
       
   130         * C++ default constructor.
       
   131         */
       
   132         CMPMConnMonReqs( CMPMConnMonEvents&  aParent,
       
   133                          RConnectionMonitor& aConnMon,
       
   134                          TUint aConnId, 
       
   135                          CMPMServerSession&  aSession );
       
   136 
       
   137         /**
       
   138         * 2nd phase constructor.
       
   139         */
       
   140         void ConstructL();
       
   141 
       
   142     private: // Data
       
   143 
       
   144         // Internal states types for this object
       
   145         enum TRequestState
       
   146             {
       
   147             EGetIapAvailState, 
       
   148             EScanWLANNetworksState,
       
   149             EScanWLANNetworksStateCached,
       
   150             EGetConnectionCountState, 
       
   151             EObsolete
       
   152             };
       
   153 
       
   154         // Internal state
       
   155         TRequestState iNextState;
       
   156 
       
   157         // ConnMon request cancel code
       
   158         TInt iLastCancelCode;
       
   159 
       
   160         // Parent object reference
       
   161         CMPMConnMonEvents& iParent;
       
   162 
       
   163         // Reference to the Connection Monitor If
       
   164         RConnectionMonitor& iConnMon;
       
   165 
       
   166         // Connection identifier
       
   167         TUint iConnId;
       
   168 
       
   169         // Iap availability info buffer
       
   170         TConnMonIapInfoBuf iIapBuf;
       
   171 
       
   172         // MPM server session which requested the service
       
   173         // After service completes callback function is called through 
       
   174         // the reference.
       
   175         CMPMServerSession& iSession;
       
   176 
       
   177         // Used for first session start to wait until necessary data available
       
   178         CActiveSchedulerWait iActiveSchedulerWait;        
       
   179 
       
   180         // Callback type to be used when WLAN scan has been completed
       
   181         TWlanScanCallback iWlanScanCallback;
       
   182 
       
   183         // Keeps track of the number of connections
       
   184         TUint iConnectionCount; 
       
   185     };
       
   186 
       
   187 #endif // MPMCONNMONREQS_H
       
   188 
       
   189 // End of file