wlanutilities/wlansniffer/wlaninfo/inc/wsfwlaninfoarray.h
changeset 19 10810c91db26
parent 3 ff3b37722600
child 22 498f36116140
equal deleted inserted replaced
3:ff3b37722600 19:10810c91db26
     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 aPriorThis The index after which results are not reported
       
   164 		 * @return Pointer to the wlan info object (ownership not passed), or 
       
   165 		 *         NULL if ssid is not found
       
   166 		 */		 
       
   167 		IMPORT_C void MatchL( const TDesC8& aSsid, 
       
   168 		                      CMManager::TWlanSecMode aSecMode, 
       
   169 		                      CMManager::TWlanNetMode aNetMode, 
       
   170 		                      const TInt aPriorThis, 
       
   171 		                      RPointerArray<TWsfWlanInfo>& aMatchArray ); 
       
   172 		
       
   173 		/**
       
   174 		* Serialize the array content to a buffer and pushes it on the 
       
   175 		* cleanup stack
       
   176         * @since S60 5.0
       
   177 		* @return The buffer created
       
   178 		*/
       
   179 		IMPORT_C HBufC8* SerializeContentLC();
       
   180 
       
   181 		/**
       
   182 		* Read wlan info objects from buffer and append them to the array
       
   183         * @since S60 5.0
       
   184         * @param aStreamBuffer The buffer to read from.
       
   185 		* @return The new array size
       
   186 		*/
       
   187 		IMPORT_C TInt AppendFromStreamBufferL( const TDesC8& aStreamBuffer );
       
   188 
       
   189         /**
       
   190         * Returns the hidden info array prior the given index
       
   191         * @since S60 5.0
       
   192         * @param aPriorThis The index after which results are not reported
       
   193       	* @return Pointer to the wlan info object (ownership not passed), 
       
   194       	*         or NULL if not found
       
   195       	*/
       
   196 		IMPORT_C TWsfWlanInfo* FindHiddenEntry( const TInt aPriorThis );
       
   197 		
       
   198 		/**
       
   199 		* Delete a given number of items starting from the last item in array
       
   200         * @since S60 5.0
       
   201 		* @param aCount The number of items to be deleted
       
   202 		* @return The count of remaining items in array 
       
   203 		*/ 
       
   204 		IMPORT_C TInt DeleteFromTail( const TInt aCount );
       
   205 		
       
   206 		/**
       
   207 		* Sort the array contents in order of
       
   208 		* configured access points in alphabetical order ( Ssid )
       
   209 		* unknow networks in aplhabetical order ( Ssid )
       
   210 		* and the hidden network container
       
   211         * @since S60 5.0
       
   212 		*/
       
   213 		IMPORT_C void SortArrayL();
       
   214 		
       
   215 		/**
       
   216         * Set UI priority Sort for array
       
   217         * @since S60 5.1
       
   218         * @param aUIPrioritySort TBool value.
       
   219         */ 
       
   220         IMPORT_C void SetUIPrioritySort( const TBool aUIPrioritySort );
       
   221 		
       
   222         /**
       
   223         * Get UI Priority Sort value
       
   224         * @since S60 5.1
       
   225         * @return TBool value representing iUIPrioritySort
       
   226         */
       
   227         IMPORT_C TBool GetUIPrioritySort();
       
   228 		
       
   229 		/*
       
   230 		* Sort the array using a visitor SortKey
       
   231         * @since S60 5.0
       
   232         * @param aSortKey The sort key to be used.
       
   233 		*/
       
   234 		IMPORT_C void SortArrayL( MWsfWlanInfoArrayFilterVisitor& aSortKey );		
       
   235 		
       
   236  
       
   237     private:    // Data
       
   238  
       
   239         CArrayPtrFlat<TWsfWlanInfo>* iInfoArray;   ///< Owned.
       
   240         
       
   241         /**
       
   242         * If EFalse, UI priority short not in use
       
   243         */
       
   244         TBool iUIPrioritySort;
       
   245 
       
   246 	};
       
   247 
       
   248 #endif // C_WSFWLANINFOARRAY_H
       
   249