hotspotfw/hsserver/inc/hssscanlist.h
changeset 0 56b72877c1cb
equal deleted inserted replaced
-1:000000000000 0:56b72877c1cb
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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:   Declaration of the ScanList class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef HSSSCANLIST_H
       
    22 #define HSSSCANLIST_H
       
    23 
       
    24 #include <e32std.h>
       
    25 
       
    26 const TUint32 HSS_SCAN_LIST_DATA_SIZE   =  8000; ///< HssScanList container size (bytes)
       
    27 const TUint32 HSS_APPEND_FAILED_NO_MEMORY = 0;    ///< Return value for Append function.
       
    28 
       
    29 const TUint16 HSS_MANDATORY_IE_LIST_SIZE  = 3;
       
    30 const TUint8  HSS_MANDATORY_IE_LIST[]     = { 0, 1, 3 };
       
    31 
       
    32 typedef TUint8 HssScanFrame;
       
    33 
       
    34 /**
       
    35 *  Container class for delivering scan results.  
       
    36 */
       
    37 class HssScanList
       
    38 {
       
    39 
       
    40 friend class HssScanListIterator;
       
    41 friend class HssCScanTimer;
       
    42 
       
    43 public: // Methods
       
    44 
       
    45     // Constructors and destructor
       
    46 
       
    47     /**
       
    48     * C++ default constructor.
       
    49     */
       
    50     HssScanList();
       
    51 
       
    52     /**
       
    53     * Returns the number of access points the instance contains.
       
    54     * @return the number of access points the instance contains.
       
    55     */
       
    56     inline TUint32 Count() const;
       
    57 
       
    58     /**
       
    59     * Appends one access point to list.
       
    60     * @param size          size of the accces point frame to be appended.
       
    61     * @param data_pointer   pointer to the frame.
       
    62     * @return HSS_APPEND_FAILED_NO_MEMORY if there is not enough space otherwise 
       
    63     *         the new size of the list.
       
    64     */
       
    65     TUint32 Append(TUint32 size, const HssScanFrame* data_pointer);
       
    66 
       
    67     /**
       
    68     * Returns the size of the list.
       
    69     * @return the size of the list.
       
    70     */
       
    71     inline TUint32 Size() const;
       
    72 
       
    73     /**
       
    74     * Returns the size of the container.
       
    75     * @return the size of the container.
       
    76     */
       
    77     inline TUint32 MaxSize() const;
       
    78 
       
    79     /**
       
    80     * Clears the list.
       
    81     */
       
    82     inline void ClearAll(); 
       
    83 
       
    84     /**
       
    85     * The scan result's alignment should be four bytes. This method returns
       
    86     * the size with needed padding.
       
    87     * @param  size Size of added data.
       
    88     * @return Total size with additional padding.
       
    89     */
       
    90     inline static TUint32 AddPadding( TInt size );
       
    91 
       
    92 private: // Methods
       
    93 
       
    94     // Prohibit copy constructor.
       
    95     HssScanList( const HssScanList& );
       
    96 
       
    97     /**
       
    98     * Appends one acces point to list variables, but does not do the actual 
       
    99     * copying.
       
   100     * @param  size     The size of added memory block in bytes.
       
   101     * @return The new size of the list.
       
   102     */
       
   103     TUint32 Append( unsigned long size );
       
   104 
       
   105     /**
       
   106     * Check that the appended data is valid, i.e. it has all mandatory 
       
   107     * fields included. Once more: the data being checked has to be in
       
   108     * the buffer (iData).
       
   109     * @param  data Pointer to the beginning of the data being appended.
       
   110     * @return True if data can be append, False if it should be rejected.
       
   111     */
       
   112     TBool CheckData( HssScanFrame* data ) const;
       
   113 
       
   114 private: // Data
       
   115 
       
   116     TUint8 data_m[HSS_SCAN_LIST_DATA_SIZE];  ///< Data Container (~4kB).
       
   117     TUint32 count_m;                     ///< Number of access points.
       
   118     TUint32 size_m;                      ///< Used bytes.
       
   119 };
       
   120 
       
   121 #include "hssscanlist.inl"
       
   122 
       
   123 #endif // HssSCANLIST_H