|
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 the License "Symbian Foundation License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "T_DataAnim.h" |
|
19 #include "T_GraphicsUtil.h" |
|
20 #include "T_AnimDef.h" |
|
21 |
|
22 #define KMaxBufSize 250 |
|
23 |
|
24 /*@{*/ |
|
25 _LIT(KDataClassname, "RAnim"); |
|
26 |
|
27 /// Fields |
|
28 _LIT(KFldAnimDll, "animdll"); |
|
29 _LIT(KFldWin, "win"); |
|
30 _LIT(KFldSprite, "sprite"); |
|
31 _LIT(KFldType, "type"); |
|
32 _LIT(KFldParam, "param"); |
|
33 _LIT(KFldIpcArgs, "ipcargs"); |
|
34 _LIT(KFldOpcode, "opcode"); |
|
35 _LIT(KFldArgs, "args"); |
|
36 _LIT(KFldIpcArg, "ipcargs%d"); |
|
37 _LIT(KFldExpectedIpcArg, "expected_ipcargs%d"); |
|
38 |
|
39 // enum |
|
40 _LIT(KEAnimWindows, "EKWindowAnim"); |
|
41 _LIT(KEAnimSprite, "EKSpriteAnim"); |
|
42 _LIT(KEAnimFreeTimer, "EKFreeTimerWindowAnim"); |
|
43 |
|
44 |
|
45 _LIT(KEAnimCmdSync, "ECmdSync"); |
|
46 _LIT(KEAnimCmdTestWithoutPara, "ECmdTestWithoutPara"); |
|
47 _LIT(KEAnimCmdTestWithPara, "ECmdTestWithPara"); |
|
48 _LIT(KEAnimCmdGetLast, "ECmdGetLast"); |
|
49 _LIT(KEAnimCmdGetAnimInterval, "ECmdGetAnimInterval"); |
|
50 |
|
51 |
|
52 // animate interval |
|
53 _LIT(KFldCheckAnimateInterval, "CheckAnimateInterval"); |
|
54 _LIT(KFldAnimIpcArgSlot, "AnimIpcArgSlot"); |
|
55 _LIT(KFldAnimIntervalMin, "AnimIntervalMin"); |
|
56 _LIT(KFldAnimIntervalMax, "AnimIntervalMax"); |
|
57 |
|
58 _LIT(KIpcArgNothing, "ENothing"); |
|
59 |
|
60 /// Commands |
|
61 _LIT(KCmdnew, "new"); |
|
62 _LIT(KCmdDestructorGeneral, "~"); |
|
63 _LIT(KCmdDestructor, "~RAnim"); |
|
64 _LIT(KCmdConstruct, "Construct"); |
|
65 _LIT(KCmdCommandReply, "CommandReply"); |
|
66 _LIT(KCmdCommand, "Command"); |
|
67 _LIT(KCmdAsyncCommandReply, "AsyncCommandReply"); |
|
68 _LIT(KCmdDestroy, "Destroy"); |
|
69 _LIT(KCmdClose, "Close"); |
|
70 |
|
71 /// Logging |
|
72 _LIT(KLogErrNum, "Error=%d"); |
|
73 _LIT(KLogErrMissingPara, "Missing parameter '%S'"); |
|
74 _LIT(KLogInfoCmdnewL1, "execute new RAnim(RAnimDll &)"); |
|
75 _LIT(KLogInfoCmdnewL2, "execute new RAnim()"); |
|
76 _LIT(KLogErrConstruct, "Construct return err = %d"); |
|
77 _LIT(KLogInfoCmdConstruct1, "execute RAnim::Construct(const RWindowBase &, TInt, const TDesC8 &)"); |
|
78 _LIT(KLogInfoCmdConstruct2, "execute RAnim::Construct(const RWindowBase &, TInt, const TDesC8 &, const TIpcArgs &)"); |
|
79 _LIT(KLogInfoCmdConstruct3, "execute RAnim::Construct(const RWsSprite &, TInt, const TDesC8 &)"); |
|
80 _LIT(KLogInfoCmdConstruct4, "execute RAnim::Construct(const RWsSprite &, TInt, const TDesC8 &, const TIpcArgs &)"); |
|
81 _LIT(KLogErrCommandReply, "CommandReply return err = %d"); |
|
82 _LIT(KLogInfoCmdCommandReply1, "execute RAnim::CommandReply(TInt)"); |
|
83 _LIT(KLogInfoCmdCommandReply2, "execute RAnim::CommandReply(TInt, const TPtrC8 &)"); |
|
84 _LIT(KLogInfoCmdCommandReply3, "execute RAnim::CommandReply(TInt, const TDesC8 &, const TIpcArgs &)"); |
|
85 _LIT(KLogErrCommand, "Command return err = %d"); |
|
86 _LIT(KLogErrCheckIpcValue, "Ipc arg compare fail expected=%S actual=%S"); |
|
87 _LIT(KLogErrIpcValue, "Ipc arg return value err"); |
|
88 |
|
89 _LIT(KLogErrAnimInterval, "Animate interval error expected min=%d max=%d"); |
|
90 |
|
91 _LIT(KLogInfoAnimInterval, "Animate interval actual min=%d max=%d"); |
|
92 |
|
93 _LIT(KLogInfoCmdCommand1, "execute RAnim::Command(TInt, const TPtrC8 &)"); |
|
94 _LIT(KLogInfoCmdCommand2, "execute RAnim::Command(TInt)"); |
|
95 _LIT(KLogInfoCmdAsyncCommandReply1, "execute RAnim::AsyncCommandReply(TRequestStatus &, TInt, const TIpcArgs &)"); |
|
96 |
|
97 _LIT(KLogInfoCmdClose1, "execute RAnim::Close()"); |
|
98 _LIT(KLogInfoCmdDestroy1, "execute RAnim::Destroy()"); |
|
99 _LIT(KLogInfoCmdDestructor1, "execute ~RAnim()"); |
|
100 /*@}*/ |
|
101 |
|
102 CT_DataAnim* CT_DataAnim::NewL() |
|
103 { |
|
104 CT_DataAnim* ret = new (ELeave) CT_DataAnim(); |
|
105 CleanupStack::PushL(ret); |
|
106 ret->ConstructL(); |
|
107 CleanupStack::Pop(ret); |
|
108 return ret; |
|
109 } |
|
110 |
|
111 CT_DataAnim::CT_DataAnim() |
|
112 : iActiveCallback(NULL) |
|
113 ,iAnim(NULL) |
|
114 { |
|
115 } |
|
116 |
|
117 void CT_DataAnim::ConstructL() |
|
118 { |
|
119 iActiveCallback = CActiveCallback::NewL(*this); |
|
120 iSendBuf.CreateL(KMaxBufSize); |
|
121 |
|
122 for (TInt i=0;i<KIpcArgNum;i++) |
|
123 iIpcBuf[i].CreateL(KMaxBufSize); |
|
124 } |
|
125 |
|
126 CT_DataAnim::~CT_DataAnim() |
|
127 { |
|
128 DestroyData(); |
|
129 delete iActiveCallback; |
|
130 iActiveCallback = NULL; |
|
131 |
|
132 iSendBuf.Close(); |
|
133 |
|
134 for (TInt i=0;i<KIpcArgNum;i++) |
|
135 iIpcBuf[i].Close(); |
|
136 } |
|
137 |
|
138 TAny* CT_DataAnim::GetObject() |
|
139 { |
|
140 return iAnim; |
|
141 } |
|
142 |
|
143 void CT_DataAnim::SetObjectL(TAny* aAny) |
|
144 { |
|
145 DestroyData(); |
|
146 iAnim = static_cast<T_RAnimChild*> (aAny); |
|
147 } |
|
148 |
|
149 void CT_DataAnim::DisownObjectL() |
|
150 { |
|
151 iAnim = NULL; |
|
152 } |
|
153 |
|
154 void CT_DataAnim::DestroyData() |
|
155 { |
|
156 DoCmdDestructor(); |
|
157 } |
|
158 |
|
159 /** |
|
160 * Process a command read from the ini file |
|
161 * |
|
162 * @param aCommand the command to process |
|
163 * @param aSection the entry in the ini file requiring the command to be processed |
|
164 * @param aAsyncErrorIndex index of command. used for async calls |
|
165 * |
|
166 * @return ETrue if the command is processed |
|
167 */ |
|
168 TBool CT_DataAnim::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex) |
|
169 { |
|
170 TBool ret = ETrue; |
|
171 |
|
172 if ( aCommand==KCmdDestructorGeneral || aCommand==KCmdDestructor ) |
|
173 { |
|
174 DoCmdDestructor(); |
|
175 } |
|
176 else if ( aCommand==KCmdnew || aCommand==KDataClassname ) |
|
177 { |
|
178 DoCmdnewL(aSection); |
|
179 } |
|
180 else if ( aCommand==KCmdConstruct ) |
|
181 { |
|
182 DoCmdConstructL(aSection); |
|
183 } |
|
184 else if ( aCommand==KCmdCommandReply ) |
|
185 { |
|
186 DoCmdCommandReply(aSection); |
|
187 } |
|
188 else if ( aCommand==KCmdCommand ) |
|
189 { |
|
190 DoCmdCommand(aSection); |
|
191 } |
|
192 else if ( aCommand==KCmdAsyncCommandReply ) |
|
193 { |
|
194 DoCmdAsyncCommandReply(aSection, aAsyncErrorIndex); |
|
195 } |
|
196 else if ( aCommand==KCmdDestroy ) |
|
197 { |
|
198 DoCmdDestroy(); |
|
199 } |
|
200 else if ( aCommand==KCmdClose ) |
|
201 { |
|
202 DoCmdClose(); |
|
203 } |
|
204 else |
|
205 { |
|
206 ret=EFalse; |
|
207 } |
|
208 |
|
209 return ret; |
|
210 } |
|
211 |
|
212 void CT_DataAnim::DoCmdnewL(const TDesC& aSection) |
|
213 { |
|
214 DestroyData(); |
|
215 |
|
216 // Get test data for command input parameter(s) |
|
217 TPtrC datDllName; |
|
218 RAnimDll* animDll = NULL; |
|
219 if ( GetStringFromConfig(aSection, KFldAnimDll, datDllName) ) |
|
220 { |
|
221 animDll = static_cast<RAnimDll*>(GetDataObjectL(datDllName)); |
|
222 } |
|
223 |
|
224 TInt err = KErrNone; |
|
225 if ( animDll ) |
|
226 { |
|
227 // Execute command and log parameters |
|
228 INFO_PRINTF1(KLogInfoCmdnewL1); |
|
229 iAnim = new (ELeave) T_RAnimChild(*animDll) ; |
|
230 } |
|
231 else |
|
232 { |
|
233 // Execute command and log parameters |
|
234 INFO_PRINTF1(KLogInfoCmdnewL2); |
|
235 iAnim = new (ELeave) T_RAnimChild(); |
|
236 } |
|
237 } |
|
238 |
|
239 TBool CT_DataAnim::GetIpcArg(const TDesC& aSection) |
|
240 { |
|
241 TBool argexist=EFalse; |
|
242 |
|
243 TBuf <100> field; |
|
244 TPtrC val; |
|
245 for (TInt i=0;i<KIpcArgNum;i++) |
|
246 { |
|
247 field.Format(KFldIpcArg,i); |
|
248 if ( GetStringFromConfig(aSection, field, val)) |
|
249 { |
|
250 if (val.Compare(KIpcArgNothing)==0) |
|
251 iIpcArgs.Set(i,TIpcArgs::ENothing); |
|
252 else |
|
253 { |
|
254 iIpcBuf[i].Copy(val); |
|
255 iIpcArgs.Set(i,&iIpcBuf[i]); |
|
256 } |
|
257 argexist=ETrue; |
|
258 } |
|
259 else |
|
260 break; |
|
261 |
|
262 } |
|
263 return argexist; |
|
264 } |
|
265 |
|
266 // check is the time interval of CAnim::Animate() is in specified scope |
|
267 TBool CT_DataAnim::CheckAnimateInterval(const TDesC& aSection) |
|
268 { |
|
269 TBool result=EFalse; |
|
270 |
|
271 TInt slot,min,max,find; |
|
272 TInt amin,amax; |
|
273 |
|
274 _LIT(KSpace," "); |
|
275 |
|
276 // get IPC args slot index |
|
277 if ( GetIntFromConfig(aSection, KFldAnimIpcArgSlot,slot)) |
|
278 { |
|
279 // get expected min/max interval of Animate() |
|
280 if ( GetIntFromConfig(aSection, KFldAnimIntervalMin,min) && |
|
281 GetIntFromConfig(aSection, KFldAnimIntervalMax,max) ) |
|
282 { |
|
283 find=iIpcBuf[slot].Find(KSpace); // get actual min/max interval of Animate() |
|
284 if (find>0 ) |
|
285 { |
|
286 // get actual min interval |
|
287 TPtrC val1=iIpcBuf[slot].Left(find); |
|
288 TLex lex1(val1); |
|
289 lex1.Val(amin); |
|
290 |
|
291 // get actual max interval |
|
292 TPtrC val2=iIpcBuf[slot].Mid(find+1); |
|
293 TLex lex2(val2); |
|
294 lex2.Val(amax); |
|
295 |
|
296 INFO_PRINTF3(KLogInfoAnimInterval,amin,amax); |
|
297 |
|
298 // check is the interval in expected scope |
|
299 if (amin<min || amax>max) |
|
300 { |
|
301 ERR_PRINTF3(KLogErrAnimInterval, min,max); |
|
302 } |
|
303 else |
|
304 result=ETrue; |
|
305 } |
|
306 } |
|
307 } |
|
308 |
|
309 return result; |
|
310 } |
|
311 TBool CT_DataAnim::CheckIpcArg(const TDesC& aSection) |
|
312 { |
|
313 TBool result=ETrue; |
|
314 |
|
315 // check animate interval |
|
316 TInt checkanim=0; |
|
317 if ( GetIntFromConfig(aSection, KFldCheckAnimateInterval, checkanim) |
|
318 && checkanim) |
|
319 { |
|
320 return CheckAnimateInterval(aSection); |
|
321 } |
|
322 |
|
323 TBuf <100> field; |
|
324 TPtrC val; |
|
325 |
|
326 // check ipc expected value |
|
327 for (TInt i=0;i<KIpcArgNum;i++) |
|
328 { |
|
329 field.Format(KFldExpectedIpcArg,i); |
|
330 if ( GetStringFromConfig(aSection, field, val) && |
|
331 val.Compare(iIpcBuf[i])!=0) |
|
332 { |
|
333 ERR_PRINTF3(KLogErrCheckIpcValue, &val, &iIpcBuf[i]); |
|
334 result=EFalse; |
|
335 break; |
|
336 } |
|
337 } |
|
338 return result; |
|
339 } |
|
340 |
|
341 void CT_DataAnim::DoCmdConstructL(const TDesC& aSection) |
|
342 { |
|
343 TInt err = KErrNone; |
|
344 |
|
345 // Get test data for command input parameter(s) |
|
346 TBool dataOk = ETrue; |
|
347 |
|
348 // get "const RWindowBase &aDevice" or "const RWsSprite &aDevice" |
|
349 TPtrC datWinName; |
|
350 RWindowBase* win = NULL; |
|
351 TPtrC datSpriteName; |
|
352 RWsSprite* sprite = NULL; |
|
353 if ( GetStringFromConfig(aSection, KFldWin, datWinName)) |
|
354 { |
|
355 win = static_cast<RWindowBase*>(GetDataObjectL(datWinName)); |
|
356 } |
|
357 else if ( GetStringFromConfig(aSection, KFldSprite, datSpriteName)) |
|
358 { |
|
359 sprite = static_cast<RWsSprite*>(GetDataObjectL(datSpriteName)); |
|
360 } |
|
361 if (!win && !sprite ) |
|
362 { |
|
363 dataOk = EFalse; |
|
364 ERR_PRINTF2(KLogErrMissingPara, &KFldWin); |
|
365 ERR_PRINTF2(KLogErrMissingPara, &KFldSprite); |
|
366 } |
|
367 |
|
368 //get "TInt aType" |
|
369 TInt datType; |
|
370 if ( !ReadAnimType(aSection, KFldType, datType)) |
|
371 { |
|
372 dataOk = EFalse; |
|
373 ERR_PRINTF2(KLogErrMissingPara, &KFldType); |
|
374 } |
|
375 |
|
376 // get "const TDesC8 &aArgs" |
|
377 TPtrC inputStr; |
|
378 TBool argexist=EFalse; |
|
379 if( GetStringFromConfig(aSection, KFldParam, inputStr)) |
|
380 { |
|
381 CopyToSendBuf(inputStr); |
|
382 argexist=ETrue; |
|
383 } |
|
384 |
|
385 if (!argexist) |
|
386 { |
|
387 dataOk = EFalse; |
|
388 ERR_PRINTF2(KLogErrMissingPara, &KFldParam); |
|
389 } |
|
390 |
|
391 // get "const TIpcArgs &aIpcArgs" |
|
392 TBool ipcexist= EFalse; |
|
393 if ( GetIpcArg(aSection)) |
|
394 ipcexist = ETrue; |
|
395 |
|
396 if ( !dataOk ) |
|
397 { |
|
398 SetBlockResult(EFail); |
|
399 } |
|
400 else |
|
401 { |
|
402 // Execute command and log parameters |
|
403 if (win ) |
|
404 { |
|
405 if (!ipcexist) |
|
406 { |
|
407 INFO_PRINTF1(KLogInfoCmdConstruct1); |
|
408 err = iAnim->Construct(*win, datType, iSendBuf); |
|
409 } |
|
410 else |
|
411 { |
|
412 INFO_PRINTF1(KLogInfoCmdConstruct2); |
|
413 err = iAnim->Construct(*win, datType, iSendBuf, iIpcArgs); |
|
414 } |
|
415 } |
|
416 else |
|
417 { |
|
418 if (!ipcexist ) |
|
419 { |
|
420 INFO_PRINTF1(KLogInfoCmdConstruct3); |
|
421 err = iAnim->Construct(*sprite, datType, iSendBuf); |
|
422 } |
|
423 else |
|
424 { |
|
425 INFO_PRINTF1(KLogInfoCmdConstruct4); |
|
426 err = iAnim->Construct(*sprite, datType, iSendBuf, iIpcArgs); |
|
427 } |
|
428 } |
|
429 |
|
430 // Check the command return code |
|
431 if(err != KErrNone) |
|
432 { |
|
433 ERR_PRINTF2(KLogErrConstruct, err); |
|
434 SetError(err); |
|
435 } |
|
436 else if (ipcexist && ! CheckIpcArg(aSection)) |
|
437 { |
|
438 ERR_PRINTF1(KLogErrIpcValue); |
|
439 SetBlockResult(EFail); |
|
440 } |
|
441 } |
|
442 } |
|
443 |
|
444 TDesC8& CT_DataAnim::CopyToSendBuf(const TDesC& buf) |
|
445 { |
|
446 TUint8 len=buf.Length(); |
|
447 |
|
448 iSendBuf.Zero(); |
|
449 iSendBuf.Copy(&len,sizeof(len)); |
|
450 if (len>0) |
|
451 iSendBuf.Append(buf); |
|
452 return iSendBuf; |
|
453 } |
|
454 |
|
455 void CT_DataAnim::DoCmdCommandReply(const TDesC& aSection) |
|
456 { |
|
457 TInt err = KErrNone; |
|
458 |
|
459 // Get test data for command input parameter(s) |
|
460 TBool dataOk = ETrue; |
|
461 |
|
462 // get "TInt aOpcode" |
|
463 TInt datOpcode; |
|
464 if ( !ReadAnimCommand(aSection, KFldOpcode, datOpcode)) |
|
465 { |
|
466 dataOk = EFalse; |
|
467 ERR_PRINTF2(KLogErrMissingPara, &KFldOpcode); |
|
468 } |
|
469 |
|
470 // get "const TPtrC8 &aArgs" or "const TDesC8 &aArgs" |
|
471 TPtrC inputStr; |
|
472 TBool argexist=EFalse; |
|
473 if( GetStringFromConfig(aSection, KFldArgs, inputStr)) |
|
474 { |
|
475 CopyToSendBuf(inputStr); |
|
476 argexist=ETrue; |
|
477 } |
|
478 |
|
479 // get "const TIpcArgs &aIpcArgs" |
|
480 TBool ipcexist= EFalse; |
|
481 if ( GetIpcArg(aSection)) |
|
482 ipcexist = ETrue; |
|
483 |
|
484 |
|
485 if ( dataOk ) |
|
486 { |
|
487 if (!argexist) |
|
488 { |
|
489 INFO_PRINTF1(KLogInfoCmdCommandReply1); |
|
490 err = iAnim->CommandReply(datOpcode); |
|
491 } |
|
492 else if (ipcexist) |
|
493 { |
|
494 INFO_PRINTF1(KLogInfoCmdCommandReply3); |
|
495 err = iAnim->CommandReply(datOpcode, iSendBuf, iIpcArgs); |
|
496 } |
|
497 else |
|
498 { |
|
499 INFO_PRINTF1(KLogInfoCmdCommandReply2); |
|
500 err = iAnim->CommandReply(datOpcode, iSendBuf); |
|
501 } |
|
502 |
|
503 // Check the command return code |
|
504 if(err != KErrNone) |
|
505 { |
|
506 ERR_PRINTF2(KLogErrCommandReply, err); |
|
507 SetError(err); |
|
508 } |
|
509 else if (ipcexist && ! CheckIpcArg(aSection)) |
|
510 { |
|
511 ERR_PRINTF1(KLogErrIpcValue); |
|
512 SetBlockResult(EFail); |
|
513 } |
|
514 } |
|
515 else |
|
516 SetBlockResult(EFail); |
|
517 |
|
518 } |
|
519 |
|
520 void CT_DataAnim::DoCmdCommand(const TDesC& aSection) |
|
521 { |
|
522 // Get test data for command input parameter(s) |
|
523 TBool dataOk = ETrue; |
|
524 |
|
525 // get "TInt aOpcode" |
|
526 TInt datOpcode; |
|
527 if ( !ReadAnimCommand(aSection, KFldOpcode, datOpcode)) |
|
528 { |
|
529 dataOk = EFalse; |
|
530 ERR_PRINTF2(KLogErrMissingPara, &KFldOpcode); |
|
531 } |
|
532 |
|
533 // get "const TPtrC8 &aArgs" or "const TDesC8 &aArgs" |
|
534 TPtrC inputStr; |
|
535 TBool argexist=EFalse; |
|
536 if( GetStringFromConfig(aSection, KFldArgs, inputStr)) |
|
537 { |
|
538 CopyToSendBuf(inputStr); |
|
539 argexist=ETrue; |
|
540 } |
|
541 |
|
542 if ( dataOk ) |
|
543 { |
|
544 if (!argexist) |
|
545 { |
|
546 INFO_PRINTF1(KLogInfoCmdCommand2); |
|
547 iAnim->Command(datOpcode); |
|
548 } |
|
549 else |
|
550 { |
|
551 INFO_PRINTF1(KLogInfoCmdCommand1); |
|
552 iAnim->Command(datOpcode, iSendBuf); |
|
553 } |
|
554 } |
|
555 else |
|
556 SetBlockResult(EFail); |
|
557 |
|
558 } |
|
559 |
|
560 void CT_DataAnim::DoCmdAsyncCommandReply(const TDesC& aSection, const TInt aAsyncErrorIndex) |
|
561 { |
|
562 // Get test data for command input parameter(s) |
|
563 TBool dataOk = ETrue; |
|
564 |
|
565 // get "TInt aOpcode" |
|
566 TInt datOpcode; |
|
567 if ( !ReadAnimCommand(aSection, KFldOpcode, datOpcode)) |
|
568 { |
|
569 dataOk = EFalse; |
|
570 ERR_PRINTF2(KLogErrMissingPara, &KFldOpcode); |
|
571 } |
|
572 |
|
573 // get "const TIpcArgs &aIpcArgs" |
|
574 TBool ipcexist= EFalse; |
|
575 if ( GetIpcArg(aSection)) |
|
576 ipcexist = ETrue; |
|
577 |
|
578 if (!ipcexist) |
|
579 { |
|
580 dataOk = EFalse; |
|
581 ERR_PRINTF2(KLogErrMissingPara, &KFldIpcArgs); |
|
582 } |
|
583 |
|
584 if ( !dataOk ) |
|
585 { |
|
586 SetBlockResult(EFail); |
|
587 } |
|
588 else |
|
589 { |
|
590 iAsyncCmdSection.Copy(aSection); |
|
591 // Execute command and log parameters |
|
592 INFO_PRINTF1(KLogInfoCmdAsyncCommandReply1); |
|
593 iAnim->AsyncCommandReply(iActiveCallback->iStatus, datOpcode, iIpcArgs); |
|
594 iActiveCallback->Activate(aAsyncErrorIndex); |
|
595 IncOutstanding(); |
|
596 } |
|
597 |
|
598 } |
|
599 |
|
600 void CT_DataAnim::RunL(CActive* aActive, TInt aIndex) |
|
601 { |
|
602 TInt err = aActive->iStatus.Int(); |
|
603 |
|
604 if (! CheckIpcArg(iAsyncCmdSection)) |
|
605 { |
|
606 ERR_PRINTF1(KLogErrIpcValue); |
|
607 SetBlockResult(EFail); |
|
608 } |
|
609 |
|
610 SetAsyncError(aIndex, err); |
|
611 DecOutstanding(); |
|
612 } |
|
613 |
|
614 void CT_DataAnim::DoCmdClose() |
|
615 { |
|
616 // Execute command and log parameters |
|
617 if (iAnim != NULL) |
|
618 { |
|
619 INFO_PRINTF1(KLogInfoCmdClose1); |
|
620 iAnim->Close(); |
|
621 } |
|
622 } |
|
623 |
|
624 void CT_DataAnim::DoCmdDestroy() |
|
625 { |
|
626 // Execute command and log parameters |
|
627 if (iAnim != NULL) |
|
628 { |
|
629 INFO_PRINTF1(KLogInfoCmdDestroy1); |
|
630 iAnim->Destroy(); |
|
631 iAnim = NULL; |
|
632 } |
|
633 } |
|
634 |
|
635 void CT_DataAnim::DoCmdDestructor() |
|
636 { |
|
637 // Execute command and log parameters |
|
638 INFO_PRINTF1(KLogInfoCmdDestructor1); |
|
639 delete iAnim; |
|
640 iAnim = NULL; |
|
641 } |
|
642 |
|
643 |
|
644 TBool CT_DataAnim::ReadAnimCommand(const TDesC& aSectName, const TDesC& aKeyName, TInt& aCommand) |
|
645 { |
|
646 TPtrC str; |
|
647 TBool ret=GetStringFromConfig(aSectName, aKeyName, str); |
|
648 if ( ret ) |
|
649 { |
|
650 if ( str==KEAnimCmdSync ) |
|
651 { |
|
652 aCommand=ECmdSync; |
|
653 } |
|
654 else if ( str==KEAnimCmdTestWithoutPara ) |
|
655 { |
|
656 aCommand=ECmdTestWithoutPara; |
|
657 } |
|
658 else if ( str==KEAnimCmdTestWithPara ) |
|
659 { |
|
660 aCommand=ECmdTestWithPara; |
|
661 } |
|
662 else if ( str==KEAnimCmdGetLast ) |
|
663 { |
|
664 aCommand=ECmdGetLast; |
|
665 } |
|
666 else if ( str==KEAnimCmdGetAnimInterval ) |
|
667 { |
|
668 aCommand=ECmdGetAnimInterval; |
|
669 } |
|
670 else |
|
671 ret=EFalse; |
|
672 } |
|
673 |
|
674 return ret; |
|
675 } |
|
676 TBool CT_DataAnim::ReadAnimType(const TDesC& aSectName, const TDesC& aKeyName, TInt& aType) |
|
677 { |
|
678 TPtrC str; |
|
679 TBool ret=GetStringFromConfig(aSectName, aKeyName, str); |
|
680 if ( ret ) |
|
681 { |
|
682 if ( str==KEAnimWindows) |
|
683 { |
|
684 aType=EKWindowAnim; |
|
685 } |
|
686 else if ( str==KEAnimSprite ) |
|
687 { |
|
688 aType=EKSpriteAnim; |
|
689 } |
|
690 else if ( str==KEAnimFreeTimer ) |
|
691 { |
|
692 aType=EKFreeTimerWindowAnim; |
|
693 } |
|
694 else |
|
695 ret=EFalse; |
|
696 } |
|
697 |
|
698 return ret; |
|
699 } |