wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarray.h
branchRCL_3
changeset 25 f28ada11abbf
equal deleted inserted replaced
24:63be7eb3fc78 25:f28ada11abbf
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Class header for CWsfWlanInfoArray
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_WSFWLANINFOARRAY_H
       
    20 #define C_WSFWLANINFOARRAY_H
       
    21 
       
    22 
       
    23 //  EXTERNAL INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 //  INTERNAL INCLUDES
       
    27 #include "wsfwlaninfo.h"
       
    28 
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class MWsfWlanInfoArrayFilterVisitor;
       
    32 
       
    33 
       
    34 //  CLASS DEFINITION
       
    35 /**
       
    36  * Pointerarray container for TWsfWlanInfo items.
       
    37  * @lib wsfwlaninfo.lib
       
    38  * @since S60 5.0
       
    39  */
       
    40 NONSHARABLE_CLASS( CWsfWlanInfoArray ): public CBase
       
    41 	{
       
    42     public:     // Constructors and destructor
       
    43 
       
    44         /**
       
    45         * Factory function.
       
    46         * @since S60 5.0
       
    47         * @return Class instance.
       
    48         */
       
    49         IMPORT_C static CWsfWlanInfoArray* NewL();
       
    50 
       
    51         /**
       
    52         * Factory function.
       
    53         * @since S60 5.0
       
    54         * @return Class instance.
       
    55         */
       
    56         IMPORT_C static CWsfWlanInfoArray* NewLC();
       
    57 
       
    58         ~CWsfWlanInfoArray();
       
    59 
       
    60     private:    // Constructors
       
    61         CWsfWlanInfoArray();
       
    62         void ConstructL();
       
    63 
       
    64     public:     // New methods
       
    65 		
       
    66         /**
       
    67         * Returns the index of the given wlaninfo
       
    68         * @since S60 5.0
       
    69         * @param aWlanInfo The element being searched for. Ownership not passed.
       
    70         * @return Index of info in the array, or -1 if not found 
       
    71         */
       
    72         IMPORT_C TInt GetArrayIndex( TWsfWlanInfo* aWlanInfo ) const;
       
    73 
       
    74         /**
       
    75         * Add a wlaninfo to the array
       
    76         * @since S60 5.0
       
    77         * @param aWlanInfo The info element to be added to the array. 
       
    78         *                  Ownership passed.
       
    79         */
       
    80         IMPORT_C void AppendL( TWsfWlanInfo* aWlanInfo );
       
    81     
       
    82         /**
       
    83         * Delete the given element from the array
       
    84         * @since S60 5.0
       
    85         * @param aWlanInfo The wlaninfo to be removed from the array. 
       
    86         *                  Ownership not passed.
       
    87         */
       
    88         IMPORT_C void Delete( TWsfWlanInfo* aWlanInfo );
       
    89 
       
    90         /**
       
    91         * Wipes all the elements from the array
       
    92         * @since S60 5.0
       
    93         */
       
    94         IMPORT_C void Reset();
       
    95 
       
    96         /**
       
    97         * Returns the wlaninfo of the given index value in the array
       
    98         * @since S60 5.0
       
    99         * @param aIndex Index of the element in the array
       
   100         * @return Pointer to the wlan info object. Ownership not passed.
       
   101         */
       
   102         IMPORT_C TWsfWlanInfo* operator[]( TUint aIndex ) const;
       
   103         
       
   104         /**
       
   105         * Returns the wlaninfo of the given index value in the array with
       
   106         * boundary check.
       
   107         * @since S60 5.0
       
   108         * @param aIndex Index of the element in the array
       
   109         * @return Pointer to the wlan info object if the given index is valid
       
   110         *         (ownership not passed), NULL otherwise
       
   111         */
       
   112         IMPORT_C TWsfWlanInfo* At( TInt aIndex ) const;
       
   113         
       
   114         /**
       
   115         * Return the number of info items stored in the array 
       
   116         * @since S60 5.0
       
   117         * @return Number of items in the array.
       
   118         */
       
   119         IMPORT_C TUint Count();
       
   120         
       
   121         /**
       
   122         * Returns the info array element matching the SSID prior the given index
       
   123         * @since S60 5.0
       
   124         * @param aSsid The SSID to match
       
   125         * @param aPriorThis The index after which results are not reported
       
   126       	* @return Pointer to the wlan info object (ownership not passed), or 
       
   127       	*         NULL if ssid is not found
       
   128       	*/
       
   129 		IMPORT_C TWsfWlanInfo* Match( const TDesC8& aSsid, 
       
   130 		                              const TInt aPriorThis ); 
       
   131 		
       
   132 		/**
       
   133         * Returns the info array element matching the IapID prior the given index
       
   134         * @since S60 5.2
       
   135         * @param aIapID The IapID to match
       
   136         * @param aPriorThis The index after which results are not reported
       
   137         * @return Pointer to the wlan info object (ownership not passed), or 
       
   138         *         NULL if IapID is not found
       
   139         */
       
   140         IMPORT_C TWsfWlanInfo* Match( const TUint32 aIapID, 
       
   141                                       const TInt aPriorThis );
       
   142 		
       
   143 		/**
       
   144         * Returns the info array element matching the iap id prior the given index
       
   145         * @since S60 5.0
       
   146         * @param aIapId The Iap Id to match
       
   147         * @param aPriorThis The index after which results are not reported
       
   148         * @return Pointer to the wlan info object (ownership not passed), or 
       
   149         * NULL if ssid is not found
       
   150         */
       
   151         IMPORT_C void MatchWithIapIDL( const TUint aIapID, 
       
   152                                         const TInt aPriorThis, 
       
   153                                         RPointerArray<TWsfWlanInfo>& aMatchArray );
       
   154         
       
   155         
       
   156         /**
       
   157          * Returns the info array element matching the SSID, security mode and net mode
       
   158          * prior the given index
       
   159          * @since S60 5.0
       
   160          * @param aSsid The SSID to match
       
   161          * @param aSecMode The security mode to match
       
   162          * @param aNetMode The network mode to match
       
   163          * @param aUsesPreSharedKey pre shared key usage to match
       
   164          * @param aPriorThis The index after which results are not reported
       
   165          * @return Pointer to the wlan info object (ownership not passed), or 
       
   166          *         NULL if ssid is not found
       
   167          */		 
       
   168         IMPORT_C void MatchL( const TDesC8& aSsid, 
       
   169                               CMManager::TWlanSecMode aSecMode, 
       
   170                               CMManager::TWlanNetMode aNetMode, 
       
   171                               TBool aUsesPreSharedKey,
       
   172                               const TInt aPriorThis, 
       
   173                               RPointerArray<TWsfWlanInfo>& aMatchArray ); 
       
   174         
       
   175         /**
       
   176         * Serialize the array content to a buffer and pushes it on the 
       
   177         * cleanup stack
       
   178         * @since S60 5.0
       
   179         * @return The buffer created
       
   180         */
       
   181         IMPORT_C HBufC8* SerializeContentLC();
       
   182         
       
   183 		/**
       
   184 		* Read wlan info objects from buffer and append them to the array
       
   185         * @since S60 5.0
       
   186         * @param aStreamBuffer The buffer to read from.
       
   187 		* @return The new array size
       
   188 		*/
       
   189 		IMPORT_C TInt AppendFromStreamBufferL( const TDesC8& aStreamBuffer );
       
   190 
       
   191         /**
       
   192         * Returns the hidden info array prior the given index
       
   193         * @since S60 5.0
       
   194         * @param aPriorThis The index after which results are not reported
       
   195       	* @return Pointer to the wlan info object (ownership not passed), 
       
   196       	*         or NULL if not found
       
   197       	*/
       
   198 		IMPORT_C TWsfWlanInfo* FindHiddenEntry( const TInt aPriorThis );
       
   199 		
       
   200 		/**
       
   201 		* Delete a given number of items starting from the last item in array
       
   202         * @since S60 5.0
       
   203 		* @param aCount The number of items to be deleted
       
   204 		* @return The count of remaining items in array 
       
   205 		*/ 
       
   206 		IMPORT_C TInt DeleteFromTail( const TInt aCount );
       
   207 		
       
   208 		/**
       
   209 		* Sort the array contents in order of
       
   210 		* configured access points in alphabetical order ( Ssid )
       
   211 		* unknow networks in aplhabetical order ( Ssid )
       
   212 		* and the hidden network container
       
   213         * @since S60 5.0
       
   214 		*/
       
   215 		IMPORT_C void SortArrayL();
       
   216 		
       
   217 		/**
       
   218         * Set UI priority Sort for array
       
   219         * @since S60 5.1
       
   220         * @param aUIPrioritySort TBool value.
       
   221         */ 
       
   222         IMPORT_C void SetUIPrioritySort( const TBool aUIPrioritySort );
       
   223 		
       
   224         /**
       
   225         * Get UI Priority Sort value
       
   226         * @since S60 5.1
       
   227         * @return TBool value representing iUIPrioritySort
       
   228         */
       
   229         IMPORT_C TBool GetUIPrioritySort();
       
   230 		
       
   231 		/*
       
   232 		* Sort the array using a visitor SortKey
       
   233         * @since S60 5.0
       
   234         * @param aSortKey The sort key to be used.
       
   235 		*/
       
   236 		IMPORT_C void SortArrayL( MWsfWlanInfoArrayFilterVisitor& aSortKey );		
       
   237 		
       
   238  
       
   239     private:    // Data
       
   240  
       
   241         CArrayPtrFlat<TWsfWlanInfo>* iInfoArray;   ///< Owned.
       
   242         
       
   243         /**
       
   244         * If EFalse, UI priority short not in use
       
   245         */
       
   246         TBool iUIPrioritySort;
       
   247 
       
   248 	};
       
   249 
       
   250 #endif // C_WSFWLANINFOARRAY_H
       
   251