testexecfw/stf/stffw/testinterface/src/TestModuleIf.cpp
author Johnson Ma <johnson.ma@nokia.com>
Fri, 09 Apr 2010 10:46:28 +0800
changeset 2 8bb370ba6d1d
permissions -rw-r--r--
contribute STF 1.0.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     1
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     8
*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    11
*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    12
* Contributors:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    13
* 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    14
* Description: This file contains TestModuleIf implementation.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    15
*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    16
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    17
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    18
// INCLUDE FILES
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    19
#include <e32svr.h>
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    20
#include "StifTFwIfProt.h"
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    21
#include "StifTestInterface.h"
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    22
#include "TestServerModuleIf.h"
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    23
#include "StifTestModule.h"
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    24
#include "TestThreadContainer.h"
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    25
#include "STIFMeasurement.h"
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    26
#include "TestScripterInternal.h"
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    27
#include <e32property.h>
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    28
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    29
// EXTERNAL DATA STRUCTURES
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    30
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    31
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    32
// EXTERNAL FUNCTION PROTOTYPES  
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    33
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    34
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    35
// CONSTANTS
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    36
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    37
const TUid KPropertyCat =
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    38
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    39
    0x101FB3DE
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    40
    };
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    41
const TUint KPropertyKey = 0x00000001;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    42
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    43
// MACROS
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    44
// Debugging is enabled with next define
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    45
#define __TRACING_ENABLED
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    46
#ifdef __TRACING_ENABLED
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    47
#define __RDEBUG(p) RDebug::Print p 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    48
#else
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    49
#define __RDEBUG(p)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    50
#endif
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    51
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    52
// LOCAL CONSTANTS AND MACROS
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    53
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    54
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    55
// MODULE DATA STRUCTURES
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    56
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    57
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    58
// LOCAL FUNCTION PROTOTYPES
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    59
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    60
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    61
static RPointerArray<TScriptObject> *getDict()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    62
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    63
    TInt script = 0;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    64
    TInt err = RProperty::Get(KPropertyCat, RProcess().Id().Id(), script);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    65
    if (err != KErrNone)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    66
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    67
        return NULL;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    68
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    69
    return (RPointerArray<TScriptObject> *) script;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    70
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    71
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    72
// FORWARD DECLARATIONS
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    73
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    74
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    75
// ==================== LOCAL FUNCTIONS =======================================
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    76
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    77
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    78
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    79
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    80
    DESCRIPTION
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    81
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    82
    TDesOverflowHandler class contains a simple overflow handler implementation.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    83
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    84
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    85
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    86
class TDesOverflowHandler : public TDes16Overflow
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    87
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    88
    public:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    89
        TDesOverflowHandler( CTestModuleIf* aModuleIf, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    90
                             const TInt aPriority, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    91
                             const TDesC& aDefinition)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    92
            {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    93
            iModuleIf = aModuleIf;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    94
            iPriority = aPriority;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    95
            iDefinition = aDefinition;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    96
            }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    97
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    98
        void Overflow(TDes16& /*aDes*/ )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    99
            { 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   100
            }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   101
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   102
        CTestModuleIf* iModuleIf;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   103
        TInt iPriority;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   104
        TStifInfoName iDefinition;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   105
    };
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   106
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   107
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   108
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   109
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   110
    DESCRIPTION
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   111
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   112
    This module contains the implementation of CTestModuleIf class 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   113
    member functions.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   114
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   115
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   116
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   117
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   118
// ================= MEMBER FUNCTIONS =========================================
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   119
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   120
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   121
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   122
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   123
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   124
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   125
    Method: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   126
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   127
    Description: Default constructor
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   128
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   129
    C++ default constructor can NOT contain any code, that
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   130
    might leave.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   131
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   132
    Parameters: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   133
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   134
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   135
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   136
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   137
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   138
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   139
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   140
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   141
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   142
CTestModuleIf::CTestModuleIf( CTestThreadContainer* aTestExecution ) :
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   143
    iTestExecution( aTestExecution )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   144
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   145
    iNumberInGlbDict = 0;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   146
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   147
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   148
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   149
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   150
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   151
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   152
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   153
    Method: ConstructL
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   154
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   155
    Description: Symbian OS second phase constructor
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   156
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   157
    Symbian OS default constructor can leave.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   158
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   159
    Parameters: CTestExecution* aTestExecution: in: Pointer to TestExecution
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   160
                CTestModuleBase* aTestModule: in: Pointer to TestModule
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   161
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   162
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   163
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   164
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   165
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   166
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   167
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   168
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   169
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   170
void CTestModuleIf::ConstructL( CTestModuleBase* aTestModule )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   171
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   172
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   173
    if ( aTestModule->iTestModuleIf != NULL)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   174
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   175
        delete aTestModule->iTestModuleIf;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   176
        aTestModule->iTestModuleIf = NULL;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   177
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   178
    aTestModule->iTestModuleIf = this; 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   179
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   180
    iIsRebootReady = EFalse;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   181
    iStoreStateCounter = 0;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   182
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   183
    // Used to "resets" iTestCaseResults array
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   184
    iAllowTestCaseResultsCount = 0;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   185
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   186
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   187
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   188
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   189
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   190
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   191
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   192
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   193
    Method: NewL
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   194
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   195
    Description: Two-phased constructor.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   196
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   197
    Parameters: CTestExecution* aTestExecution: in: Pointer to TestExecution
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   198
                CTestModuleBase* aTestModule: in: Pointer to TestModule
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   199
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   200
    Return Values: CTestModuleIf object.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   201
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   202
    Errors/Exceptions: Leaves if memory allocation fails
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   203
                       Leaves if ConstructL leaves
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   204
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   205
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   206
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   207
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   208
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   209
EXPORT_C CTestModuleIf* CTestModuleIf::NewL( CTestThreadContainer* aExecutionSession, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   210
                                             CTestModuleBase* aTestModule )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   211
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   212
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   213
    CTestModuleIf* self = 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   214
        new (ELeave) CTestModuleIf( aExecutionSession );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   215
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   216
    CleanupStack::PushL( self );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   217
    self->ConstructL( aTestModule );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   218
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   219
    CleanupStack::Pop();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   220
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   221
    return self;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   222
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   223
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   224
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   225
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   226
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   227
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   228
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   229
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   230
    Method: ~CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   231
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   232
    Description: Destructor
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   233
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   234
    Parameters: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   235
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   236
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   237
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   238
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   239
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   240
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   241
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   242
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   243
*/    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   244
CTestModuleIf::~CTestModuleIf()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   245
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   246
    iTestExecution = NULL;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   247
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   248
    // Used to "resets" iTestCaseResults array
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   249
    iAllowTestCaseResultsCount = 0;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   250
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   251
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   252
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   253
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   254
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   255
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   256
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   257
    Method: Printf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   258
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   259
    Description: Printing
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   260
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   261
    Printf is used to provide different information up to the UI 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   262
    that can be then printed e.g. to the Console Screen. 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   263
    The priority can be used in the UI to decide if the information 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   264
    received from the Test DLL will be discarded or not in 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   265
    the different performance situations. The priority is also 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   266
    used in the Test DLL server and in the Test Engine to queue 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   267
    the Printf responses.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   268
    This method is implemented in Test DLL Server and the Test DLL 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   269
    can call it to provide printable information to the UI.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   270
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   271
    Parameters:  const TInt aPriority: in: 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   272
                    Importance of the returned information
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   273
                 const TDesC& aDefinition: in: 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   274
                    Definition of data to be printed 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   275
                 TRefByValue<const TDesC> aFmt: in: Printed data
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   276
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   277
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   278
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   279
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   280
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   281
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   282
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   283
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   284
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   285
EXPORT_C void CTestModuleIf::Printf( const TInt aPriority, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   286
                                     const TDesC& aDefinition, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   287
                                     TRefByValue<const TDesC> aFmt,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   288
                                     ... 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   289
                                   )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   290
    {           
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   291
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   292
    if( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   293
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   294
        return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   295
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   296
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   297
    VA_LIST list;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   298
    VA_START(list,aFmt);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   299
    TName aBuf;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   300
    RBuf buf;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   301
    TInt ret = buf.Create(1024);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   302
    if(ret != KErrNone)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   303
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   304
        __RDEBUG((_L("STF: Printf: Buffer creation failed [%d]"), ret));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   305
        return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   306
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   307
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   308
    // Cut the description length
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   309
    TInt len = aDefinition.Length();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   310
    if ( len > KMaxInfoName )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   311
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   312
        len = KMaxInfoName;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   313
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   314
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   315
    TStifInfoName shortDescription = aDefinition.Left(len);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   316
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   317
    // Create overflow handler
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   318
    TDesOverflowHandler overFlowHandler (this, aPriority, shortDescription);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   319
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   320
    // Parse parameters
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   321
    buf.AppendFormatList(aFmt, list, &overFlowHandler);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   322
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   323
    if(buf.Length() == 0)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   324
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   325
        __RDEBUG((_L("STF: Printf: Unable to prepare print buffer (probably printed string is too long)")));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   326
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   327
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   328
    // Print
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   329
    aBuf.Copy(buf.Left(aBuf.MaxLength()));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   330
    buf.Close();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   331
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   332
    iTestExecution->DoNotifyPrint( aPriority, shortDescription, aBuf );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   333
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   334
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   335
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   336
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   337
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   338
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   339
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   340
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   341
    Method: Event
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   342
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   343
    Description: Event control.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   344
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   345
    Event function is used to control and use the event system. 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   346
    TEventIf &aEvent encapsulates the request type and 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   347
    the event name, see StifTestEventInterface.h for more information.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   348
    This method is implemented in Test DLL Server and the Test DLL 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   349
    can call it to control the event system.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   350
  
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   351
    Parameters: TEventIf& aEvent: in: Event command
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   352
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   353
    Return Values: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   354
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   355
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   356
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   357
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   358
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   359
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   360
*/      
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   361
EXPORT_C TInt CTestModuleIf::Event( TEventIf& aEvent )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   362
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   363
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   364
    if( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   365
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   366
        return KErrGeneral;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   367
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   368
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   369
    // All event commands are handled in testserver and testengine
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   370
    return iTestExecution->DoNotifyEvent( aEvent );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   371
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   372
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   373
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   374
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   375
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   376
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   377
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   378
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   379
    Method: Event
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   380
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   381
    Description: Event control.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   382
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   383
    Asynchronous version of event control function.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   384
    It is used to control and use the event system asynchronously. 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   385
    TEventIf &aEvent encapsulates the request type and 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   386
    the event number, see StifTestEventInterface.h for more information.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   387
    This method is implemented in Test DLL Server and the Test DLL 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   388
    can call it to control the event system.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   389
  
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   390
    Parameters: TEventIf& aEvent: in: Event command
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   391
                TRequestStatus& aStatus: in: Request status parameter
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   392
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   393
    Return Values: None. 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   394
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   395
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   396
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   397
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   398
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   399
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   400
*/      
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   401
EXPORT_C void CTestModuleIf::Event( TEventIf& aEvent, TRequestStatus& aStatus )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   402
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   403
    TInt ret = KErrNone;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   404
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   405
    if( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   406
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   407
        __RDEBUG( (_L("iTestExecution not initialised")));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   408
        ret = KErrGeneral;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   409
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   410
    else
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   411
        {        
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   412
        aStatus = KRequestPending;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   413
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   414
        // All event commands are handled in testserver and testengine
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   415
        ret = iTestExecution->DoNotifyEvent( aEvent, &aStatus );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   416
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   417
    if( ret != KErrNone )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   418
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   419
        TRequestStatus* rs = &aStatus;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   420
        User::RequestComplete( rs, ret );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   421
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   422
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   423
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   424
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   425
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   426
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   427
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   428
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   429
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   430
    Method: CancelEvent
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   431
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   432
    Description: Cancel asynchronous event control call.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   433
  
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   434
    Parameters: TEventIf& aEvent: in: Event command to be cancelled.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   435
                const TRequestStatus* aStatus: in: 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   436
                    Pointer to TRequestStatus parameter that is cancelled
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   437
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   438
    Return Values: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   439
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   440
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   441
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   442
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   443
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   444
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   445
*/      
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   446
EXPORT_C TInt CTestModuleIf::CancelEvent( TEventIf& aEvent,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   447
                                          TRequestStatus* aStatus )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   448
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   449
     if( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   450
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   451
        __RDEBUG( (_L("iTestExecution not initialised")));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   452
        return KErrGeneral;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   453
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   454
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   455
    // All event commands are handled in testserver and testengine
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   456
    iTestExecution->CancelEvent( aEvent, aStatus );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   457
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   458
    return KErrNone;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   459
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   460
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   461
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   462
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   463
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   464
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   465
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   466
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   467
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   468
    Method: SetExitReason
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   469
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   470
    Description: Set exit reason
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   471
  
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   472
    Parameters: const TExitReason aExitReason in: Exit reason
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   473
                const TInt aExitCode in: Exit code
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   474
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   475
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   476
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   477
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   478
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   479
    Status: Proposal
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   480
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   481
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   482
*/      
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   483
EXPORT_C void CTestModuleIf::SetExitReason( const CTestModuleIf::TExitReason aExitReason, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   484
                                            const TInt aExitCode )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   485
        
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   486
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   487
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   488
     if( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   489
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   490
        __RDEBUG( (_L("iTestExecution not initialised")));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   491
        return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   492
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   493
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   494
    iTestExecution->SetExitReason( aExitReason, aExitCode );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   495
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   496
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   497
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   498
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   499
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   500
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   501
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   502
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   503
    Method: RemoteSend
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   504
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   505
    Description: RemoteSend is used to send control protocol messages to slaves
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   506
        (e.g. another phone, call box, ...). 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   507
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   508
    Parameters:  const TDesC& aRemoteMsg: in: 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   509
                    Remote command protocol message 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   510
                 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   511
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   512
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   513
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   514
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   515
    Status: Proposal
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   516
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   517
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   518
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   519
EXPORT_C TInt CTestModuleIf::RemoteSend( const TDesC& aRemoteMsg )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   520
    {           
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   521
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   522
    if( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   523
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   524
        __RDEBUG( ( _L("iTestExecution not initialised") ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   525
        return KErrNotReady;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   526
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   527
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   528
    TParams params;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   529
    params.aRemoteMsgConstRef = &aRemoteMsg;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   530
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   531
    TRequestStatus status = KRequestPending; 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   532
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   533
    // Forward
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   534
    iTestExecution->DoRemoteReceive( EStifCmdSend, params, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   535
                                     aRemoteMsg.Length(), status );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   536
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   537
    User::WaitForRequest( status );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   538
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   539
    return status.Int();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   540
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   541
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   542
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   543
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   544
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   545
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   546
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   547
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   548
    Method: RemoteReceive
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   549
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   550
    Description: RemoteReceive is used to receive control protocol messages to 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   551
        slaves (e.g. another phone, call box, ...). 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   552
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   553
    Parameters:  const TDesC& aRemoteMsg: in: 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   554
                    Remote command protocol message 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   555
                 TRequestStatus& aStatus: in: Request status parameter
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   556
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   557
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   558
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   559
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   560
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   561
    Status: Proposal
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   562
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   563
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   564
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   565
EXPORT_C void CTestModuleIf::RemoteReceive( TDes& aRemoteMsg, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   566
                                            TRequestStatus& aStatus )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   567
    {           
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   568
    aStatus = KRequestPending;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   569
    if( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   570
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   571
        __RDEBUG( ( _L("iTestExecution not initialised") ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   572
        TRequestStatus* rs = &aStatus;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   573
        User::RequestComplete( rs, KErrNotReady );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   574
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   575
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   576
    TParams params;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   577
    params.aRemoteMsgRef = &aRemoteMsg;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   578
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   579
    iTestExecution->DoRemoteReceive( EStifCmdReceive, params, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   580
                                     aRemoteMsg.Length(), aStatus );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   581
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   582
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   583
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   584
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   585
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   586
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   587
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   588
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   589
    Method: RemoteReceiveCancel
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   590
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   591
    Description: RemoteReceiveCancel is used to cancel RemoteReceive.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   592
     
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   593
    Parameters:  None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   594
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   595
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   596
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   597
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   598
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   599
    Status: Proposal
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   600
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   601
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   602
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   603
EXPORT_C void CTestModuleIf::RemoteReceiveCancel()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   604
    {           
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   605
    if( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   606
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   607
        __RDEBUG( ( _L("iTestExecution not initialised") ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   608
        return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   609
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   610
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   611
    // Forward
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   612
    iTestExecution->DoRemoteReceiveCancel();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   613
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   614
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   615
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   616
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   617
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   618
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   619
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   620
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   621
    Method: Reboot
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   622
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   623
    Description: Start a reboot operation.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   624
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   625
    Parameters: TInt aType: in: Reboot type
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   626
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   627
    Return Values: TInt: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   628
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   629
    Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   630
                       KErrNotReady returned if reboot not allowed(Store state
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   631
                       not called).
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   632
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   633
    Status: Proposal
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   634
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   635
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   636
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   637
EXPORT_C TInt CTestModuleIf::Reboot( TInt aType )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   638
    {           
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   639
    if ( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   640
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   641
        __RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   642
        return KErrNotReady;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   643
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   644
    if( !iIsRebootReady )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   645
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   646
        __RDEBUG( ( _L( "Reboot operation not ready" ) ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   647
        return KErrNotReady;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   648
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   649
     
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   650
/*    switch( aType )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   651
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   652
        case EDefaultReset:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   653
            __RDEBUG( ( _L( "Reboot, type default" )) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   654
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   655
        case EKernelReset:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   656
            __RDEBUG( ( _L( "Reboot, type KernelReset" )) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   657
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   658
        case EDeviceReset0:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   659
            __RDEBUG( ( _L( "Reboot, type Reset 0" )) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   660
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   661
        case EDeviceReset1:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   662
            __RDEBUG( ( _L( "Reboot, type Reset 1" )) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   663
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   664
        case EDeviceReset2:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   665
            __RDEBUG( ( _L( "Reboot, type Reset 2" )) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   666
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   667
        case EDeviceReset3:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   668
            __RDEBUG( ( _L( "Reboot, type Reset 3" )) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   669
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   670
        case EDeviceReset4:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   671
            __RDEBUG( ( _L( "Reboot, type Reset 4" )) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   672
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   673
        case EDeviceReset5:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   674
            __RDEBUG( ( _L( "Reboot, type Reset 5" )) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   675
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   676
        default:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   677
            __RDEBUG( ( _L( "Reboot type %d not supported" ), aType ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   678
            return KErrNotSupported;    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   679
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   680
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   681
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   682
    TParams params;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   683
    TRebootParams rebootParams;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   684
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   685
    params.aRebootType = &rebootParams;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   686
    rebootParams.aType = ( TRebootType )aType;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   687
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   688
    TRequestStatus status = KRequestPending; 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   689
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   690
    // Forward
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   691
    iTestExecution->DoRemoteReceive( EStifCmdReboot, params, sizeof( aType ), status );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   692
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   693
    User::WaitForRequest( status );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   694
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   695
    return status.Int();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   696
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   697
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   698
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   699
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   700
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   701
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   702
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   703
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   704
    Method: StoreState
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   705
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   706
    Description: Stores the current state before reboot.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   707
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   708
    Parameters: TInt aCode: in: Reboot releated integer value.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   709
                TName& aName: in: Reboot related string value.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   710
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   711
    Return Values: TInt: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   712
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   713
    Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   714
                       KErrOverflow returned if aName length is over TName.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   715
                       KErrInUse returned if method is called more than once.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   716
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   717
    Status: Proposal
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   718
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   719
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   720
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   721
EXPORT_C TInt CTestModuleIf::StoreState( TInt aCode, TName& aName )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   722
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   723
    iStoreStateCounter++;   // Store state counter
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   724
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   725
    if ( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   726
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   727
        __RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   728
        return KErrNotReady;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   729
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   730
    // Check aName length
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   731
    if ( aName.Length() > KMaxName )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   732
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   733
        __RDEBUG( ( _L( "CTestModuleIf::StoreState(): aName length is not valid" ) ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   734
        return KErrOverflow;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   735
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   736
    // Only one store state call may be done
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   737
    if( iStoreStateCounter > 1 )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   738
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   739
        __RDEBUG( ( _L( "Store state allready called" ) ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   740
        return KErrInUse;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   741
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   742
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   743
    TParams params;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   744
    TRebootStateParams rebootStateParams;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   745
    params.aRebootState = &rebootStateParams;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   746
    rebootStateParams.aCode = aCode;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   747
    rebootStateParams.aName = aName;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   748
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   749
    TRequestStatus status = KRequestPending; 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   750
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   751
    // Forward
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   752
    iTestExecution->DoRemoteReceive( EStifCmdStoreState, params,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   753
                                     sizeof( TRebootStateParams), status );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   754
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   755
    User::WaitForRequest( status );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   756
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   757
    // If store state is done successfully reboot operation is allowed
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   758
    if( status.Int() == KErrNone )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   759
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   760
        iIsRebootReady = ETrue;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   761
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   762
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   763
    return status.Int();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   764
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   765
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   766
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   767
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   768
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   769
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   770
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   771
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   772
    Method: GetStoredState
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   773
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   774
    Description: Get saved store information after the reboot.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   775
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   776
    Parameters: TInt aCode: inout: Get reboot releated integer value.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   777
                TName& aName: inout: Get reboot related string value.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   778
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   779
    Return Values: TInt: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   780
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   781
    Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   782
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   783
    Status: Proposal
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   784
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   785
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   786
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   787
EXPORT_C TInt CTestModuleIf::GetStoredState( TInt& aCode, TName& aName )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   788
    {           
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   789
    if( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   790
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   791
        __RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   792
        return KErrNotReady;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   793
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   794
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   795
    TInt code;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   796
    TName name;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   797
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   798
    TParams params;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   799
    TGetRebootStoredParamsRef getRebootStoredParamsRef( code, name );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   800
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   801
    params.aRebootStoredRef = &getRebootStoredParamsRef;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   802
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   803
    TRequestStatus status = KRequestPending; 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   804
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   805
    // Forward
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   806
    iTestExecution->DoRemoteReceive( EStifCmdGetStoredState, params,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   807
                                     sizeof( TRebootStateParams), status );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   808
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   809
    User::WaitForRequest( status );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   810
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   811
    // Return results if getting state is done without error
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   812
    if(status.Int() == KErrNone)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   813
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   814
        aCode = code;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   815
        aName = name;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   816
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   817
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   818
    return status.Int();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   819
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   820
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   821
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   822
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   823
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   824
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   825
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   826
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   827
    Method: SetBehavior
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   828
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   829
    Description: Set test case behavior.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   830
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   831
    Parameters: TInt aCode: inout: Get reboot releated integer value.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   832
                TName& aName: inout: Get reboot related string value.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   833
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   834
    Return Values: TInt: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   835
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   836
    Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   837
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   838
    Status: Proposal
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   839
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   840
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   841
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   842
EXPORT_C TInt CTestModuleIf::SetBehavior( TTestBehavior aType, TAny* aPtr )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   843
    {         
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   844
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   845
    if( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   846
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   847
        return KErrGeneral;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   848
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   849
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   850
    // All event commands are handled in testserver and testengine
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   851
    return iTestExecution->SetBehavior( aType, aPtr );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   852
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   853
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   854
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   855
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   856
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   857
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   858
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   859
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   860
    Method: StifMacroError
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   861
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   862
    Description: STIF TF's macros. Saves information for later use.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   863
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   864
    Parameters: TInt aMacroType: in: Macro type(0:TL, 1:T1L, 2:T2L, etc.)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   865
                const TText8* aFile: in: Uses __FILE__ macro and this includes
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   866
                path and file name. Maximun length for this is
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   867
                KStifMacroMaxFile. If length is more then cutted from left.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   868
                char* aFunction: in: Uses __FUNCTION__ macro and this includes
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   869
                function name. Maximun length for this is
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   870
                KStifMacroMaxFunction. If length is more then cutted from
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   871
                rigth.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   872
                TInt aLine: in: Uses __LINE__ macro and includes line number.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   873
                TInt aResult: in: Result from called operations.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   874
                TInt aExpected1: in: Users expected result.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   875
                TInt aExpected2: in: Users expected result.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   876
                TInt aExpected3: in: Users expected result.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   877
                TInt aExpected4: in: Users expected result.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   878
                TInt aExpected5: in: Users expected result.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   879
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   880
    Return Values: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   881
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   882
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   883
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   884
    Status: Proposal
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   885
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   886
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   887
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   888
EXPORT_C TInt CTestModuleIf::StifMacroError( TInt aMacroType, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   889
                                             const TText8* aFile,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   890
                                             const char* aFunction,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   891
                                             TInt aLine,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   892
                                             TInt aResult,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   893
                                             TInt aExpected1,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   894
                                             TInt aExpected2,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   895
                                             TInt aExpected3,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   896
                                             TInt aExpected4,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   897
                                             TInt aExpected5 )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   898
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   899
    if( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   900
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   901
        return KErrGeneral;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   902
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   903
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   904
    return iTestExecution->StifMacroError( aMacroType, aFile,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   905
                                           aFunction, aLine,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   906
                                           aResult, aExpected1,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   907
                                           aExpected2, aExpected3,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   908
                                           aExpected4, aExpected5 );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   909
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   910
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   911
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   912
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   913
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   914
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   915
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   916
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   917
    Method: ServerAlive
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   918
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   919
    Description: Get saved store information after the reboot.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   920
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   921
    Parameters: TInt aCode: inout: Get reboot releated integer value.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   922
                TName& aName: inout: Get reboot related string value.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   923
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   924
    Return Values: TInt: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   925
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   926
    Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   927
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   928
    Status: Proposal
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   929
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   930
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   931
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   932
TBool CTestModuleIf::IsServerAlive()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   933
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   934
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   935
    if( iTestExecution == NULL )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   936
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   937
        __RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   938
        // Execution not initialized
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   939
        return EFalse;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   940
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   941
       
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   942
    return ETrue;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   943
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   944
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   945
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   946
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   947
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   948
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   949
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   950
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   951
    Method: AddInterferenceThread
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   952
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   953
    Description: 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   954
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   955
    Parameters: RThread aSTIFTestInterference: in: Handle to RThread
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   956
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   957
    Return Values: TInt: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   958
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   959
    Errors/Exceptions: 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   960
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   961
    Status: Proposal
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   962
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   963
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   964
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   965
TInt CTestModuleIf::AddInterferenceThread( RThread aSTIFTestInterference )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   966
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   967
    // Add thread to Array. Via array can handle test interference thread's
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   968
    // kill in panic etc. cases
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   969
    return iTestExecution->AddInterferenceThread( aSTIFTestInterference );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   970
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   971
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   972
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   973
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   974
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   975
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   976
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   977
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   978
    Method: RemoveInterferenceThread
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   979
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   980
    Description: 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   981
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   982
    Parameters: RThread aSTIFTestInterference: in: Handle to RThread
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   983
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   984
    Return Values: TInt: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   985
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   986
    Errors/Exceptions: 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   987
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   988
    Status: Proposal
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   989
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   990
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   991
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   992
TInt CTestModuleIf::RemoveInterferenceThread( RThread aSTIFTestInterference )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   993
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   994
    // Remove thread from Array.Test interference thread is stopped and killed
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   995
    // successfully
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   996
    return iTestExecution->RemoveInterferenceThread( aSTIFTestInterference );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   997
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   998
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   999
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1000
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1001
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1002
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1003
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1004
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1005
    Method: HandleMeasurementProcess
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1006
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1007
    Description: With this can be stored information about test measurement
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1008
                 to TestServer space.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1009
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1010
    Parameters: RProcess aTestMeasurement: in: Handle to RProcess
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1011
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1012
    Return Values: TInt: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1013
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1014
    Errors/Exceptions: 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1015
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1016
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1017
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1018
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1019
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1020
TInt CTestModuleIf::HandleMeasurementProcess( 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1021
            CSTIFTestMeasurement::TStifMeasurementStruct aSTIFMeasurementInfo )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1022
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1023
    // Add process to Array. Via array can handle test measurement process's
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1024
    // kill in panic etc. cases
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1025
    return iTestExecution->HandleMeasurementProcess( aSTIFMeasurementInfo );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1026
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1027
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1028
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1029
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1030
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1031
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1032
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1033
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1034
    Method: GetMeasurementOptions
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1035
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1036
    Description: Get measurement option(s) given from initialization file etc.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1037
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1038
    Parameters: TInt& aOptions: inout: Get measurement option(s)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1039
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1040
    Return Values: TInt: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1041
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1042
    Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1043
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1044
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1045
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1046
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1047
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1048
EXPORT_C TInt CTestModuleIf::GetMeasurementOptions( TInt& aOptions )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1049
    {           
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1050
    if( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1051
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1052
        __RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1053
        return KErrNotReady;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1054
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1055
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1056
    TParams params;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1057
    TGetMeasurementOptionsRef getMeasurementOptionsRef( aOptions );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1058
    params.aMeasurementOption = &getMeasurementOptionsRef;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1059
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1060
    TRequestStatus status = KRequestPending; 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1061
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1062
    // Forward
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1063
    iTestExecution->DoRemoteReceive( EStifCmdMeasurement, params,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1064
                                     sizeof( TGetMeasurementOptions ), status );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1065
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1066
    User::WaitForRequest( status );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1067
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1068
    aOptions = getMeasurementOptionsRef.iOptions;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1069
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1070
    return status.Int();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1071
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1072
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1073
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1074
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1075
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1076
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1077
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1078
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1079
    Method: SetAllowResult
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1080
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1081
    Description: Use with TAL, TA1L, TA2L, TA3L, TA4L and TA5L macros to allow
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1082
                 results.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1083
                 Set test case allow result given by user. In TestScripter
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1084
                 cases allow result can set by 'allownextresult' or
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1085
                 'allowerrorcodes' keywords. In Normal and Hardcoded test
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1086
                 modules allow result can be set with this method, reset should
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1087
                 be done with ResetAllowResult method.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1088
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1089
    Parameters: TInt aResult: in: Result value to be appended.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1090
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1091
    Return Values: TInt: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1092
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1093
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1094
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1095
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1096
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1097
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1098
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1099
EXPORT_C TInt CTestModuleIf::SetAllowResult( TInt aResult )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1100
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1101
    for( TInt a = 0; a < iAllowTestCaseResultsCount; a++ )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1102
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1103
        // Check that result is not given already
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1104
        if ( iTestCaseResults[a] == aResult )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1105
            {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1106
            return KErrNone;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1107
            }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1108
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1109
    // If values are given more that allow(see KSTIFMacroResultArraySize).
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1110
    // Array starts from 0...9 -> 10 => 10th should fail
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1111
    if( iAllowTestCaseResultsCount >= KSTIFMacroResultArraySize )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1112
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1113
        __RDEBUG( ( 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1114
            _L( "STIF macro's SetAllowResult() allow only %d results, fails with %d" ),
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1115
            KSTIFMacroResultArraySize, KErrOverflow  ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1116
        return KErrOverflow;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1117
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1118
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1119
    // New result
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1120
    iAllowTestCaseResultsCount++;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1121
    iTestCaseResults[iAllowTestCaseResultsCount-1] = aResult;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1122
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1123
    return KErrNone;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1124
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1125
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1126
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1127
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1128
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1129
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1130
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1131
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1132
    Method: CheckAllowResult
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1133
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1134
    Description: This is mainly used by STIF's TAL-TA5L macros internally.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1135
                 Check is macros result allowed result.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1136
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1137
    Parameters: TInt aResult: in: Result value to be checked.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1138
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1139
    Return Values: TInt: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1140
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1141
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1142
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1143
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1144
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1145
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1146
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1147
EXPORT_C TInt CTestModuleIf::CheckAllowResult( TInt aResult )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1148
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1149
    // Check is result allowed
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1150
    for( TInt a = 0; a < iAllowTestCaseResultsCount; a++ )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1151
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1152
        if ( iTestCaseResults[a] == aResult )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1153
            {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1154
            // Result is allow
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1155
            __RDEBUG( ( _L( "STIF TAL-TA5L macro's result check. Test case result[%d] allowed" ),
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1156
                aResult ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1157
            return KErrNone;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1158
            }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1159
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1160
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1161
    __RDEBUG( ( 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1162
        _L( "STIF TAL-TA5L macro's result check. Test case result[%d] not allowed" ),
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1163
        aResult ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1164
    // No match with allow result
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1165
    return KErrGeneral;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1166
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1167
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1168
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1169
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1170
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1171
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1172
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1173
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1174
    Method: ResetAllowResult
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1175
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1176
    Description: Use with TAL, TA1L, TA2L, TA3L, TA4L and TA5L macros to reset
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1177
                 allowed results.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1178
                 Reset allow result(s) given with SetAllowResult. In
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1179
                 TestScripter cases this will be called automatically by STIF.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1180
                 Normal and Hardcoded cases this should be called by user.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1181
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1182
    Parameters: None.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1183
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1184
    Return Values: TInt: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1185
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1186
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1187
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1188
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1189
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1190
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1191
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1192
EXPORT_C TInt CTestModuleIf::ResetAllowResult()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1193
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1194
    // Used to "resets" iTestCaseResults array
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1195
    iAllowTestCaseResultsCount = 0;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1196
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1197
    return KErrNone;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1198
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1199
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1200
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1201
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1202
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1203
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1204
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1205
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1206
    Method: StopExecution
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1207
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1208
    Description: Causes that test case is going to be cancelled.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1209
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1210
    Parameters: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1211
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1212
    Return Values: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1213
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1214
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1215
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1216
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1217
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1218
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1219
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1220
EXPORT_C TInt CTestModuleIf::StopExecution(TStopExecutionType aType, TInt aCode)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1221
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1222
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1223
    //Check parameters
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1224
    if((aType == EOk) && (aCode != KErrNone))
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1225
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1226
        return KErrArgument;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1227
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1228
    else if((aType != EOk) && (aCode == KErrNone))
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1229
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1230
        return KErrArgument;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1231
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1232
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1233
    //Check server
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1234
    if(!IsServerAlive())
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1235
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1236
        return KErrGeneral;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1237
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1238
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1239
    //Everything is ok, we can continue with processing command
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1240
    _LIT(KStopExecution, "StopExecution");
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1241
    const TInt KPrintPriority = 30;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1242
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1243
    switch(aType)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1244
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1245
        case EOk:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1246
            Printf(KPrintPriority, KStopExecution, _L("***Test case PASSED***\n\n"));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1247
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1248
        case EFail:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1249
            Printf(KPrintPriority, KStopExecution, _L("***Test case FAILED***\n\n"));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1250
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1251
        case EAbort:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1252
            Printf(KPrintPriority, KStopExecution, _L("***Test case KILLED***\n\n"));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1253
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1254
        default:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1255
            return KErrNotFound;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1256
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1257
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1258
    TStopExecutionCommandParams params;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1259
    params.iType = aType;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1260
    params.iCode = aCode;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1261
    __RDEBUG((_L("CTestModuleIf::StopExecution(): type [%d] code [%d]"), TInt(aType), aCode));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1262
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1263
    TStopExecutionCommandParamsPckg pckg(params);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1264
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1265
    TInt res = Command(EStopExecution, pckg);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1266
    return res;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1267
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1268
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1269
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1270
------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1271
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1272
	Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1273
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1274
    Method: SendTestModuleVersion
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1275
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1276
    Description: SendTestModuleVersion method is used to pass version of test module
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1277
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1278
------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1279
 */
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1280
EXPORT_C TInt CTestModuleIf::SendTestModuleVersion(TVersion aVersion, TFileName aModuleName)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1281
	{
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1282
	if( aModuleName.Length() == 0 )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1283
		{
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1284
		return KErrArgument;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1285
		}
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1286
	
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1287
	//Check server
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1288
	if(!IsServerAlive())
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1289
	    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1290
	    return KErrGeneral;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1291
	    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1292
	
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1293
	const TInt KPrintPriority = 30;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1294
	_LIT(KVersion ,"SendTestModuleVersion");
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1295
	Printf(KPrintPriority, KVersion, _L("Sending test module version"));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1296
	
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1297
	TSendTestModuleVesionCommandParams params;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1298
	params.iMajor = aVersion.iMajor;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1299
	params.iMinor = aVersion.iMinor;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1300
	params.iBuild = aVersion.iBuild;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1301
	params.iTestModuleName = aModuleName;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1302
	
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1303
	TSendTestModuleVesionCommandParamsPckg pckg(params);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1304
	TInt res = Command( ESendTestModuleVersion, pckg );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1305
	return res;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1306
	}
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1307
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1308
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1309
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1310
------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1311
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1312
	Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1313
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1314
    Method: SendTestModuleVersion
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1315
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1316
    Description: SendTestModuleVersion method is used to pass version of test module.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1317
    			This version uses three parameters to enable the overloading of version with
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1318
    			two parameters. The version with two params has params passed by value which
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1319
    			is incorrect. The "old" version (with two parameters) is left here not to cause
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1320
    			binary break. Only this version (with three parameters) should be used.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1321
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1322
------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1323
 */
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1324
EXPORT_C TInt CTestModuleIf::SendTestModuleVersion(TVersion& aVersion, const TDesC& aModuleName, TBool /*aNewVersion*/)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1325
	{
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1326
	if( aModuleName.Length() == 0 )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1327
		{
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1328
		return KErrArgument;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1329
		}
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1330
	
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1331
	//Check server
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1332
	if(!IsServerAlive())
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1333
	    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1334
	    return KErrGeneral;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1335
	    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1336
	
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1337
	const TInt KPrintPriority = 30;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1338
	_LIT(KVersion ,"SendTestModuleVersion");
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1339
	Printf(KPrintPriority, KVersion, _L("Sending test module version"));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1340
	
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1341
	TSendTestModuleVesionCommandParams params;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1342
	params.iMajor = aVersion.iMajor;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1343
	params.iMinor = aVersion.iMinor;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1344
	params.iBuild = aVersion.iBuild;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1345
	params.iTestModuleName = aModuleName;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1346
	
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1347
	TSendTestModuleVesionCommandParamsPckg pckg(params);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1348
	TInt res = Command( ESendTestModuleVersion, pckg );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1349
	return res;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1350
	}
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1351
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1352
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1353
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1354
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1355
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1356
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1357
    Method: Command
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1358
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1359
    Description: Sends specific command to TestServer.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1360
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1361
    Parameters: aCommand - command to be send
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1362
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1363
    Return Values: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1364
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1365
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1366
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1367
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1368
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1369
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1370
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1371
TInt CTestModuleIf::Command(TCommand aCommand, const TDesC8& aParamsPckg)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1372
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1373
    TInt res = KErrNone;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1374
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1375
    if( !IsServerAlive() )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1376
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1377
        return KErrGeneral;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1378
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1379
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1380
    switch(aCommand)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1381
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1382
        case EStopExecution:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1383
            iTestExecution->DoNotifyCommand(aCommand, aParamsPckg);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1384
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1385
        case ESendTestModuleVersion:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1386
        	iTestExecution->DoNotifyCommand(aCommand, aParamsPckg);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1387
        	break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1388
        default:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1389
            __RDEBUG((_L("Command [%d] not recognized."), aCommand));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1390
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1391
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1392
    return res;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1393
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1394
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1395
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1396
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1397
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1398
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1399
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1400
    Method: GetTestCaseTitleL
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1401
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1402
    Description: Returns title of current test case.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1403
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1404
    Parameters: aCommand - command to be send
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1405
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1406
    Return Values: Symbian OS error code.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1407
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1408
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1409
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1410
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1411
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1412
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1413
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1414
EXPORT_C void CTestModuleIf::GetTestCaseTitleL(TDes& aTestCaseTitle)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1415
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1416
    iTestExecution->GetTestCaseTitleL(aTestCaseTitle);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1417
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1418
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1419
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1420
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1421
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1422
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1423
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1424
    Method: UITesting
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1425
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1426
    Description: Gets information if it is UI test or not
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1427
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1428
    Parameters: none
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1429
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1430
    Return Values: True if it is UI test, in other case it returns false.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1431
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1432
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1433
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1434
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1435
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1436
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1437
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1438
EXPORT_C TBool CTestModuleIf::UITesting()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1439
	{
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1440
	return iTestExecution->UITesting();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1441
	}
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1442
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1443
EXPORT_C TBool CTestModuleIf::SeperateProcesses()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1444
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1445
    return iTestExecution->SeperateProcesses();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1446
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1447
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1448
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1449
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1450
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1451
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1452
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1453
    Method: GetUiEnvProxy
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1454
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1455
    Description: Gets UiEnvProxy
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1456
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1457
    Parameters: none
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1458
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1459
    Return Values: Pointer to UiEnvProxy
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1460
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1461
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1462
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1463
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1464
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1465
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1466
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1467
EXPORT_C CUiEnvProxy* CTestModuleIf::GetUiEnvProxy()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1468
	{
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1469
	return iTestExecution->GetUiEnvProxy();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1470
	}
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1471
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1472
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1473
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1474
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1475
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1476
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1477
    Method: GetObjFrmDict
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1478
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1479
    Description: Gets CScriptBase
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1480
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1481
    Parameters: none
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1482
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1483
    Return Values: Pointer to CScriptBase
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1484
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1485
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1486
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1487
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1488
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1489
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1490
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1491
EXPORT_C CScriptBase* CTestModuleIf::GetObjFrmCaseDict(
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1492
        const TDesC& aObjectId)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1493
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1494
    RPointerArray<TScriptObject> *Objects = getDict();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1495
    if (NULL == Objects)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1496
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1497
        return NULL;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1498
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1499
    TInt count = Objects->Count();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1500
    for (TInt i = 0; i < count; i++)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1501
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1502
        if ((*Objects)[i]->ObjectId() == aObjectId)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1503
            {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1504
            // Found testcase with specified TestId
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1505
            return (*Objects)[i]->iScript;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1506
            }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1507
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1508
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1509
    return NULL;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1510
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1511
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1512
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1513
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1514
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1515
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1516
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1517
    Method: AddTestObjToDictL
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1518
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1519
    Description: Add Test Object
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1520
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1521
    Parameters: TScriptObject* aObject
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1522
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1523
    Return Values: Pointer to CScriptBase
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1524
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1525
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1526
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1527
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1528
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1529
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1530
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1531
EXPORT_C void CTestModuleIf::AddTestObjToCaseDictL(TScriptObject* aObject)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1532
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1533
    User::LeaveIfNull((TAny*) aObject);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1534
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1535
    RPointerArray<TScriptObject> *Objects = getDict();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1536
    User::LeaveIfNull(Objects);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1537
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1538
    TInt count = Objects->Count();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1539
    for (TInt i = 0; i < count; i++)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1540
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1541
        if ((*Objects)[i]->ObjectId() == aObject->ObjectId())
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1542
            {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1543
            // Found testcase with specified TestId
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1544
            return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1545
            }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1546
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1547
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1548
    User::LeaveIfError(Objects->Append(aObject));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1549
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1550
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1551
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1552
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1553
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1554
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1555
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1556
    Method: DelTestObjFromDict
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1557
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1558
    Description: Delete Test Object
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1559
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1560
    Parameters: TDesC& aObjectId
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1561
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1562
    Return Values: Pointer to CScriptBase
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1563
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1564
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1565
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1566
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1567
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1568
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1569
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1570
EXPORT_C void CTestModuleIf::DelTestObjFromCaseDict(const TDesC& aObjectId)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1571
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1572
    RPointerArray<TScriptObject> *Objects = getDict();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1573
    if (NULL == Objects)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1574
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1575
        return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1576
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1577
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1578
    TInt count = Objects->Count();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1579
    for (TInt i = 0; i < count; i++)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1580
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1581
        if ((*Objects)[i]->ObjectId() == aObjectId)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1582
            {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1583
            // Found testcase with specified TestId
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1584
            Objects->Remove(i);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1585
            return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1586
            }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1587
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1588
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1589
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1590
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1591
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1592
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1593
    Class: CTestModuleIf
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1594
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1595
    Method: GetTestObjFromDict
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1596
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1597
    Description: Get Test Object
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1598
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1599
    Parameters: TDesC& aObjectId
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1600
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1601
    Return Values: Pointer to CScriptBase
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1602
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1603
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1604
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1605
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1606
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1607
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1608
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1609
EXPORT_C TScriptObject* CTestModuleIf::GetTestObjFromCaseDict(
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1610
        const TDesC& aObjectId) const
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1611
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1612
    RPointerArray<TScriptObject> *Objects = getDict();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1613
    if (NULL == Objects)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1614
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1615
        return NULL;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1616
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1617
    TInt count = Objects->Count();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1618
    for (TInt i = 0; i < count; i++)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1619
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1620
        if ((*Objects)[i]->ObjectId() == aObjectId)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1621
            {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1622
            // Found testcase with specified TestId
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1623
            return (*Objects)[i];
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1624
            }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1625
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1626
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1627
    return NULL;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1628
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1629
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1630
EXPORT_C TScriptObject::~TScriptObject()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1631
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1632
    delete iScript;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1633
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1634
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1635
// ================= OTHER EXPORTED FUNCTIONS =================================
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1636
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1637
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1638
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1639
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1640
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1641
    DESCRIPTION
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1642
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1643
    This module contains the implementation of CSTIFTestMeasurement class 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1644
    member functions.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1645
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1646
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1647
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1648
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1649
// ================= MEMBER FUNCTIONS =========================================
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1650
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1651
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1652
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1653
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1654
    Class: CSTIFTestMeasurement
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1655
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1656
    Method: CSTIFTestMeasurement
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1657
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1658
    Description: Default constructor
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1659
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1660
    C++ default constructor can NOT contain any code, that
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1661
    might leave.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1662
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1663
    Parameters: CTestModuleBase* aTestModuleBase: in: Pointer to STIF
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1664
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1665
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1666
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1667
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1668
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1669
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1670
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1671
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1672
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1673
CSTIFTestMeasurement::CSTIFTestMeasurement( CTestModuleBase* aTestModuleBase ) :
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1674
    iTestModuleBase( aTestModuleBase ),
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1675
    iMeasurementOption( 0 )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1676
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1677
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1678
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1679
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1680
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1681
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1682
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1683
    Class: CSTIFTestMeasurement
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1684
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1685
    Method: ConstructL
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1686
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1687
    Description: Symbian OS second phase constructor
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1688
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1689
    Symbian OS default constructor can leave.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1690
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1691
    Parameters: TSTIFMeasurement aType: in: Measurement type
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1692
                const TDesC& aConfigurationInfo: in: Configuration issues
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1693
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1694
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1695
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1696
    Errors/Exceptions: Leaves if HandleMeasurementProcess returns error code
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1697
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1698
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1699
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1700
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1701
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1702
void CSTIFTestMeasurement::ConstructL( TSTIFMeasurementType aType,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1703
                                    const TDesC& aConfigurationInfo )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1704
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1705
    // aType into struct here. This is compared to
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1706
    iMeasurementStruct.iMeasurementType = aType;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1707
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1708
    // Check that measurement is not disabled(This is given from UI level or
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1709
    // from TestFramework.ini file)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1710
    TInt ret( 0 );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1711
    ret = iTestModuleBase->TestModuleIf().GetMeasurementOptions( 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1712
                                                        iMeasurementOption );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1713
    if( ret != KErrNone )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1714
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1715
        __RDEBUG( ( _L( "GetMeasurementOptions() return an error[%d]" ), ret ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1716
        User::Leave( ret );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1717
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1718
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1719
    // Check that measurement is not disabled
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1720
    if( ( iMeasurementOption & EDisableAll ) == EDisableAll )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1721
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1722
        __RDEBUG( _L( "Measurement disable option [KStifMeasurementDisableAll] is given by user" ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1723
        return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1724
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1725
    if( ( ( iMeasurementOption & EMeasurement01 ) == EMeasurement01 ) && aType == KStifMeasurementPlugin01 )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1726
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1727
        __RDEBUG( _L( "Measurement disable option [KStifMeasurement01] is given by user" ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1728
        return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1729
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1730
    if( ( ( iMeasurementOption & EMeasurement02 ) == EMeasurement02 ) && aType == KStifMeasurementPlugin02 )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1731
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1732
        __RDEBUG( _L( "Measurement disable option [KStifMeasurement02] is given by user" ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1733
        return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1734
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1735
    if( ( ( iMeasurementOption & EMeasurement03 ) == EMeasurement03 ) && aType == KStifMeasurementPlugin03 )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1736
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1737
        __RDEBUG( _L( "Measurement disable option [KStifMeasurement03] is given by user" ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1738
        return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1739
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1740
    if( ( ( iMeasurementOption & EMeasurement04 ) == EMeasurement04 ) && aType == KStifMeasurementPlugin04 )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1741
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1742
        __RDEBUG( _L( "Measurement disable option [KStifMeasurement04] is given by user" ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1743
        return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1744
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1745
    if( ( ( iMeasurementOption & EMeasurement05 ) == EMeasurement05 ) && aType == KStifMeasurementPlugin05 )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1746
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1747
        __RDEBUG( _L( "Measurement disable option [KStifMeasurement05] is given by user" ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1748
        return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1749
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1750
    if( ( ( iMeasurementOption & EBappea ) == EBappea ) && aType == KStifMeasurementBappeaProfiler )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1751
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1752
        __RDEBUG( _L( "Measurement disable option [KStifMeasurementBappea] is given by user" ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1753
        return;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1754
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1755
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1756
    iMeasurementStruct.iConfigurationInfo = aConfigurationInfo;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1757
    iMeasurementStruct.iMeasurementOperation = KMeasurementNew;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1758
    iMeasurementStruct.iPointerToMeasurementModule = iTestModuleBase;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1759
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1760
    // Move measurement execution initialization forward to TestServer.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1761
    User::LeaveIfError( iTestModuleBase->iTestModuleIf->HandleMeasurementProcess(
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1762
            iMeasurementStruct ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1763
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1764
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1765
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1766
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1767
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1768
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1769
    Class: CSTIFTestMeasurement
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1770
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1771
    Method: NewL
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1772
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1773
    Description: Two-phased constructor.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1774
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1775
    Parameters: CTestModuleBase* aTestModuleBase: in: Pointer to STIF.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1776
                TSTIFMeasurement aType: in: Measurement type.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1777
                const TDesC& aConfigurationInfo: in: Configuration info.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1778
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1779
    Return Values: CSTIFTestMeasurement object.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1780
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1781
    Errors/Exceptions: Leaves if memory allocation fails
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1782
                       Leaves if ConstructL leaves
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1783
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1784
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1785
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1786
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1787
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1788
EXPORT_C CSTIFTestMeasurement* CSTIFTestMeasurement::NewL( 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1789
                                            CTestModuleBase* aTestModuleBase,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1790
                                            TSTIFMeasurementType aType, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1791
                                            const TDesC& aConfigurationInfo )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1792
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1793
    CSTIFTestMeasurement* self = 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1794
            new (ELeave) CSTIFTestMeasurement( aTestModuleBase );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1795
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1796
    CleanupStack::PushL( self );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1797
    self->ConstructL( aType, aConfigurationInfo );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1798
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1799
    CleanupStack::Pop();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1800
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1801
    return self;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1802
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1803
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1804
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1805
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1806
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1807
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1808
    Class: CSTIFTestMeasurement
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1809
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1810
    Method: ~CSTIFTestMeasurement
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1811
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1812
    Description: Destructor
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1813
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1814
    Parameters: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1815
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1816
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1817
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1818
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1819
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1820
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1821
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1822
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1823
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1824
CSTIFTestMeasurement::~CSTIFTestMeasurement()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1825
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1826
    // None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1827
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1828
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1829
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1830
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1831
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1832
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1833
    Class: CSTIFTestMeasurement
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1834
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1835
    Method: Start
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1836
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1837
    Description: Start commant for measurement.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1838
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1839
    Parameters: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1840
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1841
    Return Values: Symbian error code
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1842
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1843
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1844
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1845
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1846
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1847
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1848
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1849
EXPORT_C TInt CSTIFTestMeasurement::Start()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1850
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1851
    // Check that measurement is not disabled
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1852
    if( iMeasurementOption  == iMeasurementStruct.iMeasurementType )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1853
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1854
        __RDEBUG( ( _L( "Measurement with type[%d] is disabled by user" ), iMeasurementOption ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1855
        // Cannot return error code because this causes problems in
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1856
        // TestScripter and TestCombiner error handling. Now testing continue
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1857
        // without measurement.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1858
        return KErrNone;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1859
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1860
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1861
    iMeasurementStruct.iMeasurementOperation = KMeasurementStart;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1862
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1863
    // Move measurement start execution forward to TestServer.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1864
    return iTestModuleBase->iTestModuleIf->HandleMeasurementProcess(
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1865
                                                        iMeasurementStruct );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1866
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1867
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1868
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1869
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1870
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1871
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1872
    Class: CTestMeasurement
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1873
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1874
    Method: Stop
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1875
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1876
    Description: Stop command for measurement.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1877
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1878
    Parameters: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1879
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1880
    Return Values: Symbian error code
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1881
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1882
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1883
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1884
    Status: Approved
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1885
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1886
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1887
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1888
EXPORT_C TInt CSTIFTestMeasurement::Stop()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1889
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1890
    // Check that measurement is not disabled
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1891
    if( iMeasurementOption  == iMeasurementStruct.iMeasurementType )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1892
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1893
        __RDEBUG( ( _L( "Measurement with type[%d] is disabled by user" ), iMeasurementOption ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1894
        // Cannot return error code because this causes problems in
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1895
        // TestScripter and TestCombiner error handling. Now testing continue
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1896
        // without measurement.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1897
        return KErrNone;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1898
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1899
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1900
    iMeasurementStruct.iMeasurementOperation = KMeasurementStop;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1901
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1902
    // Move measurement stop execution forward to TestServer.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1903
    return iTestModuleBase->iTestModuleIf->HandleMeasurementProcess(
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1904
                                                        iMeasurementStruct );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1905
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1906
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1907
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
  1908
//  End of File