nettools/conntest/inc/ConnTestView.h
changeset 0 857a3e953887
equal deleted inserted replaced
-1:000000000000 0:857a3e953887
       
     1 /*
       
     2 * Copyright (c) 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: The view class for ConnTest
       
    15 * Implements command handling, menu initializing and view activation
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef CONNTESTVIEW_H
       
    20 #define CONNTESTVIEW_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <aknview.h>
       
    24 #include "conntest.hrh"
       
    25 #include <wlanmgmtclient.h>
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CSocketsEngine;
       
    31 class CConnTestContainer;
       
    32 class CSettingItemList;
       
    33 class CSettingData;
       
    34 class CCustomPrefsItemList;
       
    35 class CCustomPrefsData;
       
    36 class CWlanScanInfo;
       
    37 class CConnTestView;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 enum TConnTestWaitType
       
    42     {
       
    43     EConnTestWaitTypeAvailableIaps,
       
    44     EConnTestWaitTypeScan
       
    45     };
       
    46 
       
    47 class CWlanMgmtClient;
       
    48 
       
    49 class CConnTestViewWaiter : public CActive
       
    50     {
       
    51     public:
       
    52         CConnTestViewWaiter( CWlanMgmtClient* aWlanMgmtClient, CConnTestView& aCallback, TConnTestWaitType aType );
       
    53         void ConstructL();
       
    54         virtual ~CConnTestViewWaiter();
       
    55         
       
    56         void IssueRequest();
       
    57         void RunL();
       
    58         TInt RunError( TInt aError );
       
    59         void DoCancel();
       
    60 
       
    61     private:
       
    62         TConnTestWaitType iType;
       
    63         CConnTestView& iCallback;
       
    64         CWlanMgmtClient* iMgmtClient;
       
    65         RArray<TUint> iAvailableIaps;
       
    66         CWlanScanInfo* iScanInfo;
       
    67     };
       
    68 
       
    69 /**
       
    70 *  CConnTestView view class.
       
    71 * 
       
    72 */
       
    73 class CConnTestView : public CAknView, public MWlanMgmtNotifications
       
    74 {
       
    75 public: // Constructors and destructor
       
    76     
       
    77     /**
       
    78     * Symbian default constructor.
       
    79     */
       
    80     void ConstructL();
       
    81     
       
    82     /**
       
    83     * Constructor
       
    84     * @aViewId Id for this view
       
    85     */
       
    86     CConnTestView(const TUid aViewId);
       
    87 
       
    88     /**
       
    89     * Constructor
       
    90     * @aViewId Id for this view
       
    91     * @aSettings Connection settings for the socket engine of this view
       
    92     */
       
    93     CConnTestView(const TUid aViewId, CSettingData* aSettings, CCustomPrefsData* aCustomPrefs);
       
    94 
       
    95     /**
       
    96     * Destructor.
       
    97     */
       
    98     ~CConnTestView();
       
    99     
       
   100 public: // New functions
       
   101     
       
   102      /**
       
   103     * Returns if the iSocketsEngine has an open connection
       
   104     * to be used in HTTP GET
       
   105     */
       
   106     TBool IsReadyForHTTPGet();
       
   107     
       
   108     /**
       
   109     * Handles the view size changes
       
   110     */
       
   111     void SizeChanged();
       
   112        
       
   113     void RequestCompleted( TInt aStatus, RArray<TUint>& aAvailableIaps );
       
   114     
       
   115     void RequestCompleted( TInt aStatus, CWlanScanInfo& aScanInfo );
       
   116 
       
   117 public: // Functions from base classes
       
   118     
       
   119     /**
       
   120     * From CAknView
       
   121     */
       
   122     TUid Id() const;
       
   123     
       
   124     /**
       
   125     * From CAknView
       
   126     */
       
   127     void HandleCommandL(TInt aCommand);
       
   128     
       
   129     /**
       
   130     * From ?base_class ?member_description
       
   131     */
       
   132     void HandleClientRectChange();
       
   133 
       
   134 private: // new
       
   135 
       
   136     //
       
   137     // WlanMgmtClient notifications
       
   138     //
       
   139     //
       
   140     void ConnectionStateChanged( TWlanConnectionMode /* aNewState */ );
       
   141     void BssidChanged( TWlanBssid& /* aNewBSSID */ );
       
   142     void BssLost();
       
   143     void BssRegained();
       
   144     void NewNetworksDetected();
       
   145     void OldNetworksLost();
       
   146     void TransmitPowerChanged( TUint /* aPower */ );
       
   147     void RssChanged(
       
   148         TWlanRssClass aRssClass,
       
   149         TUint aRss );
       
   150 
       
   151     /**
       
   152     * Method for sending data over connected socket. 
       
   153     */
       
   154     void SendDataL();
       
   155 
       
   156 private:
       
   157     
       
   158     /**
       
   159     * From CAknView
       
   160     */
       
   161     void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
       
   162         const TDesC8& aCustomMessage);
       
   163     
       
   164     /**
       
   165     * From CAknView
       
   166     */
       
   167     void DoDeactivate();
       
   168    
       
   169     /**
       
   170     * Adjusts the visible items in menu pane accordding to
       
   171     * socket engine state.
       
   172     * @aResourceId Resource ID identifying the menu pane to initialise
       
   173     * @aMenuPane The in-memory representation of the menu pane
       
   174     */
       
   175     void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
       
   176     
       
   177     /**
       
   178     * Swaps container window between the main window and settings list.
       
   179     * @param aActiveContainer Becomes container
       
   180     */
       
   181     void SwapContainerL(TConnTestContainer aActiveContainer);
       
   182     
       
   183     /**
       
   184     * Creates settings item list
       
   185     * @param aResourceId for ListBox initialization
       
   186     */
       
   187     void CreateSettingsListBoxL(TInt aResourceId);
       
   188     
       
   189     /**
       
   190     * Creates Custom Preferences item list
       
   191     * @param aResourceId for ListBox initialization
       
   192     */
       
   193     void CreateCustomPrefsListBoxL(TInt aResourceId);
       
   194     
       
   195     /**
       
   196     * Create the data packet that is sent over connected socket.
       
   197     * Packet size can be set in settings page.
       
   198     */
       
   199     void CreateDataPacket();    
       
   200 
       
   201 private: // Data
       
   202     TUid                    iViewId;
       
   203     CConnTestContainer*     iContainer;   
       
   204     CSocketsEngine*         iSocketsEngine;    
       
   205     CSettingItemList*       iSettingsListBox;
       
   206     CSettingData*           iSettingData;
       
   207     CCustomPrefsItemList*   iCustomPrefsListBox;
       
   208     CCustomPrefsData*       iCustomPrefsData;
       
   209     TConnTestContainer      iActiveContainer;
       
   210     HBufC8*                 iSendData;
       
   211     TBool                   iSupportsWlan;
       
   212     CConnTestViewWaiter*    iWaiter;
       
   213     CWlanMgmtClient*        iWlanMgmtClient;
       
   214 };
       
   215 
       
   216 #endif
       
   217 
       
   218 // End of File