wlanutilities/wlansniffer/wlaninfosorting/inc/wsfwlaninfosortingbrand.h
branchRCL_3
changeset 25 f28ada11abbf
parent 0 56b72877c1cb
equal deleted inserted replaced
24:63be7eb3fc78 25:f28ada11abbf
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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 CWsfWlanInfoSortingBrand
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_WSFWLANINFOSORTINGBRAND_H
       
    21 #define C_WSFWLANINFOSORTINGBRAND_H
       
    22 
       
    23 
       
    24 //  EXTERNAL INCLUDES
       
    25 #include <e32base.h>
       
    26 
       
    27 //  INTERNAL INCLUDES
       
    28 #include "wsfwlaninfosortingfiltervisitor.h"
       
    29 #include "wsfwlaninfo.h"
       
    30 
       
    31 
       
    32 //  FORWARD DECLARATIONS
       
    33 class CAknIconArray;
       
    34 class CGulIcon;
       
    35 
       
    36 
       
    37 /**
       
    38 * Branded item sorting filter
       
    39 *
       
    40 * @lib wsfwlaninfosorting.lib
       
    41 * @since S60 5.0
       
    42 */
       
    43 NONSHARABLE_CLASS( CWsfWlanInfoSortingBrand ): public CBase, 
       
    44                                         public MWsfWlanInfoSortingFilterVisitor
       
    45     {
       
    46     protected:  // Type definitions
       
    47 
       
    48         /**
       
    49         * Structure to store and compare branded items
       
    50         *
       
    51         * @lib wsfwlaninfosorting.lib
       
    52         * @since S60 5.0
       
    53         */
       
    54         class TBrandableItem
       
    55             {
       
    56             public:     // constructors
       
    57                 TBrandableItem();
       
    58                 
       
    59                 /**
       
    60                 * Constructor.
       
    61                 * @since S60 5.0
       
    62                 * @param aSsid SSID of the branded network
       
    63                 * @param aBrandId ID of the branded network
       
    64                 */
       
    65                 TBrandableItem( const TDesC8& aSsid, const TInt8 aBrandId );
       
    66                 
       
    67             public:     // new methods
       
    68                 /**
       
    69                 * Compares two branded items.
       
    70                 * @since S60 5.0
       
    71                 * @param aItemLeft First item
       
    72                 * @param aItemRight Second item
       
    73                 * @return ETrue if the two items are equal
       
    74                 */
       
    75                 static TBool Match( const TBrandableItem& aItemLeft, 
       
    76                                     const TBrandableItem& aItemRight );
       
    77 
       
    78                 /**
       
    79                 * Defines a sorting relation between two branded items based on
       
    80                 * their brand id.
       
    81                 * @since S60 5.0
       
    82                 * @param aItemLeft Left item
       
    83                 * @param aItemRight Right item
       
    84                 * @return Negative if left < right, zero if left == right, 
       
    85                 *         positive if left > right.
       
    86                 */
       
    87                 static TInt SortByBrandId( const TBrandableItem& aItemLeft, 
       
    88                                            const TBrandableItem& aItemRight );
       
    89 
       
    90                 /**
       
    91                 * Defines a sorting relation between two branded items based on
       
    92                 * their SSID.
       
    93                 * @since S60 5.0
       
    94                 * @param aItemLeft Left item
       
    95                 * @param aItemRight Right item
       
    96                 * @return Negative if left < right, zero if left == right, 
       
    97                 *         positive if left > right.
       
    98                 */
       
    99                 static TInt SortBySsid( const TBrandableItem& aItemLeft, 
       
   100                                         const TBrandableItem& aItemRight );
       
   101                                         
       
   102             public:     // data
       
   103                 /**
       
   104                 * SSID of the branded item
       
   105                 */
       
   106                 TBuf8<KWlanMaxAccessPointNameLength> iSsid;
       
   107                 
       
   108                 /**
       
   109                 * Brand identifier number
       
   110                 */
       
   111                 TInt8 iBrandId;
       
   112                 
       
   113                 /**
       
   114                 * Icon id for this branded item
       
   115                 */
       
   116                 TInt iIconId;
       
   117 
       
   118                 /**
       
   119                 * Icon mask id for this branded item
       
   120                 */
       
   121                 TInt iMaskId;
       
   122             };
       
   123 
       
   124     public:     // construction
       
   125         static CWsfWlanInfoSortingBrand* NewLC();
       
   126         static CWsfWlanInfoSortingBrand* NewL();
       
   127         
       
   128         ~CWsfWlanInfoSortingBrand();
       
   129         
       
   130         
       
   131     private:    // constructors
       
   132         CWsfWlanInfoSortingBrand();
       
   133         void ConstructL();    
       
   134 
       
   135         
       
   136       public:     // new methods
       
   137 
       
   138         /**
       
   139         * Append the icons from the given array to the available icons list
       
   140         * @since S60 5.0
       
   141         * @param aIconArray The array to take the icons from
       
   142         */
       
   143         void AppendBrandIconsL( CAknIconArray& aIconArray );
       
   144         
       
   145         
       
   146     public:     // from MWsfWlanInfoSortingFilterVisitor
       
   147         
       
   148         /**
       
   149         * Do comparing between these two entries
       
   150         * @since S60 5.0
       
   151         * @param aInfoLeft Left element
       
   152         * @param aInfoRight Right element
       
   153         * @return Negative if aInfoLeft is smaller tha aInfoRight,
       
   154         *         zero if the entries are equal,
       
   155         *         positive if the aInfoLeft is greater than aInfoRight
       
   156         */
       
   157         virtual TInt Compare( const TWsfWlanInfo& aInfoLeft, 
       
   158                               const TWsfWlanInfo& aInfoRight );
       
   159 
       
   160         /**
       
   161         * Check if the entry matches to filter rules and carry out additional
       
   162         * operations if needed.
       
   163         * @since S60 5.0
       
   164         * @param aInfoLeft The element to be checked
       
   165         * @return ETrue if the item matches the rule
       
   166         */
       
   167         virtual TBool SetupOnRuleMatch( TWsfWlanInfo& aInfoLeft );
       
   168 
       
   169         /**
       
   170         * Handle filter match 
       
   171         * @since S60 5.0
       
   172         * @param aFilterEntry The element in question
       
   173         */ 
       
   174         virtual void MarkMatchedFilterL( TWsfWlanInfo& aFilterEntry );
       
   175 
       
   176         /**
       
   177         * Edit filter definitions
       
   178         * @since S60 5.0
       
   179         * @param aInfoArray The element in question
       
   180         */
       
   181         virtual void EditFilterDefsL( CWsfWlanInfoArray& aInfoArray );
       
   182         
       
   183         /**
       
   184         * Read the filter defintions to filter
       
   185         * @since S60 5.0
       
   186         */
       
   187         virtual void ReadFilterDefsL();
       
   188 
       
   189     
       
   190     private:    // new methods
       
   191     
       
   192         /**
       
   193         * Creates an icon of the given icon and mask id
       
   194         * @since S60 5.0
       
   195         * @param aIconId Icon ID
       
   196         * @param aMaskId        
       
   197         * @return The created icon. Ownership passed.
       
   198         */
       
   199         CGulIcon* MakeIconLC( const TInt aIconId, const TInt aMaskId );
       
   200                 
       
   201         /**
       
   202         * Read the branded networks' data from file/resource
       
   203         * @since S60 5.0
       
   204         */
       
   205         void ReadBrandedSsidsL();
       
   206 
       
   207         
       
   208     private: //data    
       
   209 
       
   210         /**
       
   211         * Array of branded items
       
   212         */        
       
   213         RPointerArray<TBrandableItem> iBrandItemArray;     
       
   214 
       
   215         /**
       
   216         * Name of the bitmap file for the brand icons. Owned.
       
   217         */
       
   218         HBufC* iBitmapFileName;
       
   219         
       
   220         /**
       
   221         * Indicates whether the read data is ok
       
   222         */
       
   223         TBool iBrandingDataOk;
       
   224     };
       
   225     
       
   226 
       
   227 
       
   228 #endif // C_WSFWLANINFOSORTINGBRAND_H
       
   229