|
1 /* |
|
2 * Copyright (c) 2006-2008 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: CCFActionExecutionHandler class implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "cfactionexecutionhandler.h" |
|
21 #include "cfactionpluginthread.h" |
|
22 #include "cftrace.h" |
|
23 |
|
24 CCFActionExecutionHandler::CCFActionExecutionHandler( |
|
25 CCFActionPlugInThread* aActionPluginThread ) : |
|
26 CActive( EPriorityStandard ), |
|
27 iActionPlugInThread( aActionPluginThread ) |
|
28 { |
|
29 FUNC_LOG; |
|
30 |
|
31 } |
|
32 |
|
33 CCFActionExecutionHandler* CCFActionExecutionHandler::NewLC( |
|
34 CCFActionPlugInThread* aActionPluginThread ) |
|
35 { |
|
36 FUNC_LOG; |
|
37 |
|
38 CCFActionExecutionHandler* self = new ( ELeave ) CCFActionExecutionHandler( |
|
39 aActionPluginThread ); |
|
40 CleanupStack::PushL( self ); |
|
41 self->ConstructL(); |
|
42 return self; |
|
43 } |
|
44 |
|
45 CCFActionExecutionHandler* CCFActionExecutionHandler::NewL( |
|
46 CCFActionPlugInThread* aActionPluginThread ) |
|
47 { |
|
48 FUNC_LOG; |
|
49 |
|
50 CCFActionExecutionHandler* self = CCFActionExecutionHandler::NewLC( |
|
51 aActionPluginThread ); |
|
52 CleanupStack::Pop(); // self; |
|
53 return self; |
|
54 } |
|
55 |
|
56 void CCFActionExecutionHandler::ConstructL() |
|
57 { |
|
58 FUNC_LOG; |
|
59 |
|
60 CActiveScheduler::Add( this ); // Add to scheduler |
|
61 } |
|
62 |
|
63 CCFActionExecutionHandler::~CCFActionExecutionHandler() |
|
64 { |
|
65 FUNC_LOG; |
|
66 |
|
67 Cancel(); // Cancel any request, if outstanding |
|
68 } |
|
69 |
|
70 void CCFActionExecutionHandler::DoCancel() |
|
71 { |
|
72 FUNC_LOG; |
|
73 |
|
74 iActionPlugInThread->CancelActionsWait(); |
|
75 } |
|
76 |
|
77 void CCFActionExecutionHandler::StartAsyncActionsWait() |
|
78 { |
|
79 FUNC_LOG; |
|
80 |
|
81 Cancel(); // Cancel any request, just to be sure |
|
82 |
|
83 iActionPlugInThread->WaitActions( iStatus ); |
|
84 SetActive(); |
|
85 } |
|
86 |
|
87 void CCFActionExecutionHandler::RunL() |
|
88 { |
|
89 FUNC_LOG; |
|
90 |
|
91 TInt status = iStatus.Int(); |
|
92 switch( status ) |
|
93 { |
|
94 case KErrNone: |
|
95 { |
|
96 // Execute actions from queue |
|
97 iActionPlugInThread->NewActionsAddedToQueueL(); |
|
98 break; |
|
99 } |
|
100 case KErrReleasePlugin: |
|
101 { |
|
102 // Delete plug-in implementation |
|
103 iActionPlugInThread->DeletePlugin(); |
|
104 break; |
|
105 } |
|
106 case KErrReloadPlugin: |
|
107 { |
|
108 // Reload plug-in implementation |
|
109 iActionPlugInThread->ConstructPluginL(); |
|
110 break; |
|
111 } |
|
112 default: |
|
113 { |
|
114 // Nothing to do here. |
|
115 break; |
|
116 } |
|
117 } |
|
118 } |
|
119 |
|
120 TInt CCFActionExecutionHandler::RunError( TInt aError ) |
|
121 { |
|
122 FUNC_LOG; |
|
123 |
|
124 return KErrNone; |
|
125 } |