devicediagnosticsfw/diagresultsdb/server/inc/diagresultsdbtestrecordsubsession.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-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:  Symbian OS server subsession.
       
    15 *  libraries   : 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef DIAGRESULTSDBTESTRECORDSUBSESSION_H
       
    21 #define DIAGRESULTSDBTESTRECORDSUBSESSION_H
       
    22 
       
    23 //System includes
       
    24 #include <e32cmn.h> //RMessage2
       
    25 #include <e32base.h> //CObject 
       
    26 
       
    27 //Forward declarations
       
    28 class CDiagResultsDbSession;
       
    29 class CDiagResultsDbTestRecordHandle;
       
    30 class MRecordCompletionObserver;
       
    31 
       
    32 /**
       
    33 * Server Subsession 
       
    34 *
       
    35 * @since S60 v5.0
       
    36 **/
       
    37 class CDiagResultsDbTestRecordSubsession: public CObject, 
       
    38                                           public MRecordCompletionObserver
       
    39 	{
       
    40 public:  
       
    41 
       
    42     /**
       
    43     * NewL.
       
    44     * 
       
    45     * @param aSession Main Database session.
       
    46     * @param aTestRecord The test record that this subsession handles.
       
    47     *                    The record is either totally empty or contains data.
       
    48     * @param aResumeTestRecord Indicates can opened test record modified.
       
    49     *
       
    50     * @return Test record subsession.                    
       
    51     **/
       
    52 	static CDiagResultsDbTestRecordSubsession* NewL(
       
    53 	                                 CDiagResultsDbSession* aSession, 
       
    54 	                                 CDiagResultsDbTestRecordHandle* aTestRecordHandle,
       
    55 	                                 TBool aReadonly
       
    56 	                                 );
       
    57 	                                 
       
    58     /**
       
    59     * Destructor.
       
    60     **/
       
    61     ~CDiagResultsDbTestRecordSubsession();
       
    62 
       
    63     /**
       
    64     * Handles the client request. 
       
    65     *
       
    66     * @param aMessage Details of the client request.
       
    67     * @return ETrue if request was asynchronous, EFalse otherwise.
       
    68     **/
       
    69     TBool DispatchMessageL(const RMessage2& aMessage);
       
    70     
       
    71     /**
       
    72     * Returns the test record that this subsession represents.
       
    73     *
       
    74     * @return The test record.
       
    75     **/
       
    76     CDiagResultsDbTestRecordHandle* CurrentTestRecordHandle();
       
    77     
       
    78     /**
       
    79     * Returns the value that client send when connecting.
       
    80     * ETrue = Readonly subsession.
       
    81     * EFalse = Writable subsession.
       
    82     **/ 
       
    83     TBool ReadonlySubsession() const;
       
    84     
       
    85 public: //MRecordCompletionObserver
       
    86         
       
    87     /**
       
    88     * This is called when test record is completed.
       
    89     *
       
    90     * @param aError Symbian error code or KErrNone.
       
    91     **/   
       
    92     void CompletedRecordL( TInt aError );    
       
    93 
       
    94 protected:
       
    95 
       
    96     /**
       
    97     * C++ Constructor
       
    98     *
       
    99     * @param aSession Main Database session.
       
   100     * @param aTestRecord The test record that this subsession handles.
       
   101     *                    The record is either totally empty or contains data.
       
   102     **/
       
   103     CDiagResultsDbTestRecordSubsession(
       
   104                         CDiagResultsDbSession* aSession, 
       
   105                         CDiagResultsDbTestRecordHandle* aTestRecord,
       
   106                         TBool aReadonly
       
   107                         );
       
   108                       
       
   109     /**
       
   110     * ConstructL.
       
   111     **/                    
       
   112     void ConstructL();                    
       
   113     
       
   114 private: // Client request handling functions. 
       
   115          // Look at DiagResultsDatabaseCommon.h for the client requests.
       
   116 
       
   117     void LogTestResultL( const RMessage2& aMessage );
       
   118     
       
   119     void GetTestResultL( const RMessage2& aMessage );
       
   120     
       
   121     void CompleteTestRecordL( const RMessage2& aMessage );
       
   122     
       
   123     void GetTestResultsL( CDiagResultsDbTestRecordHandle* aTestRecord, 
       
   124                           const RMessage2& aMessage );
       
   125     
       
   126     void GetTestUidsL( const RMessage2& aMessage );
       
   127        
       
   128     void GetEngineParamL( const RMessage2& aMessage );
       
   129     
       
   130     TBool Completed() const;
       
   131     
       
   132     void GetStatusL ( const RMessage2& aMessage );
       
   133     
       
   134     void SuspendTestRecordL( const RMessage2& aMessage );
       
   135     
       
   136     void CancelLogTestResult( const RMessage2& aMessage );
       
   137     
       
   138 private: // Data
       
   139 
       
   140     // Main DB session
       
   141     CDiagResultsDbSession* iSession;
       
   142     
       
   143     // Test record that represents this subsession.
       
   144     CDiagResultsDbTestRecordHandle* iTestRecordHandle;
       
   145     
       
   146     // Details of the client request.
       
   147     RMessage2 iMsg;
       
   148     
       
   149     // Dynamic flat buffer for transmitting data across IPC.
       
   150     CBufFlat* iBuffer;
       
   151     
       
   152     // Read or Write-mode 
       
   153     TBool iReadonly;
       
   154     
       
   155     TBool iCompletedLogTest;
       
   156 	};
       
   157 	
       
   158 #endif // DIAGRESULTSDBTESTRECORDSUBSESSION_H