wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlanscanresultcache.h
changeset 0 c40eb8fe8501
child 14 13838cf40350
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2005-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 the License "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:  Cache for scan results
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef WLANSCANRESULTCACHE_H
       
    20 #define WLANSCANRESULTCACHE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "genscanlist.h"
       
    24 #include "wlmclientserver.h"
       
    25 #include "genscaninfo.h"
       
    26 #include "core_type_list.h"
       
    27 
       
    28 /**
       
    29 * Structure for storing information about an available network.
       
    30 */
       
    31 struct TWlanAvailableNetwork
       
    32     {
       
    33     TBuf8<KMaxSSIDLength> ssid;
       
    34     EConnectionMode networkType;
       
    35     WlanSecurityMode securityMode;
       
    36     };
       
    37 
       
    38 /**
       
    39  * CWlanScanResultCache
       
    40  * The class caches latest scan results for a specific time period.
       
    41  * Also caches the latest list of available IAPs (IAP list has no expiry time)
       
    42  * @lib wlmserversrv.lib
       
    43  * @since Series 60 3.1
       
    44  */
       
    45 NONSHARABLE_CLASS( CWlanScanResultCache ) : public CBase
       
    46     {
       
    47 public:  // Constructors and destructor
       
    48 
       
    49     /**
       
    50      * Two-phased constructor.
       
    51      */
       
    52     static CWlanScanResultCache* NewL();
       
    53     
       
    54     /**
       
    55      * Destructor.
       
    56      */
       
    57     virtual ~CWlanScanResultCache();
       
    58 
       
    59     /**
       
    60      * UpdateScanList updates the cached list of scan results
       
    61      * @param aScanList contains the new scan results
       
    62      * @return errorcode
       
    63      */
       
    64     void UpdateScanList(
       
    65         ScanList* aScanList );
       
    66     
       
    67     /**
       
    68      * Returns the latest scanresults if they are fresh enough
       
    69      * @param aCacheLifetime how old results (in seconds) are considered valid. 
       
    70      * @return pointer to ScanList or NULL if they are not available 
       
    71      * or they are too old
       
    72      */
       
    73     ScanList* GetScanList(
       
    74         TUint aCacheLifetime );
       
    75     
       
    76     /**
       
    77      * Updates the list of available networks (IAPs and SSIDs)
       
    78      * @param aIapIdList List of available IAPs.
       
    79      * @param aNetworkList List of available networks.
       
    80      * @param aNewIapsAvailable is set to ETrue on completion if
       
    81      *        new networks or IAPs were detected since the last update.
       
    82      * @param aOldIapsLost is set to ETrue on completion if
       
    83      *        networks or IAPs have been lost since the last update.
       
    84      */
       
    85     void UpdateAvailableNetworksList(
       
    86         core_type_list_c<u32_t>& aIapIdList,
       
    87         RArray<TWlanAvailableNetwork>& aNetworkList,
       
    88         TBool& aNewIapsAvailable,
       
    89         TBool& aOldIapsLost );
       
    90     
       
    91     /**
       
    92      * Returns the latest list of available IAPs if they are fresh enough.
       
    93      *
       
    94      * @param aIapList Latest list of WLAN IAPs from commsdat.
       
    95      * @param aCacheLifetime how old results (in seconds) are considered valid.
       
    96      * @return Pointer to list of available IAPs or NULL if they are not available
       
    97      * or they are too old.
       
    98      */
       
    99     RArray<TUint>* AvailableIaps(
       
   100         RArray<TWlanLimitedIapData>& aIapList,
       
   101         TUint aCacheLifetime );
       
   102 
       
   103     /**
       
   104      * Returns the latest list of WLAN IAPs from commsdat.
       
   105      *
       
   106      * @param aIapList List of WLAN IAPs.
       
   107      * @return KErrNone if successful, an error code otherwise.
       
   108      */       
       
   109     TInt GetIapDataList(
       
   110         RArray<TWlanLimitedIapData>& aIapList );
       
   111 
       
   112     /**
       
   113      * Return the cached list of WLAN IAPs.
       
   114      * 
       
   115      * @return The cached list of WLAN IAPs.
       
   116      */
       
   117     const RArray<TWlanLimitedIapData>& CachedIapDataList() const;
       
   118 
       
   119     /**
       
   120      * Mark currently cached IAP availability results as invalid.
       
   121      */
       
   122     void InvalidateAvailabilityCache();
       
   123 
       
   124 private: // Functions
       
   125 
       
   126     /**
       
   127      * C++ default constructor.
       
   128      */
       
   129     CWlanScanResultCache();
       
   130 
       
   131     /**
       
   132      * By default Symbian 2nd phase constructor is private.
       
   133      */
       
   134     void ConstructL();
       
   135 
       
   136     /**
       
   137      * Method for determining whether two networks are equal.
       
   138      * @param aFirst First network.
       
   139      * @param aSecond Second network.
       
   140      * @return Result of comparison.
       
   141      */
       
   142     static TBool IsNetworkEqual(
       
   143         const TWlanAvailableNetwork& aFirst,
       
   144         const TWlanAvailableNetwork& aSecond );
       
   145 
       
   146     /**
       
   147      * Check whether the given IAP list is equal with the given IAP data list.
       
   148      *
       
   149      * @param aIapList IAP list to compare.
       
   150      * @param aIapDataList IAP data list to compare against.
       
   151      * @return ETrue is the lists are equal, EFalse otherwise.
       
   152      */
       
   153     TBool IsIapListEqual(
       
   154         const RArray<TWlanLimitedIapData>& aFirst,
       
   155         const RArray<TWlanLimitedIapData>& aSecond );
       
   156 
       
   157     /**
       
   158      * Update the list of IAPs from the given IAP data list.
       
   159      *
       
   160      * @param aIapDataList IAP data list to update from.
       
   161      */
       
   162     void UpdateIapList(
       
   163         const RArray<TWlanLimitedIapData>& aIapDataList );
       
   164 
       
   165 private: // Data
       
   166         
       
   167     /** Latest ScanList */
       
   168     ScanList* iScanList;
       
   169 
       
   170     /** Scanlist timestamp */
       
   171     TTime iScanListTimeStamp;
       
   172 
       
   173     /** IapList timestamp */
       
   174     TTime iIapListTimeStamp;
       
   175 
       
   176     /** Latest list of IAPs. */
       
   177     RArray<TWlanLimitedIapData> iIapList;
       
   178 
       
   179     /** Latest list of available IAPs */
       
   180     RArray<TUint> iAvailableIapList;
       
   181 
       
   182     /** Latest list of available networks */
       
   183     RArray<TWlanAvailableNetwork> iAvailableNetworkList;
       
   184 
       
   185     };
       
   186 
       
   187 #endif // WLANSCANRESULTCACHE_H