testexecfw/stf/stfui/uiengine/src/UIEngineEvent.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: CUIEngineEvent: This object executes test cases 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    15
* from STIF Test Framework.
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
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    19
// INCLUDE FILES
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    20
#include <e32base.h>
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    21
#include <e32svr.h>
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    22
#include <stifinternal/UIEngineContainer.h>
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    23
#include "UIEngineEvent.h"
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    24
#include "Logging.h"
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    25
#include <stfeventsystem.h>
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    26
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    27
// EXTERNAL DATA STRUCTURES
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    28
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    29
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    30
// EXTERNAL FUNCTION PROTOTYPES  
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    31
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    32
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    33
// CONSTANTS
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    34
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    35
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    36
// MACROS
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    37
#ifdef LOGGER
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    38
#undef LOGGER
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    39
#endif
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    40
#define LOGGER iUIEngine->iLogger
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    41
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
// LOCAL CONSTANTS AND MACROS
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    44
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    45
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    46
// MODULE DATA STRUCTURES
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    47
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    48
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    49
// LOCAL FUNCTION PROTOTYPES
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    50
// None
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
// FORWARD DECLARATIONS
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
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    56
// ==================== LOCAL FUNCTIONS ======================================= 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    57
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    58
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    59
// ================= MEMBER FUNCTIONS =========================================
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
/*
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
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    64
    Class: CUIEngineEvent
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    65
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    66
    Method: CUIEngineEvent
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    67
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    68
    Description: Default constructor
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    69
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    70
    C++ default constructor can NOT contain any code, that
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    71
    might leave.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    72
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    73
    Parameters: 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
    Return Values: None
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
    Errors/Exceptions: None
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
    Status: Draft
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    80
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
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    83
CUIEngineEvent::CUIEngineEvent( CUIEngine* aUIEngine) :
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    84
    CActive( CActive::EPriorityStandard ),
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    85
    iState( EEventIdle ),
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    86
    iUIEngine( aUIEngine ),
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    87
    iEventPckg( iEvent )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    88
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    89
    __TRACE( KPrint, ( _L( "CUIEngineEvent::CUIEngineEvent") ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    90
    __ASSERT_ALWAYS( aUIEngine, User::Panic( _L("Null pointer"), KErrGeneral ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    91
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    92
    CActiveScheduler::Add( this );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    93
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    94
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    95
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
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    99
    Class: CUIEngineEvent
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
    Method: ConstructL
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   102
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   103
    Description: Symbian OS second phase constructor
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   104
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   105
    Symbian OS default constructor can leave.
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
    Parameters: None
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
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   110
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   111
    Errors/Exceptions: Leaves if called Open method returns error
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   112
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   113
    Status: Approved
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
void CUIEngineEvent::ConstructL()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   118
    {
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
/*
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
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   126
    Class: CUIEngineEvent
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   127
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   128
    Method: NewL
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   129
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   130
    Description: Two-phased constructor.
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: CUIEngineContainer* CUIEngineContainer: in: Pointer to CUIEngineContainer Interface
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   133
                TTestInfo& aTestInfo: in: Test info
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   134
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   135
    Return Values: CUIEngineEvent* : Pointer to created runner object
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   136
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   137
    Errors/Exceptions: Leaves if memory allocation for CUIEngineEvent fails
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   138
                       Leaves if ConstructL leaves
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
    Status: Draft
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
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   143
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   144
CUIEngineEvent* CUIEngineEvent::NewL( CUIEngine* aUIEngine )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   145
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   146
    CUIEngineEvent* self =  
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   147
        new ( ELeave ) CUIEngineEvent( aUIEngine );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   148
    CleanupStack::PushL( self );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   149
    self->ConstructL();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   150
    CleanupStack::Pop();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   151
    return self;
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
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
/*
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
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   158
    Class: CUIEngineEvent
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   159
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   160
    Method: ~CUIEngineEvent
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
    Description: Destructor
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
    Parameters: 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
    Return Values: None
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
    Errors/Exceptions: None
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
    Status: Draft
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
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   174
CUIEngineEvent::~CUIEngineEvent()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   175
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   176
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   177
    __TRACE( KPrint, ( _L( "CUIEngineEvent::~CUIEngineEvent()") ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   178
    Cancel();
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
    if( iState == EEventWaitCompleted )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   181
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   182
        // Release event
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   183
        Release();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   184
        }
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
    if(iAsyncEventActive)
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
        delete iAsyncEventActive;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   189
        iAsyncEventActive = NULL;
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
    }
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
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
-------------------------------------------------------------------------------
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
    Class: CUIEngineEvent
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   198
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   199
    Method: Request
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   200
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   201
    Description: Request event.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   202
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   203
    Parameters: RTestCase& aTestCase: in: Handle to test case
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   204
                TFullTestResultPckg& aFullTestResultPckg: in: Handle to TFullTestResultPckg
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   205
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   206
    Return Values: None
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
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   209
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   210
    Status: Draft
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
*/
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   214
TInt CUIEngineEvent::Request( TDesC& aEventName, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   215
                               TUint32 aMaster, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   216
                               TUint32 aSlave )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   217
    {
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
    __TRACE( KPrint, ( _L( "CUIEngineEvent::Request %S"), &aEventName ) );
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
    iState = EEventRequested;
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
    iMaster = aMaster;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   224
    iSlave = aSlave; 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   225
    iEvent.SetType( TEventIf::EReqEvent );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   226
    iEvent.SetName( aEventName );
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
    // new implementation
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   229
    TInt err;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   230
    REventSystem ev;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   231
    RDebug::Print(_L("STF [ES]: CUIEngineEvent::Request() handling request event"));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   232
    TRAP(err, ev.RequestEventL(aEventName, reinterpret_cast<TInt>(iUIEngine)));
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
    /* old event implementation    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   235
    TRequestStatus status;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   236
    iUIEngine->iTestEngine.Event( iEventPckg, status ); 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   237
    User::WaitForRequest( status );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   238
    */// old event impementation - end
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
    if(err == KErrNone )
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
        __ASSERT_ALWAYS(iAsyncEventActive == NULL, User::Panic(_L("CUIEngineEvent::Request"), KErrAlreadyExists));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   243
        TRAP(err, iAsyncEventActive = CAsyncEventActive::NewL(reinterpret_cast<TInt>(iUIEngine)));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   244
        if(err != KErrNone)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   245
            return err;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   246
        // Enable event waiting
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   247
        iState = EEventWait;            
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   248
        iEvent.SetType( TEventIf::EWaitEvent );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   249
        SetActive();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   250
        RThread t;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   251
        TRAP(err, iAsyncEventActive->StartL(&iStatus, t.Id(), aEventName, NULL));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   252
        // old implementation iUIEngine->iTestEngine.Event( iEventPckg, iStatus ); 
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
    //return status.Int();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   255
    return err;
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
    }
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
/*
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
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   262
    Class: CUIEngineEvent
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   263
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   264
    Method: Release
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   265
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   266
    Description: Release event.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   267
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   268
    Parameters: RTestCase& aTestCase: in: Handle to test case
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   269
                TFullTestResultPckg& aFullTestResultPckg: in: Handle to TFullTestResultPckg
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
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   272
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   273
    Errors/Exceptions: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   274
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   275
    Status: Draft
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
-------------------------------------------------------------------------------
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
TInt CUIEngineEvent::Release()
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
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   282
    __TRACE( KPrint, ( _L( "CUIEngineEvent::Release %S"), &iEvent.Name() ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   283
    RDebug::Print(_L("STF [ES]: CUIEngineEvent::Release() handling release event"));
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
    // new implementation
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   286
    TInt err;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   287
    REventSystem ev;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   288
    TRAP(err, ev.ReleaseEventL(iEvent.Name(), reinterpret_cast<TInt>(iUIEngine)));
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
    Cancel();
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
    return err;
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
/* old implementation
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   295
    TRequestStatus status;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   296
    // Release event
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   297
    iState = EEventReleased;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   298
    iEvent.SetType( TEventIf::ERelEvent );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   299
    iUIEngine->iTestEngine.Event( iEventPckg, status ); 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   300
    User::WaitForRequest( status ); 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   301
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   302
    return status.Int();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   303
*/// end old implementation
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   304
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   305
    
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
-------------------------------------------------------------------------------
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   309
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   310
    Class: CUIEngineEvent
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
    Method: RunL
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
    Description: RunL handles completed requests.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   315
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   316
    Parameters: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   317
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   318
    Return Values: None
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
    Errors/Exceptions: Leaves if iStatus is not KErrNone, error is handled in
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   321
                       RunError called by CActiveObject
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
    Status: Draft
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
-------------------------------------------------------------------------------
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
void CUIEngineEvent::RunL()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   328
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   329
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   330
    __TRACE( KPrint, ( _L( "CUIEngineEvent::RunL") ) );
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
    if(iAsyncEventActive)
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
        delete iAsyncEventActive;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   335
        iAsyncEventActive = NULL;
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
    // Error handled in RunError
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   339
    User::LeaveIfError ( iStatus.Int() );
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
    switch( iState )
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
        case EEventWait:
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
            // Create response 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   346
            CStifTFwIfProt* resp = CStifTFwIfProt::NewL();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   347
            CleanupStack::PushL( resp );    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   348
            
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   349
            resp->CreateL();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   350
            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgResponse );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   351
            resp->AppendId( iSlave );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   352
            resp->AppendId( iMaster );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   353
            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   354
            resp->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRequest );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   355
            resp->Append( CStifTFwIfProt::EventStatus, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   356
                         CStifTFwIfProt::EEventSet );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   357
            resp->Append( iEvent.Name() );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   358
            if( iEvent.EventType() == TEventIf::EState )
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
                resp->Append( CStifTFwIfProt::EventStatusParams, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   361
                             CStifTFwIfProt::EEventType,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   362
                             CStifTFwIfProt::EventType, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   363
                             TEventIf::EState );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   364
                } 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   365
            // Send response
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   366
            iUIEngine->RemoteMsg( NULL, resp->Message() );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   367
            CleanupStack::PopAndDestroy( resp );    
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
            if( iEvent.EventType() == TEventIf::EIndication )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   370
                {            
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   371
                // Enable indication event waiting again
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   372
                iEvent.SetType( TEventIf::EWaitEvent );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   373
                SetActive();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   374
                // old implementation iUIEngine->iTestEngine.Event( iEventPckg, iStatus );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   375
                iAsyncEventActive = CAsyncEventActive::NewL(reinterpret_cast<TInt>(iUIEngine));
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   376
                // Enable event waiting
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   377
                RThread t;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   378
                iAsyncEventActive->StartL(&iStatus, t.Id(), iEvent.Name(), NULL);
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   379
                }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   380
            else  // state event, set only once for one request
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   381
                {                
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   382
                iState = EEventWaitCompleted;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   383
                }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   384
            }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   385
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   386
        case EEventWaitCompleted:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   387
        case EEventRequested:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   388
        case EEventReleased:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   389
        default:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   390
            __TRACE( KError, ( _L( "CUIEngineEvent::RunL: Illegal state %d"), iState ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   391
            User::Leave( KErrGeneral );
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
    }
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
/*
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
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   398
    Class: CUIEngineEvent
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
    Method: DoCancel
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   401
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   402
    Description: Cancel active request.
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   403
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   404
    Parameters: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   405
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   406
    Return Values: None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   407
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   408
    Errors/Exceptions: None
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
    Status: Draft
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
-------------------------------------------------------------------------------
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
void CUIEngineEvent::DoCancel()
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   415
    {
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
    __TRACE( KPrint, ( _L( "CUIEngineEvent::DoCancel") ) );
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
    if(iAsyncEventActive)
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   420
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   421
        iAsyncEventActive->Cancel();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   422
        delete iAsyncEventActive;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   423
        iAsyncEventActive = NULL;
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
    /* old implementation
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   426
    TRequestStatus status;
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
    switch( iState )
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
        case EEventWait:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   431
            // First cancel waiting
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   432
            iEvent.SetType( TEventIf::ECancelWait );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   433
            iUIEngine->iTestEngine.Event( iEventPckg, status );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   434
            User::WaitForRequest( status ); 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   435
            iState = EEventWaitCompleted;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   436
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   437
        default:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   438
            iUIEngine->iTestEngine.CancelAsyncRequest( ETestEngineEvent ); 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   439
            iState = EEventIdle;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   440
            break;
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
    */
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
/*
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   447
-------------------------------------------------------------------------------
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
    Class: CUIEngineEvent
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
    Method: RunError
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   452
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   453
    Description: Handle errors from STIF TestFramework
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
    Parameters: TInt aError: in: Symbian OS error: Error code
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   456
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   457
    Return Values: TInt KErrNone: Always returned KErrNone
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   458
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   459
    Errors/Exceptions: None
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
    Status: Draft
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
TInt CUIEngineEvent::RunError( TInt aError )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   466
    {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   467
    __TRACE( KPrint, ( _L( "CUIEngineEvent::RunError") ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   468
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   469
    switch( iState )
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   470
        {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   471
        case EEventRequested:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   472
        case EEventWait:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   473
        case EEventWaitCompleted:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   474
        case EEventReleased:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   475
            {
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   476
            // Create response
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   477
            CStifTFwIfProt* resp = NULL; 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   478
            TRAPD( err, resp = CStifTFwIfProt::NewL(); );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   479
            if( err != KErrNone )
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
                return KErrNone;
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
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   484
            resp->CreateL();
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   485
            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgResponse );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   486
            resp->AppendId( iSlave );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   487
            resp->AppendId( iMaster );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   488
            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   489
            resp->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRequest );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   490
            resp->Append( CStifTFwIfProt::EventStatus, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   491
                         CStifTFwIfProt::EEventError );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   492
            resp->Append( iEvent.Name() );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   493
            resp->Append( CStifTFwIfProt::EventStatusParams, 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   494
                             CStifTFwIfProt::EEventResult,
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   495
                             aError );
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
            // Send response
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   498
            iUIEngine->RemoteMsg( NULL, resp->Message() ); 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   499
            delete resp;
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
            break;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   502
        default:
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   503
            __TRACE( KError, ( _L( "CUIEngineEvent::RunError: Illegal state %d"), iState ) );
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   504
            return aError;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   505
        }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   506
    
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   507
    return KErrNone;
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   508
    }
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   509
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
/*
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
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   514
    DESCRIPTION
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   515
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   516
    CActiveTimer: This object prints running seconds to console screen.
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
*/
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
// ================= MEMBER FUNCTIONS =========================================
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   522
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
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   525
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   526
// ================= OTHER EXPORTED FUNCTIONS ================================= 
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   527
// None
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   528
8bb370ba6d1d contribute STF 1.0.0
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   529
//  End of File