connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiAppUi.h
branchRCL_3
changeset 58 83ca720e2b9a
parent 0 5a93021fdf25
equal deleted inserted replaced
57:05bc53fe583b 58:83ca720e2b9a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Application UI class
       
    15 *     
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CONNECTIONMONITORUIAPPUI_H
       
    21 #define CONNECTIONMONITORUIAPPUI_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <aknViewAppUi.h>
       
    25 #include <aknnavide.h>
       
    26 #include <rconnmon.h>
       
    27 
       
    28 #include "ConnectionMonitorUiLogger.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CConnectionMonitorUiContainer;
       
    32 class CConnectionArray;
       
    33 class CConnectionInfoBase;
       
    34 
       
    35 class CFeatureManagerWrapper;
       
    36 class CActiveWrapper;
       
    37 
       
    38 // CONSTANTS
       
    39 
       
    40 /**
       
    41 * For iPeriodic Timer. The interval between events generated
       
    42 * after the initial delay, in microseconds.
       
    43 */
       
    44 LOCAL_D const TInt KTickInterval = 1000000;
       
    45 
       
    46 
       
    47 // CLASS DECLARATION
       
    48 
       
    49 /**
       
    50 *
       
    51 */
       
    52 class MActiveEventObserverInterface
       
    53     {
       
    54     public:
       
    55         /**
       
    56         * Called if MConnectionMonitorObserver is raised EventL event. 
       
    57         * @param aConnMonEvent The event information.
       
    58         * @param aIndex The index of connection in the iConnectionArray. 
       
    59         */
       
    60         virtual void OnEventL( const CConnMonEventBase& aConnMonEvent,
       
    61                                const TInt aIndex ) = 0;
       
    62 
       
    63         /**
       
    64         * Called by iPeriodic. It refreshes details of connections.
       
    65         */
       
    66         virtual void OnTimerEventL() = 0;
       
    67     };
       
    68   
       
    69 /**
       
    70 *
       
    71 */    
       
    72 class MTimerExpiredObserverInterface     
       
    73     {
       
    74     public:
       
    75         /**
       
    76         * Called by iPeriodic.
       
    77         */
       
    78         virtual void OnTimerExpiredL() = 0;   
       
    79         
       
    80         /**
       
    81         * Gives back Timer interval.
       
    82         */
       
    83         virtual TInt GetTickInerval() const = 0; 
       
    84     };
       
    85 
       
    86 /**
       
    87 * Application UI class.
       
    88 * Provides support for the following features:
       
    89 * - EIKON control architecture
       
    90 * - view architecture
       
    91 * - status pane
       
    92 * 
       
    93 */
       
    94 class CConnectionMonitorUiAppUi : public CAknViewAppUi,
       
    95                                   public MConnectionMonitorObserver,
       
    96                                   public MTimerExpiredObserverInterface
       
    97     {
       
    98     public: // Constructors and destructor
       
    99         /**
       
   100         * EPOC default constructor.
       
   101         */      
       
   102         void ConstructL();
       
   103 
       
   104         /**
       
   105         * Destructor.
       
   106         */      
       
   107         ~CConnectionMonitorUiAppUi();
       
   108 
       
   109     public:
       
   110         /**
       
   111         * Returns pointer to AppUi object.
       
   112         */      
       
   113         static CConnectionMonitorUiAppUi* Static();
       
   114 
       
   115         /**
       
   116         * from MConnectionMonitorObserver
       
   117         */
       
   118         void EventL( const CConnMonEventBase &aConnMonEvent );
       
   119 
       
   120     public:
       
   121         /**
       
   122         * Register and start connection monitor engine callback notification,
       
   123         * and starts periodic timer.
       
   124         * @param aObserver Observer object
       
   125         */
       
   126         void StartConnEventNotification( 
       
   127                                     MActiveEventObserverInterface* aObserver );
       
   128 
       
   129         /**
       
   130         * Stops connection monitor notification and periodic timer
       
   131         * @param aObserver Observer object
       
   132         */
       
   133         void StopConnEventNotification( 
       
   134                                     MActiveEventObserverInterface* aObserver );
       
   135 
       
   136         /**
       
   137         * Starts iPeriodic.
       
   138         * @param aInterval Refresh interval
       
   139         */
       
   140         void StartTimerL( const TInt aInterval = KTickInterval );
       
   141 
       
   142         /**
       
   143         * Stops iPeriodic.
       
   144         */
       
   145         void StopTimer();
       
   146 
       
   147         /**
       
   148         * Timer callback of iPeridoc.
       
   149         */
       
   150         static TInt Tick( TAny* aObject );
       
   151         
       
   152         /**
       
   153         * called by Tick( TAny* aObject ).
       
   154         */
       
   155         TInt Tick();        
       
   156 
       
   157         /**
       
   158         * Delete and remove a connection from the View
       
   159         * @param aConnId the id of the currect selected connection
       
   160         * @param aConnInfo pointer to the current selected connection
       
   161         */
       
   162         void DeleteDetailsView( 
       
   163                             TInt aConnId, CConnectionInfoBase* aConnInfo );
       
   164 
       
   165 #ifdef RD_CONTROL_PANEL
       
   166     
       
   167         /**
       
   168         * This function is used for querying whether the application
       
   169         * is launched in embedded mode or not.
       
   170         * @return ETrue:  The application is launched in embedded mode.
       
   171         *         EFalse: The application is launched in standalone mode.
       
   172         */
       
   173         TBool IsEmbedded() const;
       
   174 
       
   175 #endif // RD_CONTROL_PANEL        
       
   176 
       
   177     protected:
       
   178         /**
       
   179         * from CCoeAppUi, for icon skinning
       
   180         */
       
   181         void HandleForegroundEventL( TBool aForeground );
       
   182 
       
   183     private:
       
   184         /**
       
   185         * From MEikMenuObserver
       
   186         */
       
   187         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   188 
       
   189         /**
       
   190         * From CEikAppUi, takes care of command handling.
       
   191         * @param aCommand command to be handled
       
   192         */
       
   193         void HandleCommandL( TInt aCommand );
       
   194 
       
   195         /**
       
   196         * From CEikAppUi, handles key events.
       
   197         * @param aKeyEvent Event to handled.
       
   198         * @param aType Type of the key event. 
       
   199         * @return Response code ( EKeyWasConsumed, EKeyWasNotConsumed ). 
       
   200         */
       
   201         virtual TKeyResponse HandleKeyEventL(
       
   202                                 const TKeyEvent& aKeyEvent, TEventCode aType );
       
   203 
       
   204         /**
       
   205         * Called by Tick.
       
   206         */
       
   207         void OnTimerExpiredL( );
       
   208         
       
   209         /**
       
   210         * Gives back Timer interval.
       
   211         */        
       
   212         TInt GetTickInerval() const;         
       
   213         
       
   214         /**
       
   215         * Call one after the other RefreshDetails() function of connections
       
   216         * which are contained by iConnectionArray.
       
   217         */
       
   218         void RefreshAllConnectionsL();
       
   219 
       
   220         /**
       
   221         * Creates a CConnectionInfBase class, the given connection id. 
       
   222         * The Dynamic type of the returned class depends on the bearer type 
       
   223         * of the connection.
       
   224         * @params aConnectionId the id of the connection
       
   225 		* @params aBearerType the bearer type of the connection
       
   226         * @return CConnectionInfBase instance, The Dynamic type of the returned
       
   227         * class depends on the bearer type of the connection.
       
   228         */
       
   229         CConnectionInfoBase* CreateConnectionInfoL( TUint aConnectionId, TConnMonBearerType aBearerType );
       
   230             
       
   231         /**
       
   232         * Initialize connection array
       
   233         */
       
   234         void InitializeConnectionArrayL();
       
   235         
       
   236         /**
       
   237         * Gets the IAP of Easy Wlan access point
       
   238         */
       
   239         void GetEasyWlanIAPNameL();
       
   240 
       
   241         /**
       
   242         * Shows connection summary note.
       
   243         * @param aConnection
       
   244         */        
       
   245         void ShowConnectionSummaryInformationNoteL( 
       
   246         							const CConnectionInfoBase* aConnection );
       
   247     private: // Data
       
   248 
       
   249         /**
       
   250         * For refresh details of connections.
       
   251         */
       
   252         RConnectionMonitor              iMonitor;       
       
   253        
       
   254         /**
       
   255         * Contains CConnectionInfoBase instances, which are represents 
       
   256         * the connections in the system.
       
   257         */
       
   258         CConnectionArray*               iConnectionArray; // Owned
       
   259         
       
   260         /**
       
   261         * Timer, to refresh details of connections
       
   262         */
       
   263         CPeriodic*                      iPeriodic;  // Owned
       
   264         
       
   265         /**
       
   266         * Actual observer instance. This observer handles refreshing details
       
   267         * of connection on the screen.
       
   268         */
       
   269         MActiveEventObserverInterface*  iObserver;  // Not owned
       
   270                 
       
   271         /**
       
   272         * CFeatureManagerWrapper wraps FeatureManager to eliminate maintenance 
       
   273         * of existance of FeatureManager.
       
   274         * Owned.
       
   275         */
       
   276         CFeatureManagerWrapper*         iFeatureManagerWrapper;
       
   277         
       
   278         /**
       
   279         * The active object for info. refreshing. Owned.
       
   280         */
       
   281         CActiveWrapper*                 iActiveWrapper;
       
   282 
       
   283         /**
       
   284         * the name of Easy Wlan access point it there is, otherwise NULL
       
   285         */
       
   286         HBufC*                          iEasyWlanIAPName;        
       
   287                 
       
   288         /**
       
   289         * A pointer to actual timer observer instance
       
   290         */
       
   291         MTimerExpiredObserverInterface* iTimerObserver;
       
   292 
       
   293         /**
       
   294         * Should the Main View be activeted during HandleForegroundEventL() method
       
   295         */
       
   296         TBool activateMainView;
       
   297         
       
   298         /**
       
   299          * An array to hold the connectionIds in situations when creating
       
   300          * connectionInfo object fails
       
   301          */
       
   302         RArray<TUint> iNewConnectionIdArray;
       
   303         
       
   304         /**
       
   305          * Connections waiting for first event
       
   306          */
       
   307         RArray<TInt> iConnectionsWaitingFirstEvent;
       
   308     };
       
   309 
       
   310 #endif  // CONNECTIONMONITORUIAPPUI_H
       
   311 
       
   312 // End of File