|
1 /* |
|
2 * Copyright (c) 2005 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 |
|
19 |
|
20 |
|
21 // MCE API |
|
22 |
|
23 #include <MCEManager.h> |
|
24 #include <MCERefer.h> |
|
25 #include "MCETestUIEngineDefaultValues.h" |
|
26 #include "CMCETestUIEngine.h" |
|
27 #include "CMCETestUIEngineRefer.h" |
|
28 |
|
29 //#include "TMCETestUIEngineCmdTerminateEvent.h" |
|
30 //#include "TMCETestUIEngineCmdUpdateSession.h" |
|
31 #include "TMCETestUIEngineCmdDeleteEvent.h" |
|
32 #include "TMCETestUIEngineCmdCreateEvent.h" |
|
33 |
|
34 |
|
35 // ============================ MEMBER FUNCTIONS =============================== |
|
36 |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CMCETestUIEngineRefer::CMCETestUIEngineRefer |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 CMCETestUIEngineRefer::CMCETestUIEngineRefer( |
|
43 CMCETestUIEngine& aEngine ) |
|
44 : iEngine( aEngine ) |
|
45 { |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CMCETestUIEngineRefer::BaseConstructL() |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 void CMCETestUIEngineRefer::BaseConstructL() |
|
53 { |
|
54 } |
|
55 |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CMCETestUIEngineRefer::~CMCETestUIEngineRefer |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 EXPORT_C CMCETestUIEngineRefer::~CMCETestUIEngineRefer() |
|
62 { |
|
63 iCommands.ResetAndDestroy(); |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CMCETestUIEngineRefer::Event |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 EXPORT_C CMceRefer& CMCETestUIEngineRefer::Refer() |
|
71 { |
|
72 return *iRefer; |
|
73 } |
|
74 |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CMCETestUIEngineRefer::GetCommands |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 const RPointerArray<TMCETestUIEngineCmdBase>& |
|
81 CMCETestUIEngineRefer::GetCommandsL() |
|
82 { |
|
83 User::LeaveIfError( iRefer ? KErrNone : KErrNotReady ); |
|
84 |
|
85 TInt state = iRefer->State(); |
|
86 |
|
87 |
|
88 switch( state ) |
|
89 { |
|
90 case CMceRefer::EIdle: |
|
91 { |
|
92 |
|
93 iCommands.Append( new (ELeave) |
|
94 TMCETestUIEngineCmdDeleteRefer( iEngine, *this ) ); |
|
95 break; |
|
96 } |
|
97 case CMceRefer::EPending: |
|
98 { |
|
99 iCommands.Append( new (ELeave) |
|
100 TMCETestUIEngineCmdDeleteRefer( iEngine, *this ) ); |
|
101 break; |
|
102 } |
|
103 case CMceRefer::EAccepted: |
|
104 { |
|
105 iCommands.Append( new (ELeave) |
|
106 TMCETestUIEngineCmdCreateSessionFromRefer( iEngine, *this ) ); |
|
107 break; |
|
108 iCommands.Append( new (ELeave) |
|
109 TMCETestUIEngineCmdDeleteRefer( iEngine, *this ) ); |
|
110 |
|
111 break; |
|
112 } |
|
113 case CMceRefer::ETerminated: |
|
114 { |
|
115 iCommands.Append( new (ELeave) |
|
116 TMCETestUIEngineCmdDeleteRefer( iEngine, *this ) ); |
|
117 break; |
|
118 } |
|
119 default: |
|
120 { |
|
121 break; |
|
122 } |
|
123 } |
|
124 |
|
125 return iCommands; |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CMCETestUIEngineRefer::State |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 EXPORT_C const TDesC& CMCETestUIEngineRefer::State() |
|
133 { |
|
134 if ( !iRefer ) |
|
135 { |
|
136 User::Panic( _L16("CMCETestUIEngine"), 0 ); |
|
137 } |
|
138 |
|
139 TInt state = iRefer->State(); |
|
140 |
|
141 switch( state ) |
|
142 { |
|
143 case CMceRefer::EIdle: |
|
144 return KReferStateIdle; |
|
145 break; |
|
146 case CMceRefer::EPending: |
|
147 return KReferStatePending; |
|
148 break; |
|
149 case CMceRefer::EAccepted: |
|
150 return KReferStateAccepted; |
|
151 break; |
|
152 case CMceRefer::ETerminated: |
|
153 return KReferStateTerminated; |
|
154 break; |
|
155 default: |
|
156 return KReferStateUnknown; |
|
157 break; |
|
158 } |
|
159 } |
|
160 |