|
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 "T_DataWsGraphicMsgFixedBase.h" |
|
19 |
|
20 /*@{*/ |
|
21 /// Commands |
|
22 _LIT(KCmdPckg, "Pckg"); |
|
23 _LIT(KCmdSize, "Size"); |
|
24 _LIT(KCmdTypeId, "TypeId"); |
|
25 |
|
26 // Fields |
|
27 _LIT(KFldExpected, "expected"); |
|
28 |
|
29 /// Logging |
|
30 _LIT(KLogNotExpectedValue, "Not expected value"); |
|
31 /*@}*/ |
|
32 |
|
33 ////////////////////////////////////////////////////////////////////// |
|
34 // Construction/Destruction |
|
35 ////////////////////////////////////////////////////////////////////// |
|
36 |
|
37 CT_DataWsGraphicMsgFixedBase::CT_DataWsGraphicMsgFixedBase() |
|
38 : CDataWrapperBase() |
|
39 { |
|
40 } |
|
41 |
|
42 CT_DataWsGraphicMsgFixedBase::~CT_DataWsGraphicMsgFixedBase() |
|
43 { |
|
44 } |
|
45 |
|
46 /** |
|
47 * Process a command read from the ini file |
|
48 * |
|
49 * @param aCommand the command to process |
|
50 * @param aSection the entry in the ini file requiring the command to be processed |
|
51 * @param aAsyncErrorIndex index of command. used for async calls |
|
52 * |
|
53 * @return ETrue if the command is processed |
|
54 */ |
|
55 TBool CT_DataWsGraphicMsgFixedBase::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/) |
|
56 { |
|
57 TBool ret=ETrue; |
|
58 |
|
59 if ( aCommand==KCmdPckg ) |
|
60 { |
|
61 DoCmdPckg(); |
|
62 } |
|
63 else if ( aCommand==KCmdSize ) |
|
64 { |
|
65 DoCmdSize(aSection); |
|
66 } |
|
67 else if ( aCommand==KCmdTypeId ) |
|
68 { |
|
69 DoCmdTypeId(aSection); |
|
70 } |
|
71 else |
|
72 { |
|
73 ret=EFalse; |
|
74 } |
|
75 |
|
76 return ret; |
|
77 } |
|
78 |
|
79 void CT_DataWsGraphicMsgFixedBase::DoCmdPckg() |
|
80 { |
|
81 INFO_PRINTF1(_L("execute Pckg()")); |
|
82 iPckg.Set(GetWsGraphicMsgFixedBase()->Pckg()); |
|
83 } |
|
84 |
|
85 void CT_DataWsGraphicMsgFixedBase::DoCmdSize(const TDesC& aSection) |
|
86 { |
|
87 TInt size=GetWsGraphicMsgFixedBase()->Size(); |
|
88 INFO_PRINTF2(_L("execute Size() = %d"), size); |
|
89 |
|
90 TInt expected; |
|
91 if ( GetIntFromConfig(aSection, KFldExpected, expected) ) |
|
92 { |
|
93 if ( expected!=size ) |
|
94 { |
|
95 ERR_PRINTF1(KLogNotExpectedValue); |
|
96 SetBlockResult(EFail); |
|
97 } |
|
98 } |
|
99 } |
|
100 |
|
101 void CT_DataWsGraphicMsgFixedBase::DoCmdTypeId(const TDesC& aSection) |
|
102 { |
|
103 TUid uid=GetWsGraphicMsgFixedBase()->TypeId(); |
|
104 INFO_PRINTF2(_L("execute TypeId() = 0x%x"), uid.iUid); |
|
105 |
|
106 TInt expected; |
|
107 if ( GetHexFromConfig(aSection, KFldExpected, expected) ) |
|
108 { |
|
109 if ( expected!=uid.iUid ) |
|
110 { |
|
111 ERR_PRINTF1(KLogNotExpectedValue); |
|
112 SetBlockResult(EFail); |
|
113 } |
|
114 } |
|
115 } |