devicediagnosticsfw/diagframework/inc/diaglogeventeraser.h
branchRCL_3
changeset 25 b183ec05bd8c
parent 24 13d7c31c74e0
child 26 19bba8228ff0
equal deleted inserted replaced
24:13d7c31c74e0 25:b183ec05bd8c
     1 /*
       
     2 * Copyright (c) 2007 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:  This is the header for the Diagnostics Logs Event Eraser.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DIAGLOGEVENTERASER_H
       
    20 #define DIAGLOGEVENTERASER_H
       
    21 
       
    22 // Include Files
       
    23 #include <e32base.h>                    // CActive
       
    24 #include <f32file.h>                    // RFs
       
    25 
       
    26 // Forward Declarations
       
    27 class MDiagLogEventEraserObserver;
       
    28 class CActiveSchedulerWait;
       
    29 class CLogClient;
       
    30 class CLogViewEvent;
       
    31 class CLogFilter;
       
    32 
       
    33 /**
       
    34 * Diagnostics Plugin Log Event Eraser
       
    35 *
       
    36 * This class is used to remove log events generated by diagnostics plugins.
       
    37 * Events could be anything that is logged by the system log, such as call or
       
    38 * data use records.
       
    39 *
       
    40 * @lib euser.lib
       
    41 * @lib logcli.lib 
       
    42 * @lib efsrv.lib
       
    43 * @lib flogger.lib
       
    44 */
       
    45 NONSHARABLE_CLASS( CDiagLogEventEraser ) : public CActive
       
    46     {
       
    47 
       
    48 public: // New functions
       
    49 
       
    50     /**
       
    51     * Symbian OS two-phase constructor.
       
    52     *
       
    53     * @param aObserver A reference to the observer for this event eraser.
       
    54     * @param aFilter The filter to be used for log erasure.  Clients may pass
       
    55     *                NULL for no filtering.  Ownership is transferred.
       
    56     * @return An pointer to the new instance of CDiagLogEventEraser.
       
    57     */
       
    58     IMPORT_C static CDiagLogEventEraser* NewL(
       
    59         MDiagLogEventEraserObserver& aObserver,
       
    60         CLogFilter* aFilter = NULL );
       
    61 
       
    62     /**
       
    63     * Destructor.
       
    64     */
       
    65     IMPORT_C virtual ~CDiagLogEventEraser();
       
    66 
       
    67     /**
       
    68     * This gets the filter used for the log erasure.  Clients which want to
       
    69     * filter the logs to be erased must call this function and set the
       
    70     * appropriate filter before calling StartAsyncEraseLogsL or EraseLogsL.
       
    71     *
       
    72     * @return The filter to apply to the logs to check for erasure.
       
    73     */
       
    74     IMPORT_C CLogFilter& Filter();
       
    75 
       
    76     /**
       
    77     * This gets the log client used for the log erasure.
       
    78     *
       
    79     * @return The log client used for log erasure.
       
    80     */
       
    81     IMPORT_C CLogClient& LogClient();
       
    82 
       
    83     /**
       
    84     * This starts an asynchronous log erase operation.  The completion of this
       
    85     * request is notified by MDiagLogEventEraserObserver::CompleteEventEraseL.
       
    86     */
       
    87     IMPORT_C void StartAsyncEraseLogsL();
       
    88 
       
    89     /**
       
    90     * This performs a synchronous log erase operation.  The function will
       
    91     * leave if there is any error in log erasure.
       
    92     */
       
    93     IMPORT_C void EraseLogsL();
       
    94 
       
    95 
       
    96 private: // New functions
       
    97 
       
    98     /**
       
    99     * C++ default constructor.
       
   100     *
       
   101     * @param aObserver A reference to the observer for this event eraser.
       
   102     * @param aFilter The filter to be used for log erasure.  If NULL is
       
   103     *                passed, a new filter will be created during the second
       
   104     *                phase of construction.  Ownership is transferred.
       
   105     */
       
   106     CDiagLogEventEraser( MDiagLogEventEraserObserver& aObserver,
       
   107                          CLogFilter* aFilter );
       
   108     
       
   109     /**
       
   110     * Symbian OS default constructor.
       
   111     */
       
   112     void ConstructL();
       
   113 
       
   114     /**
       
   115     * Handles the completion of log erasing and performs different operations
       
   116     * depending on whether the erasing was asynchronous or not.
       
   117     */
       
   118     void HandleCompletionL( TInt aError );
       
   119 
       
   120 
       
   121 private: // From base class CActive
       
   122 
       
   123     /**
       
   124     * Handle active object completion event.
       
   125     */
       
   126     virtual void RunL();
       
   127 
       
   128     /**
       
   129     * Handle active object cancel event.
       
   130     */
       
   131     virtual void DoCancel();
       
   132 
       
   133 
       
   134 private: // Data
       
   135 
       
   136     /** The state of the log erasing operation. */
       
   137     enum TDiagLogEventEraserState
       
   138         {
       
   139         EStateInitial = 0,
       
   140         EStateApplyingFilter,
       
   141         EStateReadingEntries,
       
   142         EStateDeletingEntry,
       
   143         EStateComplete
       
   144         };
       
   145 
       
   146     /** The observer for this instance of the log event eraser. */
       
   147     MDiagLogEventEraserObserver& iObserver;
       
   148 
       
   149     /** The active scheduler, used for synchronous log erasure.  Own. */
       
   150     CActiveSchedulerWait* iWaitScheduler;
       
   151 
       
   152     /** The Log client.  Own. */
       
   153     CLogClient* iLogClient;
       
   154 
       
   155     /** The Log view.  Own. */
       
   156     CLogViewEvent* iLogView;
       
   157 
       
   158     /** The Log filter.  Own. */
       
   159     CLogFilter* iLogFilter;
       
   160 
       
   161     /** A file server session used to delete the logs. */
       
   162     RFs iFsSession;
       
   163 
       
   164     /** The internal state of the log event eraser. */
       
   165     TDiagLogEventEraserState iState;
       
   166 
       
   167     /** Indicates if the log event eraser is running a synchronous delete. */
       
   168     TBool iIsDeletingSynchronous;
       
   169 
       
   170     /** The return code for syncronous operation. */
       
   171     TInt iError;
       
   172     };
       
   173 
       
   174 #endif // DIAGLOGEVENTERASER_H
       
   175 
       
   176 // End of File