changeset 33 | 834e27cad510 |
parent 0 | 667063e416a2 |
child 37 | e175e2ba2fb0 |
32:b12ea03c50a3 | 33:834e27cad510 |
---|---|
172 CleanupStack::PopAndDestroy( updateParams ); |
172 CleanupStack::PopAndDestroy( updateParams ); |
173 |
173 |
174 CleanupStack::PopAndDestroy( idList ); |
174 CleanupStack::PopAndDestroy( idList ); |
175 CleanupStack::PopAndDestroy( db ); |
175 CleanupStack::PopAndDestroy( db ); |
176 } |
176 } |
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // CAdvancedTriggerSupervision::GetCurrentCoordinateL |
|
180 // Returns current position |
|
181 // ----------------------------------------------------------------------------- |
|
182 // |
|
183 void CAdvancedTriggerSupervision::GetCurrentCoordinateL( TCoordinate& aCoordinate ) |
|
184 { |
|
185 CTriggerFireObserver* notifier= CTriggerFireObserver::NewL(); |
|
186 CleanupStack::PushL( notifier ); |
|
187 CActiveSchedulerWait* wait = new ( ELeave ) CActiveSchedulerWait; |
|
188 CleanupStack::PushL( wait ); |
|
189 TPositionInfo positionInfo; |
|
190 // Ownership of wait is transferred to notifier |
|
191 notifier->CurrentPositionL( positionInfo,wait ); |
|
192 CleanupStack::Pop( wait ); |
|
193 wait->Start(); |
|
194 TPosition position; |
|
195 positionInfo.GetPosition( position ); |
|
196 aCoordinate.SetCoordinate( position.Latitude(),position.Longitude(),position.Altitude() ); |
|
197 CleanupStack::Pop( notifier ); // notifier |
|
198 delete notifier; |
|
199 } |
|
200 |
|
177 // ----------------------------------------------------------------------------- |
201 // ----------------------------------------------------------------------------- |
178 // CAdvancedTriggerSupervision::RunMethodL |
202 // CAdvancedTriggerSupervision::RunMethodL |
179 // Run specified method. Contains also table of test mothods and their names. |
203 // Run specified method. Contains also table of test mothods and their names. |
180 // ----------------------------------------------------------------------------- |
204 // ----------------------------------------------------------------------------- |
181 // |
205 // |
278 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
302 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
279 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
303 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
280 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
304 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
281 // set condition |
305 // set condition |
282 |
306 |
283 TCoordinate coordinate(62.5285,23.9385); |
307 TCoordinate coordinate; |
284 // TCoordinate coordinate(62.4438,23.9385); |
308 GetCurrentCoordinateL( coordinate ); |
285 coordinate.Move(90,2000); |
309 coordinate.Move(90,200); |
286 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
310 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
287 CleanupStack::PushL( circle ); |
311 CleanupStack::PushL( circle ); |
288 |
312 |
289 |
313 |
290 // ownership of circle object transferred to the condition object |
314 // ownership of circle object transferred to the condition object |
291 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
315 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
312 iLog->Log(_L("Trigger Fired")); |
336 iLog->Log(_L("Trigger Fired")); |
313 TLbtTriggerFireInfo FireInfo; |
337 TLbtTriggerFireInfo FireInfo; |
314 TReal32 trigDistance; |
338 TReal32 trigDistance; |
315 TPosition firePosition; |
339 TPosition firePosition; |
316 FireInfo = notifier->GetFiredTrigger(); |
340 FireInfo = notifier->GetFiredTrigger(); |
341 iLog->Log(_L("GFT")); |
|
317 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
342 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
343 iLog->Log(_L("GP")); |
|
318 firePosition.Distance(coordinate,trigDistance); |
344 firePosition.Distance(coordinate,trigDistance); |
319 |
345 |
320 if( trigDistance<=1000 && FireInfo.iTriggerId==trigId ) |
346 if( FireInfo.iTriggerId==trigId ) |
321 { |
347 { |
322 |
348 |
323 CleanupStack::PopAndDestroy( notifier ); |
349 CleanupStack::PopAndDestroy( notifier ); |
324 CleanupStack::PopAndDestroy( trig ); |
350 CleanupStack::PopAndDestroy( trig ); |
325 CleanupStack::Pop( &lbt ); |
351 CleanupStack::Pop( &lbt ); |
398 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
424 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
399 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
425 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
400 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
426 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
401 // set condition |
427 // set condition |
402 |
428 |
403 TCoordinate coordinate(62.5285,23.9385); |
429 TCoordinate coordinate; |
404 // TCoordinate coordinate(62.4438,23.9385); |
430 GetCurrentCoordinateL( coordinate ); |
405 coordinate.Move(90,510); |
431 coordinate.Move(90,110); |
406 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
432 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,200); |
407 CleanupStack::PushL( circle ); |
433 CleanupStack::PushL( circle ); |
408 |
434 |
409 |
435 |
410 // ownership of circle object transferred to the condition object |
436 // ownership of circle object transferred to the condition object |
411 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
437 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
435 TPosition firePosition; |
461 TPosition firePosition; |
436 FireInfo = notifier->GetFiredTrigger(); |
462 FireInfo = notifier->GetFiredTrigger(); |
437 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
463 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
438 firePosition.Distance(coordinate,trigDistance); |
464 firePosition.Distance(coordinate,trigDistance); |
439 |
465 |
440 if( trigDistance<=1000 && FireInfo.iTriggerId==trigId) |
466 if( FireInfo.iTriggerId==trigId) |
441 { |
467 { |
442 |
468 |
443 CleanupStack::PopAndDestroy( notifier ); |
469 CleanupStack::PopAndDestroy( notifier ); |
444 CleanupStack::PopAndDestroy( trig ); |
470 CleanupStack::PopAndDestroy( trig ); |
445 CleanupStack::Pop( &lbt ); |
471 CleanupStack::Pop( &lbt ); |
519 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
545 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
520 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
546 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
521 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
547 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
522 // set condition |
548 // set condition |
523 |
549 |
524 TCoordinate coordinate(62.5285,23.9385); |
550 TCoordinate coordinate; |
525 // TCoordinate coordinate(62.4438,23.9385); |
551 GetCurrentCoordinateL( coordinate ); |
526 |
552 |
527 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
553 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
528 CleanupStack::PushL( circle ); |
554 CleanupStack::PushL( circle ); |
529 |
555 |
530 |
556 |
531 // ownership of circle object transferred to the condition object |
557 // ownership of circle object transferred to the condition object |
532 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
558 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
556 TPosition firePosition; |
582 TPosition firePosition; |
557 FireInfo = notifier->GetFiredTrigger(); |
583 FireInfo = notifier->GetFiredTrigger(); |
558 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
584 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
559 firePosition.Distance(coordinate,trigDistance); |
585 firePosition.Distance(coordinate,trigDistance); |
560 |
586 |
561 if( trigDistance<=1000 && FireInfo.iTriggerId==trigId) |
587 if( FireInfo.iTriggerId==trigId) |
562 { |
588 { |
563 |
589 |
564 CleanupStack::PopAndDestroy( notifier ); |
590 CleanupStack::PopAndDestroy( notifier ); |
565 CleanupStack::PopAndDestroy( trig ); |
591 CleanupStack::PopAndDestroy( trig ); |
566 CleanupStack::Pop( &lbt ); |
592 CleanupStack::Pop( &lbt ); |
637 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
663 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
638 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
664 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
639 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
665 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
640 // set condition |
666 // set condition |
641 |
667 |
642 TCoordinate coordinate(62.5285,23.9385); |
668 TCoordinate coordinate; |
643 // TCoordinate coordinate(62.4438,23.9385); |
669 GetCurrentCoordinateL( coordinate ); |
644 coordinate.Move(90,2000); |
670 coordinate.Move(90,200); |
645 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
671 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
646 CleanupStack::PushL( circle ); |
672 CleanupStack::PushL( circle ); |
647 |
673 |
648 |
674 |
649 // ownership of circle object transferred to the condition object |
675 // ownership of circle object transferred to the condition object |
650 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
676 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
674 TPosition firePosition; |
700 TPosition firePosition; |
675 FireInfo = notifier->GetFiredTrigger(); |
701 FireInfo = notifier->GetFiredTrigger(); |
676 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
702 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
677 firePosition.Distance(coordinate,trigDistance); |
703 firePosition.Distance(coordinate,trigDistance); |
678 |
704 |
679 if( trigDistance>=1000 && FireInfo.iTriggerId==trigId) |
705 if( FireInfo.iTriggerId==trigId) |
680 { |
706 { |
681 |
707 |
682 CleanupStack::PopAndDestroy( notifier ); |
708 CleanupStack::PopAndDestroy( notifier ); |
683 CleanupStack::PopAndDestroy( trig ); |
709 CleanupStack::PopAndDestroy( trig ); |
684 CleanupStack::Pop( &lbt ); |
710 CleanupStack::Pop( &lbt ); |
758 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
784 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
759 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
785 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
760 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
786 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
761 // set condition |
787 // set condition |
762 |
788 |
763 TCoordinate coordinate(62.5285,23.9385); |
789 TCoordinate coordinate; |
764 // TCoordinate coordinate(62.4438,23.9385); |
790 GetCurrentCoordinateL( coordinate ); |
765 coordinate.Move(90,1010); |
791 coordinate.Move(90,110); |
766 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
792 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
767 CleanupStack::PushL( circle ); |
793 CleanupStack::PushL( circle ); |
768 |
794 |
769 |
795 |
770 // ownership of circle object transferred to the condition object |
796 // ownership of circle object transferred to the condition object |
771 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
797 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
795 TPosition firePosition; |
821 TPosition firePosition; |
796 FireInfo = notifier->GetFiredTrigger(); |
822 FireInfo = notifier->GetFiredTrigger(); |
797 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
823 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
798 firePosition.Distance(coordinate,trigDistance); |
824 firePosition.Distance(coordinate,trigDistance); |
799 |
825 |
800 if( trigDistance>=1000 && FireInfo.iTriggerId==trigId) |
826 if( FireInfo.iTriggerId==trigId) |
801 { |
827 { |
802 |
828 |
803 CleanupStack::PopAndDestroy( notifier ); |
829 CleanupStack::PopAndDestroy( notifier ); |
804 CleanupStack::PopAndDestroy( trig ); |
830 CleanupStack::PopAndDestroy( trig ); |
805 CleanupStack::Pop( &lbt ); |
831 CleanupStack::Pop( &lbt ); |
879 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
905 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
880 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
906 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
881 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
907 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
882 // set condition |
908 // set condition |
883 |
909 |
884 TCoordinate coordinate(62.5285,23.9385); |
910 TCoordinate coordinate; |
885 // TCoordinate coordinate(62.4438,23.9385); |
911 GetCurrentCoordinateL( coordinate ); |
886 |
912 |
887 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
913 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
888 CleanupStack::PushL( circle ); |
914 CleanupStack::PushL( circle ); |
889 |
915 |
890 |
916 |
891 // ownership of circle object transferred to the condition object |
917 // ownership of circle object transferred to the condition object |
892 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
918 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
916 TPosition firePosition; |
942 TPosition firePosition; |
917 FireInfo = notifier->GetFiredTrigger(); |
943 FireInfo = notifier->GetFiredTrigger(); |
918 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
944 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
919 firePosition.Distance(coordinate,trigDistance); |
945 firePosition.Distance(coordinate,trigDistance); |
920 |
946 |
921 if( trigDistance>=1000 && FireInfo.iTriggerId==trigId) |
947 if( FireInfo.iTriggerId==trigId) |
922 { |
948 { |
923 |
949 |
924 CleanupStack::PopAndDestroy( notifier ); |
950 CleanupStack::PopAndDestroy( notifier ); |
925 CleanupStack::PopAndDestroy( trig ); |
951 CleanupStack::PopAndDestroy( trig ); |
926 CleanupStack::Pop( &lbt ); |
952 CleanupStack::Pop( &lbt ); |
951 // ----------------------------------------------------------------------------- |
977 // ----------------------------------------------------------------------------- |
952 //Nested triggers - one trigger inside another |
978 //Nested triggers - one trigger inside another |
953 TInt CAdvancedTriggerSupervision::ATSTest7L( CStifItemParser& aItem ) |
979 TInt CAdvancedTriggerSupervision::ATSTest7L( CStifItemParser& aItem ) |
954 { |
980 { |
955 |
981 |
982 |
|
983 iLog->Log(_L("Entering Test1")); |
|
984 _LIT( KSimulationFile,"c:\\system\\data\\simu_move3.sps" ); |
|
985 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
|
986 |
|
987 RLbtServer lbtserver; |
|
988 RLbt lbt; |
|
989 iLog->Log(_L("Before connecting")); |
|
990 User::LeaveIfError( lbtserver.Connect() ); |
|
991 CleanupClosePushL( lbtserver ); |
|
992 iLog->Log(_L("Connection to RLbtServer Passed ")); |
|
993 User::LeaveIfError( lbt.Open(lbtserver)); |
|
994 iLog->Log(_L("Subsession opened ")); |
|
995 CleanupClosePushL( lbt ); |
|
996 |
|
997 //Enable only simpsy |
|
998 EnableSimPSYL(); |
|
999 //Clear all triggers |
|
1000 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
|
1001 CRepository* repository = CRepository::NewLC(KCRUidSimulationPSY); |
|
1002 iLog->Log(_L("Simulation PSY Repository object created")); |
|
1003 // User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile0)); |
|
1004 User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile)); |
|
1005 iLog->Log(_L("Simulation input file set ")); |
|
1006 CleanupStack::PopAndDestroy(repository); |
|
1007 |
|
1008 //Construct a startup trigger |
|
1009 CLbtStartupTrigger* trig = CLbtStartupTrigger::NewL(); |
|
1010 |
|
1011 //Push to cleanup stack |
|
1012 CleanupStack::PushL( trig ); |
|
1013 iLog->Log(_L("Startup Trigger Entry Created ")); |
|
1014 |
|
1015 // Set Name |
|
1016 trig->SetNameL(_L("Trigger1")); |
|
1017 trig->SetNameL(_L("abc")); |
|
1018 _LIT( KMyTriggerHandlingProcessName, "About.exe"); |
|
1019 // _LIT( KMyTriggerHandlingProcessName, "TestServerStarter.exe"); |
|
1020 // _LIT( KMyTriggerHandlingProcessName, "ConsoleUI.exe"); |
|
1021 |
|
1022 TSecureId secureid; |
|
1023 trig->SetProcessId(KMyTriggerHandlingProcessName,secureid); |
|
1024 |
|
1025 //set Requestor |
|
1026 CRequestorBase::TRequestorType ReqType=CRequestorBase::ERequestorUnknown; |
|
1027 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
|
1028 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
|
1029 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
|
1030 // set condition |
|
1031 |
|
1032 TCoordinate coordinate; |
|
1033 GetCurrentCoordinateL( coordinate ); |
|
1034 |
|
1035 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,200); |
|
1036 CleanupStack::PushL( circle ); |
|
1037 |
|
1038 |
|
1039 // ownership of circle object transferred to the condition object |
|
1040 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
|
1041 circle, |
|
1042 CLbtTriggerConditionArea::EFireOnEnter); |
|
1043 |
|
1044 CleanupStack::Pop( circle ); |
|
1045 |
|
1046 trig->SetCondition(condition); // ownership transferred to object |
|
1047 |
|
1048 TLbtTriggerId trigId; |
|
1049 |
|
1050 |
|
1051 CTriggerFireObserver* notifier= CTriggerFireObserver::NewL( lbt,coordinate); |
|
1052 CleanupStack::PushL( notifier ); |
|
1053 |
|
1054 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
|
1055 |
|
1056 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1057 wait->Start( ); |
|
1058 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
|
1059 circle2->SetRadius(500); |
|
1060 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
|
1061 circle2, |
|
1062 CLbtTriggerConditionArea::EFireOnEnter); |
|
1063 |
|
1064 trig->SetCondition(condition2); |
|
1065 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1066 wait->Start( ); |
|
1067 |
|
1068 iLog->Log(_L("Triggers Created")); |
|
1069 notifier->StartNotification( wait ); |
|
1070 wait->Start( ); |
|
1071 wait->Start( ); |
|
1072 RArray<TLbtTriggerFireInfo> Firedtriggers; |
|
1073 lbt.GetFiredTriggersL(Firedtriggers); |
|
1074 if(Firedtriggers.Count()==2) |
|
1075 { |
|
1076 CleanupStack::PopAndDestroy( notifier ); |
|
1077 CleanupStack::PopAndDestroy( trig ); |
|
1078 CleanupStack::Pop( &lbt ); |
|
1079 CleanupStack::PopAndDestroy( &lbtserver ); |
|
1080 return KErrNone; |
|
1081 } |
|
1082 else |
|
1083 { |
|
1084 CleanupStack::PopAndDestroy( notifier ); |
|
1085 CleanupStack::PopAndDestroy( trig ); |
|
1086 CleanupStack::Pop( &lbt ); |
|
1087 CleanupStack::PopAndDestroy( &lbtserver ); |
|
1088 return -99; |
|
1089 } |
|
1090 |
|
1091 // return KErrNone; |
|
1092 |
|
1093 } |
|
1094 |
|
1095 |
|
1096 // ----------------------------------------------------------------------------- |
|
1097 // CAdvancedTriggerSupervision::ATSTest8 |
|
1098 // Example test method function. |
|
1099 // (other items were commented in a header). |
|
1100 // ----------------------------------------------------------------------------- |
|
1101 //Nested triggers - same as above - in this case inside is an exit and outside is an entry |
|
1102 |
|
1103 //trigger |
|
1104 TInt CAdvancedTriggerSupervision::ATSTest8L( CStifItemParser& aItem ) |
|
1105 { |
|
1106 |
|
956 iLog->Log(_L("Entering Test1")); |
1107 iLog->Log(_L("Entering Test1")); |
1108 _LIT( KSimulationFile,"c:\\system\\data\\simu_move3.sps" ); |
|
1109 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
|
1110 |
|
1111 RLbtServer lbtserver; |
|
1112 RLbt lbt; |
|
1113 iLog->Log(_L("Before connecting")); |
|
1114 User::LeaveIfError( lbtserver.Connect() ); |
|
1115 CleanupClosePushL( lbtserver ); |
|
1116 iLog->Log(_L("Connection to RLbtServer Passed ")); |
|
1117 User::LeaveIfError( lbt.Open(lbtserver)); |
|
1118 iLog->Log(_L("Subsession opened ")); |
|
1119 CleanupClosePushL( lbt ); |
|
1120 |
|
1121 //Enable only simpsy |
|
1122 EnableSimPSYL(); |
|
1123 //Clear all triggers |
|
1124 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
|
1125 CRepository* repository = CRepository::NewLC(KCRUidSimulationPSY); |
|
1126 iLog->Log(_L("Simulation PSY Repository object created")); |
|
1127 // User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile0)); |
|
1128 User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile)); |
|
1129 iLog->Log(_L("Simulation input file set ")); |
|
1130 CleanupStack::PopAndDestroy(repository); |
|
1131 |
|
1132 //Construct a startup trigger |
|
1133 CLbtStartupTrigger* trig = CLbtStartupTrigger::NewL(); |
|
1134 |
|
1135 //Push to cleanup stack |
|
1136 CleanupStack::PushL( trig ); |
|
1137 iLog->Log(_L("Startup Trigger Entry Created ")); |
|
1138 |
|
1139 // Set Name |
|
1140 trig->SetNameL(_L("Trigger1")); |
|
1141 trig->SetNameL(_L("abc")); |
|
1142 _LIT( KMyTriggerHandlingProcessName, "About.exe"); |
|
1143 // _LIT( KMyTriggerHandlingProcessName, "TestServerStarter.exe"); |
|
1144 // _LIT( KMyTriggerHandlingProcessName, "ConsoleUI.exe"); |
|
1145 |
|
1146 TSecureId secureid; |
|
1147 trig->SetProcessId(KMyTriggerHandlingProcessName,secureid); |
|
1148 |
|
1149 //set Requestor |
|
1150 CRequestorBase::TRequestorType ReqType=CRequestorBase::ERequestorUnknown; |
|
1151 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
|
1152 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
|
1153 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
|
1154 // set condition |
|
1155 |
|
1156 TCoordinate coordinate; |
|
1157 GetCurrentCoordinateL( coordinate ); |
|
1158 |
|
1159 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,200); |
|
1160 CleanupStack::PushL( circle ); |
|
1161 |
|
1162 |
|
1163 // ownership of circle object transferred to the condition object |
|
1164 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
|
1165 circle, |
|
1166 CLbtTriggerConditionArea::EFireOnEnter); |
|
1167 |
|
1168 CleanupStack::Pop( circle ); |
|
1169 |
|
1170 trig->SetCondition(condition); // ownership transferred to object |
|
1171 |
|
1172 TLbtTriggerId trigId; |
|
1173 |
|
1174 |
|
1175 CTriggerFireObserver* notifier= CTriggerFireObserver::NewL( lbt,coordinate); |
|
1176 CleanupStack::PushL( notifier ); |
|
1177 |
|
1178 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
|
1179 |
|
1180 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1181 wait->Start( ); |
|
1182 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
|
1183 circle2->SetRadius(500); |
|
1184 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
|
1185 circle2, |
|
1186 CLbtTriggerConditionArea::EFireOnExit); |
|
1187 |
|
1188 trig->SetCondition(condition2); |
|
1189 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1190 wait->Start( ); |
|
1191 |
|
1192 iLog->Log(_L("Triggers Created")); |
|
1193 notifier->StartNotification( wait ); |
|
1194 wait->Start( ); |
|
1195 wait->Start( ); |
|
1196 RArray<TLbtTriggerFireInfo> Firedtriggers; |
|
1197 lbt.GetFiredTriggersL(Firedtriggers); |
|
1198 if(Firedtriggers.Count()==2) |
|
1199 { |
|
1200 CleanupStack::PopAndDestroy( notifier ); |
|
1201 CleanupStack::PopAndDestroy( trig ); |
|
1202 CleanupStack::Pop( &lbt ); |
|
1203 CleanupStack::PopAndDestroy( &lbtserver ); |
|
1204 return KErrNone; |
|
1205 } |
|
1206 else |
|
1207 { |
|
1208 CleanupStack::PopAndDestroy( notifier ); |
|
1209 CleanupStack::PopAndDestroy( trig ); |
|
1210 CleanupStack::Pop( &lbt ); |
|
1211 CleanupStack::PopAndDestroy( &lbtserver ); |
|
1212 return -99; |
|
1213 } |
|
1214 |
|
1215 // return KErrNone; |
|
1216 |
|
1217 } |
|
1218 |
|
1219 |
|
1220 // ----------------------------------------------------------------------------- |
|
1221 // CAdvancedTriggerSupervision::ATSTest9 |
|
1222 // Example test method function. |
|
1223 // (other items were commented in a header). |
|
1224 // ----------------------------------------------------------------------------- |
|
1225 //Nested triggers - same as above - in this case inside is an Entry and outside is an |
|
1226 |
|
1227 //Exit trigger |
|
1228 TInt CAdvancedTriggerSupervision::ATSTest9L( CStifItemParser& aItem ) |
|
1229 { |
|
1230 |
|
1231 iLog->Log(_L("Entering Test1")); |
|
1232 _LIT( KSimulationFile,"c:\\system\\data\\simu_move2.sps" ); |
|
1233 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
|
1234 |
|
1235 RLbtServer lbtserver; |
|
1236 RLbt lbt; |
|
1237 iLog->Log(_L("Before connecting")); |
|
1238 User::LeaveIfError( lbtserver.Connect() ); |
|
1239 CleanupClosePushL( lbtserver ); |
|
1240 iLog->Log(_L("Connection to RLbtServer Passed ")); |
|
1241 User::LeaveIfError( lbt.Open(lbtserver)); |
|
1242 iLog->Log(_L("Subsession opened ")); |
|
1243 CleanupClosePushL( lbt ); |
|
1244 |
|
1245 //Enable only simpsy |
|
1246 EnableSimPSYL(); |
|
1247 //Clear all triggers |
|
1248 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
|
1249 CRepository* repository = CRepository::NewLC(KCRUidSimulationPSY); |
|
1250 iLog->Log(_L("Simulation PSY Repository object created")); |
|
1251 // User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile0)); |
|
1252 User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile)); |
|
1253 iLog->Log(_L("Simulation input file set ")); |
|
1254 CleanupStack::PopAndDestroy(repository); |
|
1255 |
|
1256 //Construct a startup trigger |
|
1257 CLbtStartupTrigger* trig = CLbtStartupTrigger::NewL(); |
|
1258 |
|
1259 //Push to cleanup stack |
|
1260 CleanupStack::PushL( trig ); |
|
1261 iLog->Log(_L("Startup Trigger Entry Created ")); |
|
1262 |
|
1263 // Set Name |
|
1264 trig->SetNameL(_L("Trigger1")); |
|
1265 trig->SetNameL(_L("abc")); |
|
1266 _LIT( KMyTriggerHandlingProcessName, "About.exe"); |
|
1267 // _LIT( KMyTriggerHandlingProcessName, "TestServerStarter.exe"); |
|
1268 // _LIT( KMyTriggerHandlingProcessName, "ConsoleUI.exe"); |
|
1269 |
|
1270 TSecureId secureid; |
|
1271 trig->SetProcessId(KMyTriggerHandlingProcessName,secureid); |
|
1272 |
|
1273 //set Requestor |
|
1274 CRequestorBase::TRequestorType ReqType=CRequestorBase::ERequestorUnknown; |
|
1275 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
|
1276 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
|
1277 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
|
1278 // set condition |
|
1279 |
|
1280 TCoordinate coordinate; |
|
1281 GetCurrentCoordinateL( coordinate ); |
|
1282 |
|
1283 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,200); |
|
1284 CleanupStack::PushL( circle ); |
|
1285 |
|
1286 |
|
1287 // ownership of circle object transferred to the condition object |
|
1288 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
|
1289 circle, |
|
1290 CLbtTriggerConditionArea::EFireOnExit); |
|
1291 |
|
1292 CleanupStack::Pop( circle ); |
|
1293 |
|
1294 trig->SetCondition(condition); // ownership transferred to object |
|
1295 |
|
1296 TLbtTriggerId trigId; |
|
1297 |
|
1298 |
|
1299 CTriggerFireObserver* notifier= CTriggerFireObserver::NewL( lbt,coordinate); |
|
1300 CleanupStack::PushL( notifier ); |
|
1301 |
|
1302 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
|
1303 |
|
1304 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1305 wait->Start( ); |
|
1306 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,200); |
|
1307 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
|
1308 circle2, |
|
1309 CLbtTriggerConditionArea::EFireOnEnter); |
|
1310 |
|
1311 trig->SetCondition(condition2); |
|
1312 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1313 wait->Start( ); |
|
1314 |
|
1315 iLog->Log(_L("Triggers Created")); |
|
1316 notifier->StartNotification( wait ); |
|
1317 wait->Start( ); |
|
1318 wait->Start( ); |
|
1319 |
|
1320 RArray<TLbtTriggerFireInfo> Firedtriggers; |
|
1321 lbt.GetFiredTriggersL(Firedtriggers); |
|
1322 CleanupStack::PopAndDestroy( notifier ); |
|
1323 CleanupStack::PopAndDestroy( trig ); |
|
1324 CleanupStack::Pop( &lbt ); |
|
1325 CleanupStack::PopAndDestroy( &lbtserver ); |
|
1326 //delete wait; |
|
1327 if(Firedtriggers.Count()==2) |
|
1328 { |
|
1329 return KErrNone; |
|
1330 } |
|
1331 else |
|
1332 { |
|
1333 return -99; |
|
1334 } |
|
1335 |
|
1336 } |
|
1337 |
|
1338 |
|
1339 // ----------------------------------------------------------------------------- |
|
1340 // CAdvancedTriggerSupervision::ATSTest10 |
|
1341 // Example test method function. |
|
1342 // (other items were commented in a header). |
|
1343 // ----------------------------------------------------------------------------- |
|
1344 //Overlapping triggers - triggers adjecent to each other and triggers whose boundaries |
|
1345 |
|
1346 //overlap one another |
|
1347 TInt CAdvancedTriggerSupervision::ATSTest10L( CStifItemParser& aItem ) |
|
1348 { |
|
1349 |
|
1350 iLog->Log(_L("Entering Test1")); |
|
957 _LIT( KSimulationFile,"c:\\system\\data\\simu_move1.sps" ); |
1351 _LIT( KSimulationFile,"c:\\system\\data\\simu_move1.sps" ); |
958 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
1352 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
959 |
1353 |
960 RLbtServer lbtserver; |
1354 RLbtServer lbtserver; |
961 RLbt lbt; |
1355 RLbt lbt; |
1000 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1394 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1001 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1395 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1002 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1396 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1003 // set condition |
1397 // set condition |
1004 |
1398 |
1005 TCoordinate coordinate(62.5285,23.9385); |
1399 TCoordinate coordinate; |
1006 // TCoordinate coordinate(62.4438,23.9385); |
1400 GetCurrentCoordinateL( coordinate ); |
1007 |
1401 |
1008 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
1402 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
1009 CleanupStack::PushL( circle ); |
|
1010 |
|
1011 |
|
1012 // ownership of circle object transferred to the condition object |
|
1013 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
|
1014 circle, |
|
1015 CLbtTriggerConditionArea::EFireOnEnter); |
|
1016 |
|
1017 CleanupStack::Pop( circle ); |
|
1018 |
|
1019 trig->SetCondition(condition); // ownership transferred to object |
|
1020 |
|
1021 TLbtTriggerId trigId; |
|
1022 |
|
1023 |
|
1024 CTriggerFireObserver* notifier= CTriggerFireObserver::NewL( lbt,coordinate); |
|
1025 CleanupStack::PushL( notifier ); |
|
1026 |
|
1027 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
|
1028 |
|
1029 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1030 wait->Start( ); |
|
1031 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
|
1032 circle2->SetRadius(500); |
|
1033 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
|
1034 circle2, |
|
1035 CLbtTriggerConditionArea::EFireOnEnter); |
|
1036 |
|
1037 trig->SetCondition(condition2); |
|
1038 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1039 wait->Start( ); |
|
1040 |
|
1041 iLog->Log(_L("Triggers Created")); |
|
1042 // notifier->StartNotification( wait ); |
|
1043 // wait->Start( ); |
|
1044 notifier->StartNotification( wait ); |
|
1045 wait->Start( ); |
|
1046 notifier->After(120000000); |
|
1047 wait->Start( ); |
|
1048 RArray<TLbtTriggerFireInfo> Firedtriggers; |
|
1049 lbt.GetFiredTriggersL(Firedtriggers); |
|
1050 if(Firedtriggers.Count()==2) |
|
1051 { |
|
1052 CleanupStack::PopAndDestroy( notifier ); |
|
1053 CleanupStack::PopAndDestroy( trig ); |
|
1054 CleanupStack::Pop( &lbt ); |
|
1055 CleanupStack::PopAndDestroy( &lbtserver ); |
|
1056 return KErrNone; |
|
1057 } |
|
1058 else |
|
1059 { |
|
1060 CleanupStack::PopAndDestroy( notifier ); |
|
1061 CleanupStack::PopAndDestroy( trig ); |
|
1062 CleanupStack::Pop( &lbt ); |
|
1063 CleanupStack::PopAndDestroy( &lbtserver ); |
|
1064 return -99; |
|
1065 } |
|
1066 |
|
1067 } |
|
1068 |
|
1069 |
|
1070 // ----------------------------------------------------------------------------- |
|
1071 // CAdvancedTriggerSupervision::ATSTest8 |
|
1072 // Example test method function. |
|
1073 // (other items were commented in a header). |
|
1074 // ----------------------------------------------------------------------------- |
|
1075 //Nested triggers - same as above - in this case inside is an exit and outside is an entry |
|
1076 |
|
1077 //trigger |
|
1078 TInt CAdvancedTriggerSupervision::ATSTest8L( CStifItemParser& aItem ) |
|
1079 { |
|
1080 |
|
1081 iLog->Log(_L("Entering Test1")); |
|
1082 _LIT( KSimulationFile,"c:\\system\\data\\simu_move3.sps" ); |
|
1083 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
|
1084 |
|
1085 RLbtServer lbtserver; |
|
1086 RLbt lbt; |
|
1087 iLog->Log(_L("Before connecting")); |
|
1088 User::LeaveIfError( lbtserver.Connect() ); |
|
1089 CleanupClosePushL( lbtserver ); |
|
1090 iLog->Log(_L("Connection to RLbtServer Passed ")); |
|
1091 User::LeaveIfError( lbt.Open(lbtserver)); |
|
1092 iLog->Log(_L("Subsession opened ")); |
|
1093 CleanupClosePushL( lbt ); |
|
1094 |
|
1095 //Enable only simpsy |
|
1096 EnableSimPSYL(); |
|
1097 //Clear all triggers |
|
1098 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
|
1099 CRepository* repository = CRepository::NewLC(KCRUidSimulationPSY); |
|
1100 iLog->Log(_L("Simulation PSY Repository object created")); |
|
1101 // User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile0)); |
|
1102 User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile)); |
|
1103 iLog->Log(_L("Simulation input file set ")); |
|
1104 CleanupStack::PopAndDestroy(repository); |
|
1105 |
|
1106 //Construct a startup trigger |
|
1107 CLbtStartupTrigger* trig = CLbtStartupTrigger::NewL(); |
|
1108 |
|
1109 //Push to cleanup stack |
|
1110 CleanupStack::PushL( trig ); |
|
1111 iLog->Log(_L("Startup Trigger Entry Created ")); |
|
1112 |
|
1113 // Set Name |
|
1114 trig->SetNameL(_L("Trigger1")); |
|
1115 trig->SetNameL(_L("abc")); |
|
1116 _LIT( KMyTriggerHandlingProcessName, "About.exe"); |
|
1117 // _LIT( KMyTriggerHandlingProcessName, "TestServerStarter.exe"); |
|
1118 // _LIT( KMyTriggerHandlingProcessName, "ConsoleUI.exe"); |
|
1119 |
|
1120 TSecureId secureid; |
|
1121 trig->SetProcessId(KMyTriggerHandlingProcessName,secureid); |
|
1122 |
|
1123 //set Requestor |
|
1124 CRequestorBase::TRequestorType ReqType=CRequestorBase::ERequestorUnknown; |
|
1125 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
|
1126 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
|
1127 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
|
1128 // set condition |
|
1129 |
|
1130 TCoordinate coordinate(62.5285,23.9385); |
|
1131 // TCoordinate coordinate(62.4438,23.9385); |
|
1132 |
|
1133 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
|
1134 CleanupStack::PushL( circle ); |
|
1135 |
|
1136 |
|
1137 // ownership of circle object transferred to the condition object |
|
1138 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
|
1139 circle, |
|
1140 CLbtTriggerConditionArea::EFireOnEnter); |
|
1141 |
|
1142 CleanupStack::Pop( circle ); |
|
1143 |
|
1144 trig->SetCondition(condition); // ownership transferred to object |
|
1145 |
|
1146 TLbtTriggerId trigId; |
|
1147 |
|
1148 |
|
1149 CTriggerFireObserver* notifier= CTriggerFireObserver::NewL( lbt,coordinate); |
|
1150 CleanupStack::PushL( notifier ); |
|
1151 |
|
1152 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
|
1153 |
|
1154 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1155 wait->Start( ); |
|
1156 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
|
1157 circle2->SetRadius(500); |
|
1158 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
|
1159 circle2, |
|
1160 CLbtTriggerConditionArea::EFireOnExit); |
|
1161 |
|
1162 trig->SetCondition(condition2); |
|
1163 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1164 wait->Start( ); |
|
1165 |
|
1166 iLog->Log(_L("Triggers Created")); |
|
1167 notifier->StartNotification( wait ); |
|
1168 wait->Start( ); |
|
1169 // notifier->StartNotification( wait ); |
|
1170 // wait->Start( ); |
|
1171 notifier->After(1200000000); |
|
1172 wait->Start( ); |
|
1173 RArray<TLbtTriggerFireInfo> Firedtriggers; |
|
1174 lbt.GetFiredTriggersL(Firedtriggers); |
|
1175 if(Firedtriggers.Count()==2) |
|
1176 { |
|
1177 CleanupStack::PopAndDestroy( notifier ); |
|
1178 CleanupStack::PopAndDestroy( trig ); |
|
1179 CleanupStack::Pop( &lbt ); |
|
1180 CleanupStack::PopAndDestroy( &lbtserver ); |
|
1181 return KErrNone; |
|
1182 } |
|
1183 else |
|
1184 { |
|
1185 CleanupStack::PopAndDestroy( notifier ); |
|
1186 CleanupStack::PopAndDestroy( trig ); |
|
1187 CleanupStack::Pop( &lbt ); |
|
1188 CleanupStack::PopAndDestroy( &lbtserver ); |
|
1189 return -99; |
|
1190 } |
|
1191 |
|
1192 // return KErrNone; |
|
1193 |
|
1194 } |
|
1195 |
|
1196 |
|
1197 // ----------------------------------------------------------------------------- |
|
1198 // CAdvancedTriggerSupervision::ATSTest9 |
|
1199 // Example test method function. |
|
1200 // (other items were commented in a header). |
|
1201 // ----------------------------------------------------------------------------- |
|
1202 //Nested triggers - same as above - in this case inside is an Entry and outside is an |
|
1203 |
|
1204 //Exit trigger |
|
1205 TInt CAdvancedTriggerSupervision::ATSTest9L( CStifItemParser& aItem ) |
|
1206 { |
|
1207 |
|
1208 iLog->Log(_L("Entering Test1")); |
|
1209 _LIT( KSimulationFile,"c:\\system\\data\\simu_move2.sps" ); |
|
1210 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
|
1211 |
|
1212 RLbtServer lbtserver; |
|
1213 RLbt lbt; |
|
1214 iLog->Log(_L("Before connecting")); |
|
1215 User::LeaveIfError( lbtserver.Connect() ); |
|
1216 CleanupClosePushL( lbtserver ); |
|
1217 iLog->Log(_L("Connection to RLbtServer Passed ")); |
|
1218 User::LeaveIfError( lbt.Open(lbtserver)); |
|
1219 iLog->Log(_L("Subsession opened ")); |
|
1220 CleanupClosePushL( lbt ); |
|
1221 |
|
1222 //Enable only simpsy |
|
1223 EnableSimPSYL(); |
|
1224 //Clear all triggers |
|
1225 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
|
1226 CRepository* repository = CRepository::NewLC(KCRUidSimulationPSY); |
|
1227 iLog->Log(_L("Simulation PSY Repository object created")); |
|
1228 // User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile0)); |
|
1229 User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile)); |
|
1230 iLog->Log(_L("Simulation input file set ")); |
|
1231 CleanupStack::PopAndDestroy(repository); |
|
1232 |
|
1233 //Construct a startup trigger |
|
1234 CLbtStartupTrigger* trig = CLbtStartupTrigger::NewL(); |
|
1235 |
|
1236 //Push to cleanup stack |
|
1237 CleanupStack::PushL( trig ); |
|
1238 iLog->Log(_L("Startup Trigger Entry Created ")); |
|
1239 |
|
1240 // Set Name |
|
1241 trig->SetNameL(_L("Trigger1")); |
|
1242 trig->SetNameL(_L("abc")); |
|
1243 _LIT( KMyTriggerHandlingProcessName, "About.exe"); |
|
1244 // _LIT( KMyTriggerHandlingProcessName, "TestServerStarter.exe"); |
|
1245 // _LIT( KMyTriggerHandlingProcessName, "ConsoleUI.exe"); |
|
1246 |
|
1247 TSecureId secureid; |
|
1248 trig->SetProcessId(KMyTriggerHandlingProcessName,secureid); |
|
1249 |
|
1250 //set Requestor |
|
1251 CRequestorBase::TRequestorType ReqType=CRequestorBase::ERequestorUnknown; |
|
1252 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
|
1253 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
|
1254 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
|
1255 // set condition |
|
1256 |
|
1257 TCoordinate coordinate(62.5285,23.9385); |
|
1258 // TCoordinate coordinate(62.4438,23.9385); |
|
1259 |
|
1260 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,500); |
|
1261 CleanupStack::PushL( circle ); |
1403 CleanupStack::PushL( circle ); |
1262 |
1404 |
1263 |
1405 |
1264 // ownership of circle object transferred to the condition object |
1406 // ownership of circle object transferred to the condition object |
1265 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1407 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1278 |
1420 |
1279 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1421 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1280 |
1422 |
1281 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1423 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1282 wait->Start( ); |
1424 wait->Start( ); |
1283 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
1425 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
1284 circle2->SetRadius(250); |
1426 coordinate.Move(90,200); |
1285 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
|
1286 circle2, |
|
1287 CLbtTriggerConditionArea::EFireOnEnter); |
|
1288 |
|
1289 trig->SetCondition(condition2); |
|
1290 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1291 wait->Start( ); |
|
1292 |
|
1293 iLog->Log(_L("Triggers Created")); |
|
1294 notifier->StartNotification( wait ); |
|
1295 wait->Start( ); |
|
1296 // notifier->StartNotification( wait ); |
|
1297 // wait->Start( ); |
|
1298 |
|
1299 notifier->After(120000000); |
|
1300 wait->Start( ); |
|
1301 RArray<TLbtTriggerFireInfo> Firedtriggers; |
|
1302 lbt.GetFiredTriggersL(Firedtriggers); |
|
1303 CleanupStack::PopAndDestroy( notifier ); |
|
1304 CleanupStack::PopAndDestroy( trig ); |
|
1305 CleanupStack::Pop( &lbt ); |
|
1306 CleanupStack::PopAndDestroy( &lbtserver ); |
|
1307 //delete wait; |
|
1308 if(Firedtriggers.Count()==2) |
|
1309 { |
|
1310 return KErrNone; |
|
1311 } |
|
1312 else |
|
1313 { |
|
1314 return -99; |
|
1315 } |
|
1316 |
|
1317 } |
|
1318 |
|
1319 |
|
1320 // ----------------------------------------------------------------------------- |
|
1321 // CAdvancedTriggerSupervision::ATSTest10 |
|
1322 // Example test method function. |
|
1323 // (other items were commented in a header). |
|
1324 // ----------------------------------------------------------------------------- |
|
1325 //Overlapping triggers - triggers adjecent to each other and triggers whose boundaries |
|
1326 |
|
1327 //overlap one another |
|
1328 TInt CAdvancedTriggerSupervision::ATSTest10L( CStifItemParser& aItem ) |
|
1329 { |
|
1330 |
|
1331 iLog->Log(_L("Entering Test1")); |
|
1332 _LIT( KSimulationFile,"c:\\system\\data\\simu_move1.sps" ); |
|
1333 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
|
1334 |
|
1335 RLbtServer lbtserver; |
|
1336 RLbt lbt; |
|
1337 iLog->Log(_L("Before connecting")); |
|
1338 User::LeaveIfError( lbtserver.Connect() ); |
|
1339 CleanupClosePushL( lbtserver ); |
|
1340 iLog->Log(_L("Connection to RLbtServer Passed ")); |
|
1341 User::LeaveIfError( lbt.Open(lbtserver)); |
|
1342 iLog->Log(_L("Subsession opened ")); |
|
1343 CleanupClosePushL( lbt ); |
|
1344 //Enable only simpsy |
|
1345 EnableSimPSYL(); |
|
1346 //Clear all triggers |
|
1347 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
|
1348 |
|
1349 CRepository* repository = CRepository::NewLC(KCRUidSimulationPSY); |
|
1350 iLog->Log(_L("Simulation PSY Repository object created")); |
|
1351 // User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile0)); |
|
1352 User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile)); |
|
1353 iLog->Log(_L("Simulation input file set ")); |
|
1354 CleanupStack::PopAndDestroy(repository); |
|
1355 |
|
1356 //Construct a startup trigger |
|
1357 CLbtStartupTrigger* trig = CLbtStartupTrigger::NewL(); |
|
1358 |
|
1359 //Push to cleanup stack |
|
1360 CleanupStack::PushL( trig ); |
|
1361 iLog->Log(_L("Startup Trigger Entry Created ")); |
|
1362 |
|
1363 // Set Name |
|
1364 trig->SetNameL(_L("Trigger1")); |
|
1365 trig->SetNameL(_L("abc")); |
|
1366 _LIT( KMyTriggerHandlingProcessName, "About.exe"); |
|
1367 // _LIT( KMyTriggerHandlingProcessName, "TestServerStarter.exe"); |
|
1368 // _LIT( KMyTriggerHandlingProcessName, "ConsoleUI.exe"); |
|
1369 |
|
1370 TSecureId secureid; |
|
1371 trig->SetProcessId(KMyTriggerHandlingProcessName,secureid); |
|
1372 |
|
1373 //set Requestor |
|
1374 CRequestorBase::TRequestorType ReqType=CRequestorBase::ERequestorUnknown; |
|
1375 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
|
1376 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
|
1377 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
|
1378 // set condition |
|
1379 |
|
1380 TCoordinate coordinate(62.5285,23.9385); |
|
1381 |
|
1382 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,500); |
|
1383 CleanupStack::PushL( circle ); |
|
1384 |
|
1385 |
|
1386 // ownership of circle object transferred to the condition object |
|
1387 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
|
1388 circle, |
|
1389 CLbtTriggerConditionArea::EFireOnExit); |
|
1390 |
|
1391 CleanupStack::Pop( circle ); |
|
1392 |
|
1393 trig->SetCondition(condition); // ownership transferred to object |
|
1394 |
|
1395 TLbtTriggerId trigId; |
|
1396 |
|
1397 |
|
1398 CTriggerFireObserver* notifier= CTriggerFireObserver::NewL( lbt,coordinate); |
|
1399 CleanupStack::PushL( notifier ); |
|
1400 |
|
1401 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
|
1402 |
|
1403 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1404 wait->Start( ); |
|
1405 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
|
1406 circle2->SetRadius(500); |
|
1407 coordinate.Move(90,1000); |
|
1408 circle2->SetCenter(coordinate); |
1427 circle2->SetCenter(coordinate); |
1409 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1428 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1410 circle2, |
1429 circle2, |
1411 CLbtTriggerConditionArea::EFireOnExit); |
1430 CLbtTriggerConditionArea::EFireOnExit); |
1412 |
1431 |
1415 wait->Start( ); |
1434 wait->Start( ); |
1416 |
1435 |
1417 iLog->Log(_L("Triggers Created")); |
1436 iLog->Log(_L("Triggers Created")); |
1418 notifier->StartNotification( wait ); |
1437 notifier->StartNotification( wait ); |
1419 wait->Start( ); |
1438 wait->Start( ); |
1420 // notifier->StartNotification( wait ); |
|
1421 // wait->Start( ); |
|
1422 notifier->After(120000000); |
|
1423 wait->Start( ); |
1439 wait->Start( ); |
1424 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1440 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1425 lbt.GetFiredTriggersL(Firedtriggers); |
1441 lbt.GetFiredTriggersL(Firedtriggers); |
1426 if(Firedtriggers.Count()==2) |
1442 if(Firedtriggers.Count()==2) |
1427 { |
1443 { |
1503 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1519 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1504 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1520 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1505 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1521 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1506 // set condition |
1522 // set condition |
1507 |
1523 |
1508 TCoordinate coordinate(62.5285,23.9385); |
1524 TCoordinate coordinate; |
1525 GetCurrentCoordinateL( coordinate ); |
|
1509 |
1526 |
1510 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,500); |
1527 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
1511 CleanupStack::PushL( circle ); |
1528 CleanupStack::PushL( circle ); |
1512 |
1529 |
1513 |
1530 |
1514 // ownership of circle object transferred to the condition object |
1531 // ownership of circle object transferred to the condition object |
1515 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1532 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1529 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1546 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1530 |
1547 |
1531 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1548 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1532 wait->Start( ); |
1549 wait->Start( ); |
1533 |
1550 |
1534 coordinate.Move(90,500); |
1551 coordinate.Move(90,100); |
1535 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
1552 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
1536 circle2->SetCenter(coordinate); |
1553 circle2->SetCenter(coordinate); |
1537 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1554 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1538 circle2, |
1555 circle2, |
1539 CLbtTriggerConditionArea::EFireOnEnter); |
1556 CLbtTriggerConditionArea::EFireOnEnter); |
1540 |
1557 |
1543 wait->Start( ); |
1560 wait->Start( ); |
1544 |
1561 |
1545 iLog->Log(_L("Triggers Created")); |
1562 iLog->Log(_L("Triggers Created")); |
1546 notifier->StartNotification( wait ); |
1563 notifier->StartNotification( wait ); |
1547 wait->Start( ); |
1564 wait->Start( ); |
1548 notifier->After(120000000); |
1565 wait->Start( ); |
1549 wait->Start( ); |
1566 |
1550 iLog->Log(_L("Trigger Fired")); |
1567 iLog->Log(_L("Trigger Fired")); |
1551 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1568 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1552 lbt.GetFiredTriggersL(Firedtriggers); |
1569 lbt.GetFiredTriggersL(Firedtriggers); |
1553 if(Firedtriggers.Count()==2) |
1570 if(Firedtriggers.Count()==2) |
1554 { |
1571 { |
1579 //Testing of cluster of triggers |
1596 //Testing of cluster of triggers |
1580 TInt CAdvancedTriggerSupervision::ATSTest12L( CStifItemParser& aItem ) |
1597 TInt CAdvancedTriggerSupervision::ATSTest12L( CStifItemParser& aItem ) |
1581 { |
1598 { |
1582 |
1599 |
1583 iLog->Log(_L("Entering Test1")); |
1600 iLog->Log(_L("Entering Test1")); |
1584 _LIT( KSimulationFile,"c:\\system\\data\\test3.nme" ); |
1601 _LIT( KSimulationFile,"c:\\system\\data\\simu_move2.sps" ); |
1585 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
1602 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
1586 |
1603 |
1587 RLbtServer lbtserver; |
1604 RLbtServer lbtserver; |
1588 RLbt lbt; |
1605 RLbt lbt; |
1589 iLog->Log(_L("Before connecting")); |
1606 iLog->Log(_L("Before connecting")); |
1628 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1645 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1629 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1646 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1630 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1647 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1631 // set condition |
1648 // set condition |
1632 |
1649 |
1633 TCoordinate coordinate(62.5285,23.9385); |
1650 TCoordinate coordinate; |
1634 |
1651 GetCurrentCoordinateL( coordinate ); |
1635 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
1652 |
1653 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
|
1636 CleanupStack::PushL( circle ); |
1654 CleanupStack::PushL( circle ); |
1637 |
1655 |
1638 |
1656 |
1639 // ownership of circle object transferred to the condition object |
1657 // ownership of circle object transferred to the condition object |
1640 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1658 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1653 |
1671 |
1654 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1672 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1655 |
1673 |
1656 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1674 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1657 wait->Start( ); |
1675 wait->Start( ); |
1658 TCoordinate coordinates[10]= |
1676 TCoordinate movCoordinates( coordinate.Latitude(),coordinate.Longitude() ); |
1677 |
|
1678 TCoordinate coordinates[4]; |
|
1679 // Initialise the coordinate |
|
1680 for( TInt i=0;i<4;i++ ) |
|
1659 { |
1681 { |
1660 TCoordinate(62.5285,23.9385) , |
1682 movCoordinates.Move( 90,300 ); |
1661 TCoordinate(62.5267,23.9636), |
1683 coordinates[i] = movCoordinates; |
1662 TCoordinate(62.5167,23.9528), |
1684 } |
1663 /* TCoordinate(62.5141,23.9312), |
|
1664 TCoordinate(62.5296,23.9514), |
|
1665 TCoordinate(62.5269,23.9331), |
|
1666 TCoordinate(62.518,23.9401), |
|
1667 TCoordinate(62.5394,23.9439), |
|
1668 TCoordinate(62.5275,23.9223),*/ |
|
1669 TCoordinate(62.5331,23.9551)}; |
|
1670 for(int i=0;i<4;i++) |
1685 for(int i=0;i<4;i++) |
1671 { |
1686 { |
1672 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,500); |
1687 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
1673 // coordinate.Move(45,100); |
1688 // coordinate.Move(45,100); |
1674 circle->SetCenter(coordinates[i]); |
1689 circle->SetCenter(coordinates[i]); |
1675 if(i%2==0) |
1690 if(i%2==0) |
1676 { |
1691 { |
1677 |
1692 |
1695 |
1710 |
1696 iLog->Log(_L("Triggers Created")); |
1711 iLog->Log(_L("Triggers Created")); |
1697 |
1712 |
1698 notifier->StartNotification( wait ); |
1713 notifier->StartNotification( wait ); |
1699 wait->Start( ); |
1714 wait->Start( ); |
1700 notifier->After(600000000); |
1715 wait->Start( ); |
1701 wait->Start( ); |
1716 wait->Start( ); |
1717 wait->Start( ); |
|
1718 |
|
1719 |
|
1702 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1720 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1703 lbt.GetFiredTriggersL(Firedtriggers); |
1721 lbt.GetFiredTriggersL(Firedtriggers); |
1704 if(Firedtriggers.Count()==3) |
1722 if(Firedtriggers.Count()==4) |
1705 { |
1723 { |
1706 CleanupStack::PopAndDestroy( notifier ); |
1724 CleanupStack::PopAndDestroy( notifier ); |
1707 CleanupStack::PopAndDestroy( trig ); |
1725 CleanupStack::PopAndDestroy( trig ); |
1708 CleanupStack::Pop( &lbt ); |
1726 CleanupStack::Pop( &lbt ); |
1709 CleanupStack::PopAndDestroy( &lbtserver ); |
1727 CleanupStack::PopAndDestroy( &lbtserver ); |
1776 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1794 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1777 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1795 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1778 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1796 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1779 // set condition |
1797 // set condition |
1780 |
1798 |
1781 TCoordinate coordinate(62.5285,23.9385); |
1799 TCoordinate coordinate; |
1782 // TCoordinate coordinate(62.4438,23.9385); |
1800 GetCurrentCoordinateL( coordinate ); |
1783 coordinate.Move(90,5000); |
1801 coordinate.Move(90,1000); |
1784 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,10000); |
1802 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,2000); |
1785 CleanupStack::PushL( circle ); |
1803 CleanupStack::PushL( circle ); |
1786 |
1804 |
1787 |
1805 |
1788 // ownership of circle object transferred to the condition object |
1806 // ownership of circle object transferred to the condition object |
1789 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1807 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1813 TPosition firePosition; |
1831 TPosition firePosition; |
1814 FireInfo = notifier->GetFiredTrigger(); |
1832 FireInfo = notifier->GetFiredTrigger(); |
1815 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
1833 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
1816 firePosition.Distance(coordinate,trigDistance); |
1834 firePosition.Distance(coordinate,trigDistance); |
1817 |
1835 |
1818 if( trigDistance<=11500 && FireInfo.iTriggerId==trigId) |
1836 if( FireInfo.iTriggerId==trigId) |
1819 { |
1837 { |
1820 |
1838 |
1821 CleanupStack::PopAndDestroy( notifier ); |
1839 CleanupStack::PopAndDestroy( notifier ); |
1822 CleanupStack::PopAndDestroy( trig ); |
1840 CleanupStack::PopAndDestroy( trig ); |
1823 CleanupStack::Pop( &lbt ); |
1841 CleanupStack::Pop( &lbt ); |
1897 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1915 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1898 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1916 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1899 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1917 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1900 // set condition |
1918 // set condition |
1901 |
1919 |
1902 TCoordinate coordinate(62.5285,23.9385); |
1920 TCoordinate coordinate; |
1921 GetCurrentCoordinateL( coordinate ); |
|
1903 |
1922 |
1904 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
1923 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
1905 CleanupStack::PushL( circle ); |
1924 CleanupStack::PushL( circle ); |
1906 |
1925 |
1907 |
1926 |
1908 // ownership of circle object transferred to the condition object |
1927 // ownership of circle object transferred to the condition object |
1909 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1928 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1923 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1942 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1924 |
1943 |
1925 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1944 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1926 wait->Start( ); |
1945 wait->Start( ); |
1927 |
1946 |
1928 coordinate.Move(90,2000); |
1947 coordinate.Move(90,500); |
1929 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
1948 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
1930 circle2->SetCenter(coordinate); |
1949 circle2->SetCenter(coordinate); |
1931 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1950 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1932 circle2, |
1951 circle2, |
1933 CLbtTriggerConditionArea::EFireOnEnter); |
1952 CLbtTriggerConditionArea::EFireOnEnter); |
1934 |
1953 |
1952 } |
1971 } |
1953 FireInfo = notifier->GetFiredTrigger(); |
1972 FireInfo = notifier->GetFiredTrigger(); |
1954 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
1973 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
1955 firePosition.Distance(coordinate,trigDistance); |
1974 firePosition.Distance(coordinate,trigDistance); |
1956 |
1975 |
1957 if( trigDistance<=1000 && FireInfo.iTriggerId==trigId) |
1976 if( FireInfo.iTriggerId==trigId) |
1958 { |
1977 { |
1959 |
1978 |
1960 CleanupStack::PopAndDestroy( notifier ); |
1979 CleanupStack::PopAndDestroy( notifier ); |
1961 CleanupStack::PopAndDestroy( trig ); |
1980 CleanupStack::PopAndDestroy( trig ); |
1962 CleanupStack::Pop( &lbt ); |
1981 CleanupStack::Pop( &lbt ); |
2042 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
2061 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
2043 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
2062 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
2044 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
2063 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
2045 // set condition |
2064 // set condition |
2046 |
2065 |
2047 TCoordinate coordinate(62.5285,23.9385); |
2066 TCoordinate coordinate; |
2067 GetCurrentCoordinateL( coordinate ); |
|
2048 |
2068 |
2049 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,500); |
2069 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
2050 CleanupStack::PushL( circle ); |
2070 CleanupStack::PushL( circle ); |
2051 |
2071 |
2052 |
2072 |
2053 // ownership of circle object transferred to the condition object |
2073 // ownership of circle object transferred to the condition object |
2054 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
2074 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
2068 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
2088 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
2069 |
2089 |
2070 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
2090 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
2071 wait->Start( ); |
2091 wait->Start( ); |
2072 |
2092 |
2073 coordinate.Move(90,2000); |
2093 coordinate.Move(90,300); |
2074 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,800); |
2094 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
2075 circle2->SetCenter(coordinate); |
2095 circle2->SetCenter(coordinate); |
2076 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
2096 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
2077 circle2, |
2097 circle2, |
2078 CLbtTriggerConditionArea::EFireOnEnter); |
2098 CLbtTriggerConditionArea::EFireOnEnter); |
2079 |
2099 |
2080 trig->SetCondition(condition2); |
2100 trig->SetCondition(condition2); |
2081 notifier->CreateTriggers( lbt,*trig,trigIdtochange,ETrue,wait ); |
2101 notifier->CreateTriggers( lbt,*trig,trigIdtochange,ETrue,wait ); |
2082 wait->Start( ); |
2102 wait->Start( ); |
2083 |
2103 |
2084 coordinate.Move(90,2000); |
2104 coordinate.Move(90,400); |
2085 CLbtGeoCircle* circle3=CLbtGeoCircle::NewL(coordinate,700); |
2105 CLbtGeoCircle* circle3=CLbtGeoCircle::NewL(coordinate,100); |
2086 circle3->SetCenter(coordinate); |
2106 circle3->SetCenter(coordinate); |
2087 CLbtTriggerConditionArea* condition3=CLbtTriggerConditionArea::NewL( |
2107 CLbtTriggerConditionArea* condition3=CLbtTriggerConditionArea::NewL( |
2088 circle3, |
2108 circle3, |
2089 CLbtTriggerConditionArea::EFireOnEnter); |
2109 CLbtTriggerConditionArea::EFireOnEnter); |
2090 |
2110 |
2192 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
2212 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
2193 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
2213 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
2194 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
2214 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
2195 // set condition |
2215 // set condition |
2196 |
2216 |
2197 TCoordinate coordinate(62.5285,23.9385); |
2217 TCoordinate coordinate; |
2218 GetCurrentCoordinateL( coordinate ); |
|
2198 |
2219 |
2199 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
2220 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
2200 CleanupStack::PushL( circle ); |
2221 CleanupStack::PushL( circle ); |
2201 |
2222 |
2202 |
2223 |
2203 // ownership of circle object transferred to the condition object |
2224 // ownership of circle object transferred to the condition object |
2204 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
2225 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
2218 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
2239 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
2219 |
2240 |
2220 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
2241 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
2221 wait->Start( ); |
2242 wait->Start( ); |
2222 |
2243 |
2223 coordinate.Move(90,10000); |
2244 coordinate.Move(90,500); |
2224 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
2245 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
2225 circle2->SetCenter(coordinate); |
2246 circle2->SetCenter(coordinate); |
2226 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
2247 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
2227 circle2, |
2248 circle2, |
2228 CLbtTriggerConditionArea::EFireOnEnter); |
2249 CLbtTriggerConditionArea::EFireOnEnter); |
2229 |
2250 |
2233 notifier->StartNotification( wait ); |
2254 notifier->StartNotification( wait ); |
2234 wait->Start( ); |
2255 wait->Start( ); |
2235 // User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile)); |
2256 // User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile)); |
2236 // notifier->After(3000000); |
2257 // notifier->After(3000000); |
2237 // wait->Start( ); |
2258 // wait->Start( ); |
2238 coordinate.Move(270,5000); |
2259 coordinate.Move(270,200); |
2239 CLbtGeoCircle* circle3=CLbtGeoCircle::NewL(coordinate,500); |
2260 CLbtGeoCircle* circle3=CLbtGeoCircle::NewL(coordinate,100); |
2240 circle3->SetCenter(coordinate); |
2261 circle3->SetCenter(coordinate); |
2241 CLbtTriggerConditionArea* condition3=CLbtTriggerConditionArea::NewL( |
2262 CLbtTriggerConditionArea* condition3=CLbtTriggerConditionArea::NewL( |
2242 circle3, |
2263 circle3, |
2243 CLbtTriggerConditionArea::EFireOnEnter); |
2264 CLbtTriggerConditionArea::EFireOnEnter); |
2244 |
2265 |
2345 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
2366 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
2346 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
2367 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
2347 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
2368 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
2348 // set condition |
2369 // set condition |
2349 |
2370 |
2350 TCoordinate coordinate(62.5285,23.9385); |
2371 TCoordinate coordinate; |
2372 GetCurrentCoordinateL( coordinate ); |
|
2351 |
2373 |
2352 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
2374 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
2353 CleanupStack::PushL( circle ); |
2375 CleanupStack::PushL( circle ); |
2354 |
2376 |
2355 |
2377 |
2356 // ownership of circle object transferred to the condition object |
2378 // ownership of circle object transferred to the condition object |
2357 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
2379 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
2371 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
2393 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
2372 |
2394 |
2373 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
2395 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
2374 wait->Start( ); |
2396 wait->Start( ); |
2375 |
2397 |
2376 coordinate.Move(90,5000); |
2398 coordinate.Move(90,500); |
2377 CLbtGeoCircle* circle3=CLbtGeoCircle::NewL(coordinate,500); |
2399 CLbtGeoCircle* circle3=CLbtGeoCircle::NewL(coordinate,100); |
2378 circle3->SetCenter(coordinate); |
2400 circle3->SetCenter(coordinate); |
2379 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
2401 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
2380 circle3, |
2402 circle3, |
2381 CLbtTriggerConditionArea::EFireOnEnter); |
2403 CLbtTriggerConditionArea::EFireOnEnter); |
2382 |
2404 |
2383 trig->SetCondition(condition2); |
2405 trig->SetCondition(condition2); |
2384 notifier->CreateTriggers( lbt,*trig,trigIdtochange,ETrue,wait ); |
2406 notifier->CreateTriggers( lbt,*trig,trigIdtochange,ETrue,wait ); |
2385 wait->Start( ); |
2407 wait->Start( ); |
2386 |
2408 |
2387 coordinate.Move(90,5000); |
2409 coordinate.Move(90,500); |
2388 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
2410 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
2389 circle2->SetCenter(coordinate); |
2411 circle2->SetCenter(coordinate); |
2390 CLbtTriggerConditionArea* condition3=CLbtTriggerConditionArea::NewL( |
2412 CLbtTriggerConditionArea* condition3=CLbtTriggerConditionArea::NewL( |
2391 circle2, |
2413 circle2, |
2392 CLbtTriggerConditionArea::EFireOnEnter); |
2414 CLbtTriggerConditionArea::EFireOnEnter); |
2393 |
2415 |