149 // Post an event to the available plugins. |
149 // Post an event to the available plugins. |
150 // |
150 // |
151 // Status : Approved |
151 // Status : Approved |
152 // --------------------------------------------------------- |
152 // --------------------------------------------------------- |
153 // |
153 // |
154 CSCPParamObject* CSCPPluginManager::PostEvent( TInt aID, CSCPParamObject& aParam ) |
154 CSCPParamObject* CSCPPluginManager :: PostEvent(TInt aID, CSCPParamObject& aParam) { |
155 { |
|
156 Dprint(_L("[CSCPPluginManager]-> PostEvent() >>>")); |
155 Dprint(_L("[CSCPPluginManager]-> PostEvent() >>>")); |
157 // If the plugins aren't loaded, load them here |
156 // If the plugins aren't loaded, load them here |
158 TBool okToPost = ETrue; |
157 TBool okToPost = ETrue; |
159 |
158 TInt lErr = KErrNone; |
160 if ( !iPluginsLoaded ) |
159 |
161 { |
160 if(!iPluginsLoaded) { |
162 TRAPD( err, LoadPluginsL() ); |
161 TRAP(lErr, LoadPluginsL()); |
163 if ( err != KErrNone ) |
162 |
164 { |
163 if(lErr != KErrNone) { |
165 Dprint( (_L("CSCPPluginManager::PostEvent(): ERROR loading plugins: %d"), err )); |
164 Dprint((_L("CSCPPluginManager::PostEvent(): ERROR loading plugins: %d"), lErr)); |
166 okToPost = EFalse; |
165 okToPost = EFalse; |
167 } |
|
168 } |
166 } |
169 |
167 } |
|
168 |
|
169 lErr = KErrNone; |
170 CSCPParamObject* reply = NULL; |
170 CSCPParamObject* reply = NULL; |
171 |
171 |
172 if ( okToPost ) |
172 TRAP(lErr, reply = CSCPParamObject :: NewL()); |
173 { |
173 |
174 // Send the incoming event to all plugins |
174 if(lErr != KErrNone) { |
175 TBool continueProcessing = ETrue; |
175 return NULL; |
176 |
176 } |
177 for ( TInt i = 0; i < iPlugins.Count(); i++ ) |
177 |
178 { |
178 lErr = KErrNone; |
|
179 TInt lPolicyRunStatus = KErrNone; |
|
180 |
|
181 if(okToPost) { |
|
182 // Send the incoming event to all plugins |
|
183 for(TInt i = 0; i < iPlugins.Count(); i++) { |
179 // The method shouldn't leave, but make sure |
184 // The method shouldn't leave, but make sure |
180 TRAPD( err, reply = iPlugins[i]->HandleEvent( aID, aParam ) ); |
185 TRAP(lErr, iPlugins[i]->HandleEventL(aID, aParam, *reply)); |
181 if ( err != KErrNone ) |
186 |
182 { |
187 if(reply->Get(KSCPParamStatus, lPolicyRunStatus) == KErrNone) { |
183 // Plugin error |
188 if(lPolicyRunStatus != KErrNone) { |
184 continue; |
189 lErr = lPolicyRunStatus; |
185 } |
190 } |
186 |
191 } |
187 // Check reply |
|
188 if ( reply != NULL ) |
|
189 { |
|
190 Dprint(_L("[CSCPPluginManager]-> The event '%d' was consumed..."), aID); |
|
191 continueProcessing = EFalse; |
|
192 } |
|
193 else |
|
194 { |
|
195 // No action requested |
|
196 } |
|
197 |
|
198 if ( !continueProcessing ) |
|
199 { |
|
200 break; // Event consumed, don't continue |
|
201 } |
|
202 } |
|
203 } |
192 } |
|
193 |
|
194 reply->Set(KSCPParamStatus, lErr); |
|
195 } |
204 |
196 |
205 Dprint(_L("[CSCPPluginManager]-> PostEvent() okToPost=%d<<<"), okToPost); |
197 Dprint(_L("[CSCPPluginManager]-> PostEvent() okToPost=%d<<<"), okToPost); |
206 return reply; |
198 return reply; |
207 } |
199 } |
208 |
200 |
209 // --------------------------------------------------------- |
201 // --------------------------------------------------------- |
210 // void CSCPPluginManager::~CSCPPluginManager() |
202 // void CSCPPluginManager::~CSCPPluginManager() |
211 // Destructor |
203 // Destructor |
212 // |
204 // |