memana/analyzetoolclient/consoleui/inc/atconsoleui.h
changeset 0 f0f2b8682603
equal deleted inserted replaced
-1:000000000000 0:f0f2b8682603
       
     1 /*
       
     2 * Copyright (c) 2009 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef ATCONSOLE_UI_H
       
    19 #define ATCONSOLE_UI_H
       
    20 
       
    21 //  INCLUDE
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 
       
    25 #include <analyzetool/atstorageserverclnt.h>
       
    26 #include <analyzetool/analyzetool.h>
       
    27 
       
    28 // CONSTANTS
       
    29 const TInt KMaxLineLength = 80;            // Max. line length
       
    30 const TInt KScrollPeriod = 300000;		   // scrolling period
       
    31 const TUint32 KATHundred = 100;
       
    32 const TUint32 KATThousand = 1000;
       
    33 const TUint32 KATMillion = 1000000;
       
    34 _LIT( KATB, "B" );
       
    35 _LIT( KATKB, "KB" );
       
    36 _LIT( KATMB, "MB" );
       
    37 
       
    38 // MACROS
       
    39 
       
    40 // FORWARD DECLARATIONS
       
    41 class CView;
       
    42 class CConsoleMain;
       
    43 class CConsoleReader;
       
    44 
       
    45 // CLASS DECLARATION
       
    46 
       
    47 /**
       
    48  * @class CScrollerTimer atconsoleui.h
       
    49  * @brief The CSrollerTimer is used for updating the application
       
    50  * user interface.
       
    51  */
       
    52 class CScrollerTimer
       
    53         :public CActive
       
    54     {       
       
    55     public:  // Constructors and destructor
       
    56 
       
    57         /**
       
    58         * NewL is first phase of two-phased constructor.
       
    59         */
       
    60         static CScrollerTimer* NewL( CConsoleMain* aMain );
       
    61 
       
    62         /**
       
    63         * Destructor of CModule.
       
    64         */
       
    65         ~CScrollerTimer();
       
    66 
       
    67     public: // New functions
       
    68 
       
    69 		/** 
       
    70         * StartL
       
    71         */
       
    72 		void StartL();
       
    73 
       
    74 		/** 
       
    75         * RunL
       
    76         */
       
    77 		void RunL();
       
    78 
       
    79 		/** 
       
    80         * DoCancel
       
    81         */
       
    82 		void DoCancel();
       
    83 
       
    84 		/** 
       
    85         * RunError
       
    86         */
       
    87 		TInt RunError ( TInt aError );
       
    88 
       
    89     private:
       
    90 
       
    91         /** 
       
    92         * C++ default constructor.
       
    93         */
       
    94         CScrollerTimer();
       
    95 
       
    96         /**
       
    97         * By default Symbian OS constructor is private.
       
    98         */
       
    99         void ConstructL( CConsoleMain* aMain );
       
   100 
       
   101     protected:  // Data
       
   102         // None
       
   103 
       
   104     private:    // Data
       
   105         CConsoleMain*     iMain;            // Pointer to main console
       
   106 		RTimer            iTimer;
       
   107     };
       
   108 
       
   109 /**
       
   110  * @class CConsoleMain atconsoleui.h
       
   111  * @brief The CConsoleMain is main class for constructing the console
       
   112  * application.
       
   113  */
       
   114 class CConsoleMain: public CBase
       
   115     {
       
   116     public:  // Constructors and destructor
       
   117 
       
   118         /**
       
   119         * NewL is first phase of two-phased constructor.
       
   120         */
       
   121         static CConsoleMain* NewL();
       
   122 
       
   123         /**
       
   124         * Start
       
   125         */
       
   126         TInt StartL();
       
   127 
       
   128         /**
       
   129         * Returns the array of processes under testing
       
   130         */
       
   131         RArray<TATProcessInfo> Processes();
       
   132 
       
   133         /**
       
   134         * Returns handle to the storage server
       
   135         * @return RATStorageServer handle to the storage server
       
   136         */  
       
   137         inline RATStorageServer StorageServer()
       
   138             {
       
   139             return iStorageServer;    
       
   140             }
       
   141 
       
   142         /**
       
   143         * Starts a subtest for a process.
       
   144         * @param aProcessId ID of the process
       
   145         */
       
   146         void SetProcessSubTestStart( TUint aProcessId );
       
   147         
       
   148         /**
       
   149         * Stops a subtest for a process.
       
   150         * @param aProcessId ID of the process
       
   151         */
       
   152         
       
   153         void SetProcessSubTestStop( TUint aProcessId );
       
   154         
       
   155         /**
       
   156         * Checks if subtest is running for a process.
       
   157         * @param aProcessId ID of the process
       
   158         * @return The index of the first matching aProcessId 
       
   159         * within the array. KErrNotFound, if no matching 
       
   160         * aProcessId can be found.
       
   161         */
       
   162         TInt IsSubTestRunning( TUint aProcessId );
       
   163         
       
   164         /**        
       
   165         * Stops all the subtests currently running.
       
   166         */   
       
   167         void StopAllSubtestsL();
       
   168         
       
   169         /**
       
   170         * Destructor of CConsoleMain.
       
   171         */
       
   172         ~CConsoleMain();
       
   173         
       
   174         /**
       
   175         * Updates processes.
       
   176         */       
       
   177         void UpdateProcessesL();
       
   178 
       
   179 
       
   180     public: // New functions
       
   181 
       
   182         /**
       
   183         * Close instance.
       
   184         */
       
   185         void Close( TInt aHandle );
       
   186 
       
   187         /**
       
   188         * Return pointer to console
       
   189         */
       
   190         CConsoleBase* GetConsole();
       
   191 
       
   192         /**
       
   193         * Called from timer to perform scrolling
       
   194         */
       
   195         void TimerUpdate();
       
   196                 
       
   197         /**
       
   198         * Process keystokes.
       
   199         */
       
   200         void KeyPressedL();
       
   201 
       
   202     private:
       
   203 
       
   204         /** 
       
   205         * C++ default constructor.
       
   206         */
       
   207         CConsoleMain();
       
   208 
       
   209         /**
       
   210         * By default Symbian OS constructor is private.
       
   211         */
       
   212         void ConstructL();
       
   213         
       
   214     protected:  // Data
       
   215         // None
       
   216 
       
   217     private:    // Data
       
   218         CConsoleBase*       iConsole;       // Pointer to console
       
   219 
       
   220         CView*              iMainView;      // Root menu
       
   221         CView*              iCurrentView;   // Current menu
       
   222 
       
   223         CScrollerTimer*     iScroller;
       
   224         
       
   225         CConsoleReader*     iReader;        // Console reader                   
       
   226         // Handle to the RATStorageServer
       
   227         RATStorageServer iStorageServer;
       
   228         // Array of processes under testing
       
   229         RArray<TATProcessInfo> iProcesses;
       
   230         // array containing all the processes which subtest is running
       
   231         RArray<TUint> iSubTestProcesses;
       
   232         TBool             iStorageServerOpen;
       
   233     };
       
   234     
       
   235 /**
       
   236  * @class CConsoleReader atconsoleui.h
       
   237  * @brief The CConsoleReader is reading keystrokes from console.
       
   238  */
       
   239 class CConsoleReader
       
   240     :public CActive
       
   241     {
       
   242     public:  // Constructors and destructor
       
   243 
       
   244         /**
       
   245         * NewL is first phase of two-phased constructor.
       
   246         */
       
   247         static CConsoleReader* NewL( CConsoleMain* aMain, 
       
   248                                      CConsoleBase* aConsole );
       
   249 
       
   250         /**
       
   251         * Start
       
   252         */
       
   253         void StartL();
       
   254 
       
   255         /**
       
   256         * Destructor of CConsoleReader.
       
   257         */
       
   258         ~CConsoleReader();
       
   259 
       
   260     public: // Functions from base classes
       
   261 
       
   262         /**
       
   263         * RunL derived from CActive handles the completed requests.
       
   264         */
       
   265         void RunL();
       
   266 
       
   267         /**
       
   268         * DoCancel derived from CActive handles the Cancel
       
   269         */
       
   270         void DoCancel();
       
   271         /**
       
   272         * RunError derived from CActive handles errors from active object
       
   273         */        
       
   274         virtual TInt RunError(TInt aError);
       
   275 
       
   276     private:
       
   277 
       
   278         /** 
       
   279         * C++ default constructor.
       
   280         */
       
   281         CConsoleReader( CConsoleMain* aMain, 
       
   282                         CConsoleBase* iConsole );
       
   283 
       
   284         /**
       
   285         * By default Symbian OS constructor is private.
       
   286         */
       
   287         void ConstructL();
       
   288 
       
   289     public:   //Data
       
   290         // None
       
   291     
       
   292     protected:  // Data
       
   293         // None
       
   294 
       
   295     private:    // Data
       
   296         CConsoleBase*   iConsole;   // Pointer to console
       
   297         CConsoleMain*   iMain;      // Pointer to the CConsoleMain
       
   298     };
       
   299 
       
   300 #endif // ATCONSOLEUI_H
       
   301 
       
   302 // End of File