internetradio2.0/irnetworkcontroller/inc/irfilteredapreader.h
changeset 14 896e9dbc5f19
equal deleted inserted replaced
12:608f67c22514 14:896e9dbc5f19
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Used to read in only access points with the desired characteristics. 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_IRFILTEREDAPREADER_H
       
    20 #define C_IRFILTEREDAPREADER_H
       
    21 
       
    22 #include <commsdattypesv1_1.h>
       
    23 
       
    24 using namespace CommsDat;
       
    25 
       
    26 
       
    27 /**
       
    28  *  Reads the access points for Network Controller component.
       
    29  * 
       
    30  *  Returns only those entries from IAP table that are referenced from 
       
    31  *  WAP_ACCESS_POINT table.
       
    32  * 
       
    33  *  In addition to that an instance of class performs filtering based on
       
    34  *  configured criteria.   
       
    35   *
       
    36  */
       
    37 NONSHARABLE_CLASS( CIRFilteredApReader ): public CBase
       
    38     {
       
    39 public:
       
    40     // The filtering flags
       
    41     static const TInt KIRFilterNone         = 0x0;
       
    42     static const TInt KIRFilterWAPOnly      = 0x1;
       
    43     static const TInt KIRFilterWAPMandatory = 0x2;
       
    44     static const TInt KIRFilterEasyWLAN     = 0x4;
       
    45     
       
    46 public:
       
    47     /**
       
    48      * Two-phased constructor.
       
    49      * @param aFilterFlags Defines the filtering criteria applied to entries
       
    50      * @return Instance of CIRFilteredApReader
       
    51      */
       
    52     static CIRFilteredApReader* NewL( TInt aFilterFlags );
       
    53 
       
    54     /**
       
    55      * Two-phased constructor.
       
    56      * @param aFilterFlags Defines the filtering criteria applied to entries
       
    57      * @return Instance of CIRFilteredApReader
       
    58      */
       
    59     static CIRFilteredApReader* NewLC( TInt aFilterFlags );
       
    60 
       
    61     /**
       
    62      * Gets the first appropriate IAP record.
       
    63      * Initialises the required objects for iteration.
       
    64      * 
       
    65      * Only those records that have the desired characteristics are returned.
       
    66      *
       
    67      * @return The suitable record, if found. NULL, if no record was found
       
    68      */
       
    69     CCDIAPRecord* FirstRecordL();    
       
    70 
       
    71     /**
       
    72      * Gets the next appropriate IAP record.
       
    73      * Only those records that have the desired characteristics are returned.
       
    74      *
       
    75      * @return The suitable record, if found. NULL, if no record was found
       
    76      */
       
    77     CCDIAPRecord* NextRecordL();
       
    78 
       
    79 private:
       
    80     /**
       
    81      * C++ Default constructor.
       
    82      * 
       
    83      * @param aFilterFlags Defines the filtering criteria applied to entries 
       
    84      */
       
    85     CIRFilteredApReader( TInt aFilterFlags );
       
    86 
       
    87     /**
       
    88      * Second phase constructor
       
    89      */
       
    90     void ConstructL();
       
    91 
       
    92     /**
       
    93      * Destructor.
       
    94      */
       
    95     ~CIRFilteredApReader();
       
    96     
       
    97     /**
       
    98      * Returns the current record.
       
    99      * 
       
   100      * @return The current record.
       
   101      */
       
   102     CCDWAPAccessPointRecord* CurrentRecordL() const;
       
   103 
       
   104     /**
       
   105      * Moves the iterator to next record in WAPAccessPoint table.
       
   106      * 
       
   107      * @return ETrue if there was more records, EFalse if not.
       
   108      */
       
   109     TBool MoveToNextRecord();
       
   110 
       
   111     /**
       
   112      * Loads items from WAPIPBearer and IAP tables that are
       
   113      * referenced by the current record.
       
   114      */
       
   115     TBool LoadCurrentApDetailsL();
       
   116     
       
   117     /**
       
   118      * Performs the filtering.
       
   119      * 
       
   120      * Applies the different filtering criteria according to configured
       
   121      * policy (flags).
       
   122      *
       
   123      * @return ETrue if the record was let through, EFalse if the record was filtered out.
       
   124      */
       
   125     TBool FilterL() const;
       
   126 
       
   127     /**
       
   128      * Filters the access point entries that have the mandatory WAP parameters.
       
   129      *
       
   130      * Currently only GatewayAddress of WAPIPBearer is checked.
       
   131      * 
       
   132      * Examining the StartPage field of WAPAccessPoint table proved to be 
       
   133      * too strict filter.  
       
   134      * 
       
   135      * @return ETrue if the record was let through, EFalse if the record was filtered out.
       
   136      */
       
   137     TBool FilterWAPMandatoryL() const;
       
   138     
       
   139     /**
       
   140      * Filters the access point entries that use IAPService, whose type is WAPOnly.
       
   141      * 
       
   142      * @return ETrue if the record was let through, EFalse if the record was filtered out.
       
   143      */
       
   144     TBool FilterWAPOnlyL() const;
       
   145 
       
   146     /**
       
   147      * Filters the access point entries whose name is "EasyWlan".
       
   148      * 
       
   149      * This filtering should be done in more clever way.
       
   150      * 
       
   151      * @return ETrue if the record was let through, EFalse if the record was filtered out.
       
   152      */
       
   153     TBool FilterEasyWlanL() const;
       
   154 
       
   155 private: // data
       
   156 
       
   157     /**
       
   158      * The database accessor.
       
   159      * Owned.
       
   160      */
       
   161     CMDBSession* iDbSession;
       
   162     
       
   163     /**
       
   164      * All the records in WAPAccessPoint table. 
       
   165      * Owned.
       
   166      */
       
   167     CMDBRecordSet<CCDWAPAccessPointRecord>* iWapTable;
       
   168     
       
   169     /**
       
   170      * Index of the current record.
       
   171      */
       
   172     TInt iWapTableIndex;
       
   173     
       
   174     /**
       
   175      * WAPIPBearer entry associated with current record.
       
   176      * Owned.
       
   177      */
       
   178     CCDWAPIPBearerRecord* iWapIpBearerRecord;
       
   179 
       
   180     /**
       
   181      * IAP record associated with current record.
       
   182      * Owned.
       
   183      */
       
   184     CCDIAPRecord* iIapRecord;
       
   185     
       
   186     /**
       
   187      * Flags that define the applied filtering criteria.
       
   188      */
       
   189     TInt iFilterFlags;
       
   190     };
       
   191 
       
   192 #endif // C_IRFILTEREDAPREADER_H