1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "DataWrapperActive.h" |
|
19 |
|
20 /*@{*/ |
|
21 /// Constant Literals used. |
|
22 _LIT(KCmdCancel, "Cancel"); |
|
23 _LIT(KCmdiStatus, "iStatus"); |
|
24 |
|
25 _LIT(KFldExpected, "expected"); |
|
26 /*@}*/ |
|
27 |
|
28 CDataWrapperActive::CDataWrapperActive() |
|
29 : CDataWrapperBase() |
|
30 /** |
|
31 * Protected constructor |
|
32 */ |
|
33 { |
|
34 } |
|
35 |
|
36 CDataWrapperActive::~CDataWrapperActive() |
|
37 /** |
|
38 * Protected destructor |
|
39 */ |
|
40 { |
|
41 } |
|
42 |
|
43 /** |
|
44 * Process a command read from the ini file |
|
45 * |
|
46 * @param aDataWrapper test step requiring command to be processed |
|
47 * @param aCommand the command to process |
|
48 * @param aSection the entry in the ini file requiring the command to be processed |
|
49 * |
|
50 * @return ETrue if the command is processed |
|
51 */ |
|
52 TBool CDataWrapperActive::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/) |
|
53 { |
|
54 TBool ret=ETrue; |
|
55 |
|
56 if ( aCommand==KCmdCancel ) |
|
57 { |
|
58 DoCmdCancel(); |
|
59 } |
|
60 else if ( aCommand==KCmdiStatus ) |
|
61 { |
|
62 DoCmdiStatus(aSection); |
|
63 } |
|
64 else |
|
65 { |
|
66 ret=EFalse; |
|
67 } |
|
68 |
|
69 return ret; |
|
70 } |
|
71 |
|
72 void CDataWrapperActive::DoCmdCancel() |
|
73 { |
|
74 INFO_PRINTF1(_L("++CActive::Cancel()")); |
|
75 GetActive()->Cancel(); |
|
76 DecOutstanding(); |
|
77 INFO_PRINTF1(_L("--CActive::Cancel()")); |
|
78 } |
|
79 |
|
80 void CDataWrapperActive::DoCmdiStatus(const TDesC& aSection) |
|
81 { |
|
82 INFO_PRINTF1(_L("++CActive::iStatus")); |
|
83 TRequestStatus actual=GetActive()->iStatus; |
|
84 INFO_PRINTF2(_L("iStatus=%d"), actual.Int()); |
|
85 |
|
86 TInt expected; |
|
87 if ( GetIntFromConfig(aSection, KFldExpected(), expected) ) |
|
88 { |
|
89 if ( expected!=actual.Int() ) |
|
90 { |
|
91 ERR_PRINTF1(_L("Expected value does not match actual")); |
|
92 SetBlockResult(EFail); |
|
93 } |
|
94 } |
|
95 INFO_PRINTF1(_L("--CActive::iStatus")); |
|
96 } |
|