branch | RCL_3 |
changeset 21 | 6b6920c56e2f |
parent 20 | 2b4ea9893b66 |
20:2b4ea9893b66 | 21:6b6920c56e2f |
---|---|
73 |
73 |
74 #include <EPos_MPosModulesObserver.h> |
74 #include <EPos_MPosModulesObserver.h> |
75 #include <EPos_CPosModuleIdList.h> |
75 #include <EPos_CPosModuleIdList.h> |
76 #include <EPos_CPosModules.h> |
76 #include <EPos_CPosModules.h> |
77 #include <EPos_CPosModuleUpdate.h> // CPosModuleUpdate |
77 #include <EPos_CPosModuleUpdate.h> // CPosModuleUpdate |
78 |
|
79 #include <MProEngEngine.h> |
|
80 #include <Profile.hrh> |
|
81 // EXTERNAL DATA STRUCTURES |
78 // EXTERNAL DATA STRUCTURES |
82 //extern ?external_data; |
79 //extern ?external_data; |
83 |
80 |
84 // EXTERNAL FUNCTION PROTOTYPES |
81 // EXTERNAL FUNCTION PROTOTYPES |
85 //extern ?external_function( ?arg_type,?arg_type ); |
82 //extern ?external_function( ?arg_type,?arg_type ); |
175 CleanupStack::PopAndDestroy( updateParams ); |
172 CleanupStack::PopAndDestroy( updateParams ); |
176 |
173 |
177 CleanupStack::PopAndDestroy( idList ); |
174 CleanupStack::PopAndDestroy( idList ); |
178 CleanupStack::PopAndDestroy( db ); |
175 CleanupStack::PopAndDestroy( db ); |
179 } |
176 } |
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // CAdvancedTriggerSupervision::GetCurrentCoordinateL |
|
183 // Returns current position |
|
184 // ----------------------------------------------------------------------------- |
|
185 // |
|
186 void CAdvancedTriggerSupervision::GetCurrentCoordinateL( TCoordinate& aCoordinate ) |
|
187 { |
|
188 CTriggerFireObserver* notifier= CTriggerFireObserver::NewL(); |
|
189 CleanupStack::PushL( notifier ); |
|
190 CActiveSchedulerWait* wait = new ( ELeave ) CActiveSchedulerWait; |
|
191 CleanupStack::PushL( wait ); |
|
192 TPositionInfo positionInfo; |
|
193 // Ownership of wait is transferred to notifier |
|
194 notifier->CurrentPositionL( positionInfo,wait ); |
|
195 CleanupStack::Pop( wait ); |
|
196 wait->Start(); |
|
197 TPosition position; |
|
198 positionInfo.GetPosition( position ); |
|
199 aCoordinate.SetCoordinate( position.Latitude(),position.Longitude(),position.Altitude() ); |
|
200 CleanupStack::Pop( notifier ); // notifier |
|
201 delete notifier; |
|
202 } |
|
203 |
|
204 // ----------------------------------------------------------------------------- |
|
205 // CAdvancedTriggerSupervision::SetProfileToOfflineL |
|
206 // ----------------------------------------------------------------------------- |
|
207 void CAdvancedTriggerSupervision::SetProfileToOfflineL() |
|
208 { |
|
209 // Store current profile id. |
|
210 iCurrentProfile = iProEngine->ActiveProfileId(); |
|
211 // Change the active profile to Off-line |
|
212 iProEngine->SetActiveProfileL( EProfileOffLineId ); |
|
213 } |
|
214 // ----------------------------------------------------------------------------- |
|
215 // CAdvancedTriggerSupervision::RestoreProfileL |
|
216 // ----------------------------------------------------------------------------- |
|
217 void CAdvancedTriggerSupervision::RestoreProfileL() |
|
218 { |
|
219 iProEngine->SetActiveProfileL( iCurrentProfile ); |
|
220 } |
|
221 |
|
222 // ----------------------------------------------------------------------------- |
177 // ----------------------------------------------------------------------------- |
223 // CAdvancedTriggerSupervision::RunMethodL |
178 // CAdvancedTriggerSupervision::RunMethodL |
224 // Run specified method. Contains also table of test mothods and their names. |
179 // Run specified method. Contains also table of test mothods and their names. |
225 // ----------------------------------------------------------------------------- |
180 // ----------------------------------------------------------------------------- |
226 // |
181 // |
289 CleanupClosePushL( lbtserver ); |
244 CleanupClosePushL( lbtserver ); |
290 iLog->Log(_L("Connection to RLbtServer Passed ")); |
245 iLog->Log(_L("Connection to RLbtServer Passed ")); |
291 User::LeaveIfError( lbt.Open(lbtserver)); |
246 User::LeaveIfError( lbt.Open(lbtserver)); |
292 iLog->Log(_L("Subsession opened ")); |
247 iLog->Log(_L("Subsession opened ")); |
293 CleanupClosePushL( lbt ); |
248 CleanupClosePushL( lbt ); |
294 |
|
295 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
296 // trigger firing. |
|
297 SetProfileToOfflineL(); |
|
298 |
|
299 //Enable only simpsy |
249 //Enable only simpsy |
300 EnableSimPSYL(); |
250 EnableSimPSYL(); |
301 //Clear all triggers |
251 //Clear all triggers |
302 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
252 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
303 |
253 |
328 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
278 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
329 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
279 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
330 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
280 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
331 // set condition |
281 // set condition |
332 |
282 |
333 TCoordinate coordinate; |
283 TCoordinate coordinate(62.5285,23.9385); |
334 GetCurrentCoordinateL( coordinate ); |
284 // TCoordinate coordinate(62.4438,23.9385); |
335 coordinate.Move(90,200); |
285 coordinate.Move(90,2000); |
336 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
286 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
337 CleanupStack::PushL( circle ); |
287 CleanupStack::PushL( circle ); |
338 |
288 |
339 |
289 |
340 // ownership of circle object transferred to the condition object |
290 // ownership of circle object transferred to the condition object |
341 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
291 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
362 iLog->Log(_L("Trigger Fired")); |
312 iLog->Log(_L("Trigger Fired")); |
363 TLbtTriggerFireInfo FireInfo; |
313 TLbtTriggerFireInfo FireInfo; |
364 TReal32 trigDistance; |
314 TReal32 trigDistance; |
365 TPosition firePosition; |
315 TPosition firePosition; |
366 FireInfo = notifier->GetFiredTrigger(); |
316 FireInfo = notifier->GetFiredTrigger(); |
367 iLog->Log(_L("GFT")); |
|
368 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
317 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
369 iLog->Log(_L("GP")); |
|
370 firePosition.Distance(coordinate,trigDistance); |
318 firePosition.Distance(coordinate,trigDistance); |
371 RestoreProfileL(); |
319 |
372 if( FireInfo.iTriggerId==trigId ) |
320 if( trigDistance<=1000 && FireInfo.iTriggerId==trigId ) |
373 { |
321 { |
374 |
322 |
375 CleanupStack::PopAndDestroy( notifier ); |
323 CleanupStack::PopAndDestroy( notifier ); |
376 CleanupStack::PopAndDestroy( trig ); |
324 CleanupStack::PopAndDestroy( trig ); |
377 CleanupStack::Pop( &lbt ); |
325 CleanupStack::Pop( &lbt ); |
414 CleanupClosePushL( lbtserver ); |
362 CleanupClosePushL( lbtserver ); |
415 iLog->Log(_L("Connection to RLbtServer Passed ")); |
363 iLog->Log(_L("Connection to RLbtServer Passed ")); |
416 User::LeaveIfError( lbt.Open(lbtserver)); |
364 User::LeaveIfError( lbt.Open(lbtserver)); |
417 iLog->Log(_L("Subsession opened ")); |
365 iLog->Log(_L("Subsession opened ")); |
418 CleanupClosePushL( lbt ); |
366 CleanupClosePushL( lbt ); |
419 |
|
420 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
421 // trigger firing. |
|
422 SetProfileToOfflineL(); |
|
423 |
|
424 //Enable only simpsy |
367 //Enable only simpsy |
425 EnableSimPSYL(); |
368 EnableSimPSYL(); |
426 //Clear all triggers |
369 //Clear all triggers |
427 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
370 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
428 |
371 |
455 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
398 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
456 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
399 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
457 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
400 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
458 // set condition |
401 // set condition |
459 |
402 |
460 TCoordinate coordinate; |
403 TCoordinate coordinate(62.5285,23.9385); |
461 GetCurrentCoordinateL( coordinate ); |
404 // TCoordinate coordinate(62.4438,23.9385); |
462 coordinate.Move(90,110); |
405 coordinate.Move(90,510); |
463 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,200); |
406 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
464 CleanupStack::PushL( circle ); |
407 CleanupStack::PushL( circle ); |
465 |
408 |
466 |
409 |
467 // ownership of circle object transferred to the condition object |
410 // ownership of circle object transferred to the condition object |
468 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
411 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
491 TReal32 trigDistance; |
434 TReal32 trigDistance; |
492 TPosition firePosition; |
435 TPosition firePosition; |
493 FireInfo = notifier->GetFiredTrigger(); |
436 FireInfo = notifier->GetFiredTrigger(); |
494 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
437 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
495 firePosition.Distance(coordinate,trigDistance); |
438 firePosition.Distance(coordinate,trigDistance); |
496 RestoreProfileL(); |
439 |
497 if( FireInfo.iTriggerId==trigId) |
440 if( trigDistance<=1000 && FireInfo.iTriggerId==trigId) |
498 { |
441 { |
499 |
442 |
500 CleanupStack::PopAndDestroy( notifier ); |
443 CleanupStack::PopAndDestroy( notifier ); |
501 CleanupStack::PopAndDestroy( trig ); |
444 CleanupStack::PopAndDestroy( trig ); |
502 CleanupStack::Pop( &lbt ); |
445 CleanupStack::Pop( &lbt ); |
540 CleanupClosePushL( lbtserver ); |
483 CleanupClosePushL( lbtserver ); |
541 iLog->Log(_L("Connection to RLbtServer Passed ")); |
484 iLog->Log(_L("Connection to RLbtServer Passed ")); |
542 User::LeaveIfError( lbt.Open(lbtserver)); |
485 User::LeaveIfError( lbt.Open(lbtserver)); |
543 iLog->Log(_L("Subsession opened ")); |
486 iLog->Log(_L("Subsession opened ")); |
544 CleanupClosePushL( lbt ); |
487 CleanupClosePushL( lbt ); |
545 |
|
546 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
547 // trigger firing. |
|
548 SetProfileToOfflineL(); |
|
549 |
|
550 //Enable only simpsy |
488 //Enable only simpsy |
551 EnableSimPSYL(); |
489 EnableSimPSYL(); |
552 //Clear all triggers |
490 //Clear all triggers |
553 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
491 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
554 |
492 |
581 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
519 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
582 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
520 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
583 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
521 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
584 // set condition |
522 // set condition |
585 |
523 |
586 TCoordinate coordinate; |
524 TCoordinate coordinate(62.5285,23.9385); |
587 GetCurrentCoordinateL( coordinate ); |
525 // TCoordinate coordinate(62.4438,23.9385); |
588 |
526 |
589 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
527 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
590 CleanupStack::PushL( circle ); |
528 CleanupStack::PushL( circle ); |
591 |
529 |
592 |
530 |
593 // ownership of circle object transferred to the condition object |
531 // ownership of circle object transferred to the condition object |
594 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
532 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
617 TReal32 trigDistance; |
555 TReal32 trigDistance; |
618 TPosition firePosition; |
556 TPosition firePosition; |
619 FireInfo = notifier->GetFiredTrigger(); |
557 FireInfo = notifier->GetFiredTrigger(); |
620 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
558 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
621 firePosition.Distance(coordinate,trigDistance); |
559 firePosition.Distance(coordinate,trigDistance); |
622 RestoreProfileL(); |
560 |
623 if( FireInfo.iTriggerId==trigId) |
561 if( trigDistance<=1000 && FireInfo.iTriggerId==trigId) |
624 { |
562 { |
625 |
563 |
626 CleanupStack::PopAndDestroy( notifier ); |
564 CleanupStack::PopAndDestroy( notifier ); |
627 CleanupStack::PopAndDestroy( trig ); |
565 CleanupStack::PopAndDestroy( trig ); |
628 CleanupStack::Pop( &lbt ); |
566 CleanupStack::Pop( &lbt ); |
665 CleanupClosePushL( lbtserver ); |
603 CleanupClosePushL( lbtserver ); |
666 iLog->Log(_L("Connection to RLbtServer Passed ")); |
604 iLog->Log(_L("Connection to RLbtServer Passed ")); |
667 User::LeaveIfError( lbt.Open(lbtserver)); |
605 User::LeaveIfError( lbt.Open(lbtserver)); |
668 iLog->Log(_L("Subsession opened ")); |
606 iLog->Log(_L("Subsession opened ")); |
669 CleanupClosePushL( lbt ); |
607 CleanupClosePushL( lbt ); |
670 |
|
671 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
672 // trigger firing. |
|
673 SetProfileToOfflineL(); |
|
674 |
|
675 //Enable only simpsy |
608 //Enable only simpsy |
676 EnableSimPSYL(); |
609 EnableSimPSYL(); |
677 //Clear all triggers |
610 //Clear all triggers |
678 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
611 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
679 |
612 |
704 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
637 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
705 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
638 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
706 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
639 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
707 // set condition |
640 // set condition |
708 |
641 |
709 TCoordinate coordinate; |
642 TCoordinate coordinate(62.5285,23.9385); |
710 GetCurrentCoordinateL( coordinate ); |
643 // TCoordinate coordinate(62.4438,23.9385); |
711 coordinate.Move(90,200); |
644 coordinate.Move(90,2000); |
712 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
645 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
713 CleanupStack::PushL( circle ); |
646 CleanupStack::PushL( circle ); |
714 |
647 |
715 |
648 |
716 // ownership of circle object transferred to the condition object |
649 // ownership of circle object transferred to the condition object |
717 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
650 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
740 TReal32 trigDistance; |
673 TReal32 trigDistance; |
741 TPosition firePosition; |
674 TPosition firePosition; |
742 FireInfo = notifier->GetFiredTrigger(); |
675 FireInfo = notifier->GetFiredTrigger(); |
743 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
676 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
744 firePosition.Distance(coordinate,trigDistance); |
677 firePosition.Distance(coordinate,trigDistance); |
745 RestoreProfileL(); |
678 |
746 if( FireInfo.iTriggerId==trigId) |
679 if( trigDistance>=1000 && FireInfo.iTriggerId==trigId) |
747 { |
680 { |
748 |
681 |
749 CleanupStack::PopAndDestroy( notifier ); |
682 CleanupStack::PopAndDestroy( notifier ); |
750 CleanupStack::PopAndDestroy( trig ); |
683 CleanupStack::PopAndDestroy( trig ); |
751 CleanupStack::Pop( &lbt ); |
684 CleanupStack::Pop( &lbt ); |
789 CleanupClosePushL( lbtserver ); |
722 CleanupClosePushL( lbtserver ); |
790 iLog->Log(_L("Connection to RLbtServer Passed ")); |
723 iLog->Log(_L("Connection to RLbtServer Passed ")); |
791 User::LeaveIfError( lbt.Open(lbtserver)); |
724 User::LeaveIfError( lbt.Open(lbtserver)); |
792 iLog->Log(_L("Subsession opened ")); |
725 iLog->Log(_L("Subsession opened ")); |
793 CleanupClosePushL( lbt ); |
726 CleanupClosePushL( lbt ); |
794 |
|
795 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
796 // trigger firing. |
|
797 SetProfileToOfflineL(); |
|
798 |
|
799 //Enable only simpsy |
727 //Enable only simpsy |
800 EnableSimPSYL(); |
728 EnableSimPSYL(); |
801 //Clear all triggers |
729 //Clear all triggers |
802 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
730 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
803 |
731 |
830 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
758 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
831 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
759 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
832 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
760 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
833 // set condition |
761 // set condition |
834 |
762 |
835 TCoordinate coordinate; |
763 TCoordinate coordinate(62.5285,23.9385); |
836 GetCurrentCoordinateL( coordinate ); |
764 // TCoordinate coordinate(62.4438,23.9385); |
837 coordinate.Move(90,110); |
765 coordinate.Move(90,1010); |
838 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
766 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
839 CleanupStack::PushL( circle ); |
767 CleanupStack::PushL( circle ); |
840 |
768 |
841 |
769 |
842 // ownership of circle object transferred to the condition object |
770 // ownership of circle object transferred to the condition object |
843 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
771 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
866 TReal32 trigDistance; |
794 TReal32 trigDistance; |
867 TPosition firePosition; |
795 TPosition firePosition; |
868 FireInfo = notifier->GetFiredTrigger(); |
796 FireInfo = notifier->GetFiredTrigger(); |
869 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
797 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
870 firePosition.Distance(coordinate,trigDistance); |
798 firePosition.Distance(coordinate,trigDistance); |
871 |
799 |
872 RestoreProfileL(); |
800 if( trigDistance>=1000 && FireInfo.iTriggerId==trigId) |
873 if( FireInfo.iTriggerId==trigId) |
|
874 { |
801 { |
875 |
802 |
876 CleanupStack::PopAndDestroy( notifier ); |
803 CleanupStack::PopAndDestroy( notifier ); |
877 CleanupStack::PopAndDestroy( trig ); |
804 CleanupStack::PopAndDestroy( trig ); |
878 CleanupStack::Pop( &lbt ); |
805 CleanupStack::Pop( &lbt ); |
916 CleanupClosePushL( lbtserver ); |
843 CleanupClosePushL( lbtserver ); |
917 iLog->Log(_L("Connection to RLbtServer Passed ")); |
844 iLog->Log(_L("Connection to RLbtServer Passed ")); |
918 User::LeaveIfError( lbt.Open(lbtserver)); |
845 User::LeaveIfError( lbt.Open(lbtserver)); |
919 iLog->Log(_L("Subsession opened ")); |
846 iLog->Log(_L("Subsession opened ")); |
920 CleanupClosePushL( lbt ); |
847 CleanupClosePushL( lbt ); |
921 |
|
922 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
923 // trigger firing. |
|
924 SetProfileToOfflineL(); |
|
925 |
|
926 //Enable only simpsy |
848 //Enable only simpsy |
927 EnableSimPSYL(); |
849 EnableSimPSYL(); |
928 //Clear all triggers |
850 //Clear all triggers |
929 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
851 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
930 |
852 |
957 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
879 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
958 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
880 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
959 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
881 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
960 // set condition |
882 // set condition |
961 |
883 |
962 TCoordinate coordinate; |
884 TCoordinate coordinate(62.5285,23.9385); |
963 GetCurrentCoordinateL( coordinate ); |
885 // TCoordinate coordinate(62.4438,23.9385); |
964 |
886 |
965 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
887 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
966 CleanupStack::PushL( circle ); |
888 CleanupStack::PushL( circle ); |
967 |
889 |
968 |
890 |
969 // ownership of circle object transferred to the condition object |
891 // ownership of circle object transferred to the condition object |
970 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
892 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
993 TReal32 trigDistance; |
915 TReal32 trigDistance; |
994 TPosition firePosition; |
916 TPosition firePosition; |
995 FireInfo = notifier->GetFiredTrigger(); |
917 FireInfo = notifier->GetFiredTrigger(); |
996 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
918 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
997 firePosition.Distance(coordinate,trigDistance); |
919 firePosition.Distance(coordinate,trigDistance); |
998 |
920 |
999 RestoreProfileL(); |
921 if( trigDistance>=1000 && FireInfo.iTriggerId==trigId) |
1000 if( FireInfo.iTriggerId==trigId) |
|
1001 { |
922 { |
1002 |
923 |
1003 CleanupStack::PopAndDestroy( notifier ); |
924 CleanupStack::PopAndDestroy( notifier ); |
1004 CleanupStack::PopAndDestroy( trig ); |
925 CleanupStack::PopAndDestroy( trig ); |
1005 CleanupStack::Pop( &lbt ); |
926 CleanupStack::Pop( &lbt ); |
1030 // ----------------------------------------------------------------------------- |
951 // ----------------------------------------------------------------------------- |
1031 //Nested triggers - one trigger inside another |
952 //Nested triggers - one trigger inside another |
1032 TInt CAdvancedTriggerSupervision::ATSTest7L( CStifItemParser& aItem ) |
953 TInt CAdvancedTriggerSupervision::ATSTest7L( CStifItemParser& aItem ) |
1033 { |
954 { |
1034 |
955 |
1035 |
|
1036 iLog->Log(_L("Entering Test1")); |
|
1037 _LIT( KSimulationFile,"c:\\system\\data\\simu_move3.sps" ); |
|
1038 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
|
1039 |
|
1040 RLbtServer lbtserver; |
|
1041 RLbt lbt; |
|
1042 iLog->Log(_L("Before connecting")); |
|
1043 User::LeaveIfError( lbtserver.Connect() ); |
|
1044 CleanupClosePushL( lbtserver ); |
|
1045 iLog->Log(_L("Connection to RLbtServer Passed ")); |
|
1046 User::LeaveIfError( lbt.Open(lbtserver)); |
|
1047 iLog->Log(_L("Subsession opened ")); |
|
1048 CleanupClosePushL( lbt ); |
|
1049 |
|
1050 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
1051 // trigger firing. |
|
1052 SetProfileToOfflineL(); |
|
1053 |
|
1054 //Enable only simpsy |
|
1055 EnableSimPSYL(); |
|
1056 //Clear all triggers |
|
1057 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
|
1058 CRepository* repository = CRepository::NewLC(KCRUidSimulationPSY); |
|
1059 iLog->Log(_L("Simulation PSY Repository object created")); |
|
1060 // User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile0)); |
|
1061 User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile)); |
|
1062 iLog->Log(_L("Simulation input file set ")); |
|
1063 CleanupStack::PopAndDestroy(repository); |
|
1064 |
|
1065 //Construct a startup trigger |
|
1066 CLbtStartupTrigger* trig = CLbtStartupTrigger::NewL(); |
|
1067 |
|
1068 //Push to cleanup stack |
|
1069 CleanupStack::PushL( trig ); |
|
1070 iLog->Log(_L("Startup Trigger Entry Created ")); |
|
1071 |
|
1072 // Set Name |
|
1073 trig->SetNameL(_L("Trigger1")); |
|
1074 trig->SetNameL(_L("abc")); |
|
1075 _LIT( KMyTriggerHandlingProcessName, "About.exe"); |
|
1076 // _LIT( KMyTriggerHandlingProcessName, "TestServerStarter.exe"); |
|
1077 // _LIT( KMyTriggerHandlingProcessName, "ConsoleUI.exe"); |
|
1078 |
|
1079 TSecureId secureid; |
|
1080 trig->SetProcessId(KMyTriggerHandlingProcessName,secureid); |
|
1081 |
|
1082 //set Requestor |
|
1083 CRequestorBase::TRequestorType ReqType=CRequestorBase::ERequestorUnknown; |
|
1084 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
|
1085 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
|
1086 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
|
1087 // set condition |
|
1088 |
|
1089 TCoordinate coordinate; |
|
1090 GetCurrentCoordinateL( coordinate ); |
|
1091 |
|
1092 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,200); |
|
1093 CleanupStack::PushL( circle ); |
|
1094 |
|
1095 |
|
1096 // ownership of circle object transferred to the condition object |
|
1097 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
|
1098 circle, |
|
1099 CLbtTriggerConditionArea::EFireOnEnter); |
|
1100 |
|
1101 CleanupStack::Pop( circle ); |
|
1102 |
|
1103 trig->SetCondition(condition); // ownership transferred to object |
|
1104 |
|
1105 TLbtTriggerId trigId; |
|
1106 |
|
1107 |
|
1108 CTriggerFireObserver* notifier= CTriggerFireObserver::NewL( lbt,coordinate); |
|
1109 CleanupStack::PushL( notifier ); |
|
1110 |
|
1111 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
|
1112 |
|
1113 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1114 wait->Start( ); |
|
1115 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
|
1116 circle2->SetRadius(500); |
|
1117 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
|
1118 circle2, |
|
1119 CLbtTriggerConditionArea::EFireOnEnter); |
|
1120 |
|
1121 trig->SetCondition(condition2); |
|
1122 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
|
1123 wait->Start( ); |
|
1124 |
|
1125 iLog->Log(_L("Triggers Created")); |
|
1126 notifier->StartNotification( wait ); |
|
1127 wait->Start( ); |
|
1128 wait->Start( ); |
|
1129 RArray<TLbtTriggerFireInfo> Firedtriggers; |
|
1130 lbt.GetFiredTriggersL(Firedtriggers); |
|
1131 RestoreProfileL(); |
|
1132 if(Firedtriggers.Count()==2) |
|
1133 { |
|
1134 CleanupStack::PopAndDestroy( notifier ); |
|
1135 CleanupStack::PopAndDestroy( trig ); |
|
1136 CleanupStack::Pop( &lbt ); |
|
1137 CleanupStack::PopAndDestroy( &lbtserver ); |
|
1138 return KErrNone; |
|
1139 } |
|
1140 else |
|
1141 { |
|
1142 CleanupStack::PopAndDestroy( notifier ); |
|
1143 CleanupStack::PopAndDestroy( trig ); |
|
1144 CleanupStack::Pop( &lbt ); |
|
1145 CleanupStack::PopAndDestroy( &lbtserver ); |
|
1146 return -99; |
|
1147 } |
|
1148 |
|
1149 // return KErrNone; |
|
1150 |
|
1151 } |
|
1152 |
|
1153 |
|
1154 // ----------------------------------------------------------------------------- |
|
1155 // CAdvancedTriggerSupervision::ATSTest8 |
|
1156 // Example test method function. |
|
1157 // (other items were commented in a header). |
|
1158 // ----------------------------------------------------------------------------- |
|
1159 //Nested triggers - same as above - in this case inside is an exit and outside is an entry |
|
1160 |
|
1161 //trigger |
|
1162 TInt CAdvancedTriggerSupervision::ATSTest8L( CStifItemParser& aItem ) |
|
1163 { |
|
1164 |
|
1165 iLog->Log(_L("Entering Test1")); |
956 iLog->Log(_L("Entering Test1")); |
1166 _LIT( KSimulationFile,"c:\\system\\data\\simu_move3.sps" ); |
957 _LIT( KSimulationFile,"c:\\system\\data\\simu_move1.sps" ); |
1167 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
958 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
1168 |
959 |
1169 RLbtServer lbtserver; |
960 RLbtServer lbtserver; |
1170 RLbt lbt; |
961 RLbt lbt; |
1171 iLog->Log(_L("Before connecting")); |
962 iLog->Log(_L("Before connecting")); |
1173 CleanupClosePushL( lbtserver ); |
964 CleanupClosePushL( lbtserver ); |
1174 iLog->Log(_L("Connection to RLbtServer Passed ")); |
965 iLog->Log(_L("Connection to RLbtServer Passed ")); |
1175 User::LeaveIfError( lbt.Open(lbtserver)); |
966 User::LeaveIfError( lbt.Open(lbtserver)); |
1176 iLog->Log(_L("Subsession opened ")); |
967 iLog->Log(_L("Subsession opened ")); |
1177 CleanupClosePushL( lbt ); |
968 CleanupClosePushL( lbt ); |
969 //Enable only simpsy |
|
970 EnableSimPSYL(); |
|
971 //Clear all triggers |
|
972 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
|
1178 |
973 |
1179 // Set profile to offline mode.This is required to avoid movement detection blocking the |
974 CRepository* repository = CRepository::NewLC(KCRUidSimulationPSY); |
1180 // trigger firing. |
975 iLog->Log(_L("Simulation PSY Repository object created")); |
1181 SetProfileToOfflineL(); |
976 // User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile0)); |
977 User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile)); |
|
978 iLog->Log(_L("Simulation input file set ")); |
|
979 CleanupStack::PopAndDestroy(repository); |
|
980 |
|
981 //Construct a startup trigger |
|
982 CLbtStartupTrigger* trig = CLbtStartupTrigger::NewL(); |
|
983 |
|
984 //Push to cleanup stack |
|
985 CleanupStack::PushL( trig ); |
|
986 iLog->Log(_L("Startup Trigger Entry Created ")); |
|
987 |
|
988 // Set Name |
|
989 trig->SetNameL(_L("Trigger1")); |
|
990 trig->SetNameL(_L("abc")); |
|
991 _LIT( KMyTriggerHandlingProcessName, "About.exe"); |
|
992 // _LIT( KMyTriggerHandlingProcessName, "TestServerStarter.exe"); |
|
993 // _LIT( KMyTriggerHandlingProcessName, "ConsoleUI.exe"); |
|
994 |
|
995 TSecureId secureid; |
|
996 trig->SetProcessId(KMyTriggerHandlingProcessName,secureid); |
|
997 |
|
998 //set Requestor |
|
999 CRequestorBase::TRequestorType ReqType=CRequestorBase::ERequestorUnknown; |
|
1000 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
|
1001 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
|
1002 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
|
1003 // set condition |
|
1004 |
|
1005 TCoordinate coordinate(62.5285,23.9385); |
|
1006 // TCoordinate coordinate(62.4438,23.9385); |
|
1007 |
|
1008 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
|
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 ); |
|
1182 |
1094 |
1183 //Enable only simpsy |
1095 //Enable only simpsy |
1184 EnableSimPSYL(); |
1096 EnableSimPSYL(); |
1185 //Clear all triggers |
1097 //Clear all triggers |
1186 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1098 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1213 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1125 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1214 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1126 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1215 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1127 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1216 // set condition |
1128 // set condition |
1217 |
1129 |
1218 TCoordinate coordinate; |
1130 TCoordinate coordinate(62.5285,23.9385); |
1219 GetCurrentCoordinateL( coordinate ); |
1131 // TCoordinate coordinate(62.4438,23.9385); |
1220 |
1132 |
1221 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,200); |
1133 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
1222 CleanupStack::PushL( circle ); |
1134 CleanupStack::PushL( circle ); |
1223 |
1135 |
1224 |
1136 |
1225 // ownership of circle object transferred to the condition object |
1137 // ownership of circle object transferred to the condition object |
1226 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1138 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1239 |
1151 |
1240 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1152 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1241 |
1153 |
1242 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1154 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1243 wait->Start( ); |
1155 wait->Start( ); |
1244 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
1156 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
1245 circle2->SetRadius(500); |
1157 circle2->SetRadius(500); |
1246 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1158 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1247 circle2, |
1159 circle2, |
1248 CLbtTriggerConditionArea::EFireOnExit); |
1160 CLbtTriggerConditionArea::EFireOnExit); |
1249 |
1161 |
1252 wait->Start( ); |
1164 wait->Start( ); |
1253 |
1165 |
1254 iLog->Log(_L("Triggers Created")); |
1166 iLog->Log(_L("Triggers Created")); |
1255 notifier->StartNotification( wait ); |
1167 notifier->StartNotification( wait ); |
1256 wait->Start( ); |
1168 wait->Start( ); |
1169 // notifier->StartNotification( wait ); |
|
1170 // wait->Start( ); |
|
1171 notifier->After(1200000000); |
|
1257 wait->Start( ); |
1172 wait->Start( ); |
1258 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1173 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1259 lbt.GetFiredTriggersL(Firedtriggers); |
1174 lbt.GetFiredTriggersL(Firedtriggers); |
1260 RestoreProfileL(); |
|
1261 if(Firedtriggers.Count()==2) |
1175 if(Firedtriggers.Count()==2) |
1262 { |
1176 { |
1263 CleanupStack::PopAndDestroy( notifier ); |
1177 CleanupStack::PopAndDestroy( notifier ); |
1264 CleanupStack::PopAndDestroy( trig ); |
1178 CleanupStack::PopAndDestroy( trig ); |
1265 CleanupStack::Pop( &lbt ); |
1179 CleanupStack::Pop( &lbt ); |
1303 iLog->Log(_L("Connection to RLbtServer Passed ")); |
1217 iLog->Log(_L("Connection to RLbtServer Passed ")); |
1304 User::LeaveIfError( lbt.Open(lbtserver)); |
1218 User::LeaveIfError( lbt.Open(lbtserver)); |
1305 iLog->Log(_L("Subsession opened ")); |
1219 iLog->Log(_L("Subsession opened ")); |
1306 CleanupClosePushL( lbt ); |
1220 CleanupClosePushL( lbt ); |
1307 |
1221 |
1308 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
1309 // trigger firing. |
|
1310 SetProfileToOfflineL(); |
|
1311 |
|
1312 //Enable only simpsy |
1222 //Enable only simpsy |
1313 EnableSimPSYL(); |
1223 EnableSimPSYL(); |
1314 //Clear all triggers |
1224 //Clear all triggers |
1315 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1225 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1316 CRepository* repository = CRepository::NewLC(KCRUidSimulationPSY); |
1226 CRepository* repository = CRepository::NewLC(KCRUidSimulationPSY); |
1342 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1252 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1343 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1253 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1344 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1254 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1345 // set condition |
1255 // set condition |
1346 |
1256 |
1347 TCoordinate coordinate; |
1257 TCoordinate coordinate(62.5285,23.9385); |
1348 GetCurrentCoordinateL( coordinate ); |
1258 // TCoordinate coordinate(62.4438,23.9385); |
1349 |
1259 |
1350 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,200); |
1260 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,500); |
1351 CleanupStack::PushL( circle ); |
1261 CleanupStack::PushL( circle ); |
1352 |
1262 |
1353 |
1263 |
1354 // ownership of circle object transferred to the condition object |
1264 // ownership of circle object transferred to the condition object |
1355 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1265 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1368 |
1278 |
1369 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1279 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1370 |
1280 |
1371 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1281 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1372 wait->Start( ); |
1282 wait->Start( ); |
1373 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,200); |
1283 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
1284 circle2->SetRadius(250); |
|
1374 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1285 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1375 circle2, |
1286 circle2, |
1376 CLbtTriggerConditionArea::EFireOnEnter); |
1287 CLbtTriggerConditionArea::EFireOnEnter); |
1377 |
1288 |
1378 trig->SetCondition(condition2); |
1289 trig->SetCondition(condition2); |
1380 wait->Start( ); |
1291 wait->Start( ); |
1381 |
1292 |
1382 iLog->Log(_L("Triggers Created")); |
1293 iLog->Log(_L("Triggers Created")); |
1383 notifier->StartNotification( wait ); |
1294 notifier->StartNotification( wait ); |
1384 wait->Start( ); |
1295 wait->Start( ); |
1385 wait->Start( ); |
1296 // notifier->StartNotification( wait ); |
1297 // wait->Start( ); |
|
1386 |
1298 |
1299 notifier->After(120000000); |
|
1300 wait->Start( ); |
|
1387 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1301 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1388 lbt.GetFiredTriggersL(Firedtriggers); |
1302 lbt.GetFiredTriggersL(Firedtriggers); |
1389 CleanupStack::PopAndDestroy( notifier ); |
1303 CleanupStack::PopAndDestroy( notifier ); |
1390 CleanupStack::PopAndDestroy( trig ); |
1304 CleanupStack::PopAndDestroy( trig ); |
1391 CleanupStack::Pop( &lbt ); |
1305 CleanupStack::Pop( &lbt ); |
1392 CleanupStack::PopAndDestroy( &lbtserver ); |
1306 CleanupStack::PopAndDestroy( &lbtserver ); |
1393 //delete wait; |
1307 //delete wait; |
1394 RestoreProfileL(); |
|
1395 if(Firedtriggers.Count()==2) |
1308 if(Firedtriggers.Count()==2) |
1396 { |
1309 { |
1397 return KErrNone; |
1310 return KErrNone; |
1398 } |
1311 } |
1399 else |
1312 else |
1426 CleanupClosePushL( lbtserver ); |
1339 CleanupClosePushL( lbtserver ); |
1427 iLog->Log(_L("Connection to RLbtServer Passed ")); |
1340 iLog->Log(_L("Connection to RLbtServer Passed ")); |
1428 User::LeaveIfError( lbt.Open(lbtserver)); |
1341 User::LeaveIfError( lbt.Open(lbtserver)); |
1429 iLog->Log(_L("Subsession opened ")); |
1342 iLog->Log(_L("Subsession opened ")); |
1430 CleanupClosePushL( lbt ); |
1343 CleanupClosePushL( lbt ); |
1431 |
|
1432 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
1433 // trigger firing. |
|
1434 SetProfileToOfflineL(); |
|
1435 |
|
1436 //Enable only simpsy |
1344 //Enable only simpsy |
1437 EnableSimPSYL(); |
1345 EnableSimPSYL(); |
1438 //Clear all triggers |
1346 //Clear all triggers |
1439 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1347 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1440 |
1348 |
1467 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1375 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1468 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1376 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1469 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1377 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1470 // set condition |
1378 // set condition |
1471 |
1379 |
1472 TCoordinate coordinate; |
1380 TCoordinate coordinate(62.5285,23.9385); |
1473 GetCurrentCoordinateL( coordinate ); |
|
1474 |
1381 |
1475 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
1382 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,500); |
1476 CleanupStack::PushL( circle ); |
1383 CleanupStack::PushL( circle ); |
1477 |
1384 |
1478 |
1385 |
1479 // ownership of circle object transferred to the condition object |
1386 // ownership of circle object transferred to the condition object |
1480 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1387 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1493 |
1400 |
1494 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1401 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1495 |
1402 |
1496 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1403 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1497 wait->Start( ); |
1404 wait->Start( ); |
1498 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
1405 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
1499 coordinate.Move(90,200); |
1406 circle2->SetRadius(500); |
1407 coordinate.Move(90,1000); |
|
1500 circle2->SetCenter(coordinate); |
1408 circle2->SetCenter(coordinate); |
1501 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1409 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1502 circle2, |
1410 circle2, |
1503 CLbtTriggerConditionArea::EFireOnExit); |
1411 CLbtTriggerConditionArea::EFireOnExit); |
1504 |
1412 |
1507 wait->Start( ); |
1415 wait->Start( ); |
1508 |
1416 |
1509 iLog->Log(_L("Triggers Created")); |
1417 iLog->Log(_L("Triggers Created")); |
1510 notifier->StartNotification( wait ); |
1418 notifier->StartNotification( wait ); |
1511 wait->Start( ); |
1419 wait->Start( ); |
1420 // notifier->StartNotification( wait ); |
|
1421 // wait->Start( ); |
|
1422 notifier->After(120000000); |
|
1512 wait->Start( ); |
1423 wait->Start( ); |
1513 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1424 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1514 lbt.GetFiredTriggersL(Firedtriggers); |
1425 lbt.GetFiredTriggersL(Firedtriggers); |
1515 RestoreProfileL(); |
|
1516 if(Firedtriggers.Count()==2) |
1426 if(Firedtriggers.Count()==2) |
1517 { |
1427 { |
1518 CleanupStack::PopAndDestroy( notifier ); |
1428 CleanupStack::PopAndDestroy( notifier ); |
1519 CleanupStack::PopAndDestroy( trig ); |
1429 CleanupStack::PopAndDestroy( trig ); |
1520 CleanupStack::Pop( &lbt ); |
1430 CleanupStack::Pop( &lbt ); |
1557 iLog->Log(_L("Connection to RLbtServer Passed ")); |
1467 iLog->Log(_L("Connection to RLbtServer Passed ")); |
1558 User::LeaveIfError( lbt.Open(lbtserver)); |
1468 User::LeaveIfError( lbt.Open(lbtserver)); |
1559 iLog->Log(_L("Subsession opened ")); |
1469 iLog->Log(_L("Subsession opened ")); |
1560 CleanupClosePushL( lbt ); |
1470 CleanupClosePushL( lbt ); |
1561 |
1471 |
1562 |
|
1563 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
1564 // trigger firing. |
|
1565 SetProfileToOfflineL(); |
|
1566 |
|
1567 //Enable only simpsy |
1472 //Enable only simpsy |
1568 EnableSimPSYL(); |
1473 EnableSimPSYL(); |
1569 //Clear all triggers |
1474 //Clear all triggers |
1570 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1475 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1571 |
1476 |
1598 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1503 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1599 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1504 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1600 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1505 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1601 // set condition |
1506 // set condition |
1602 |
1507 |
1603 TCoordinate coordinate; |
1508 TCoordinate coordinate(62.5285,23.9385); |
1604 GetCurrentCoordinateL( coordinate ); |
|
1605 |
1509 |
1606 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
1510 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,500); |
1607 CleanupStack::PushL( circle ); |
1511 CleanupStack::PushL( circle ); |
1608 |
1512 |
1609 |
1513 |
1610 // ownership of circle object transferred to the condition object |
1514 // ownership of circle object transferred to the condition object |
1611 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1515 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1625 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1529 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1626 |
1530 |
1627 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1531 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1628 wait->Start( ); |
1532 wait->Start( ); |
1629 |
1533 |
1630 coordinate.Move(90,100); |
1534 coordinate.Move(90,500); |
1631 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
1535 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
1632 circle2->SetCenter(coordinate); |
1536 circle2->SetCenter(coordinate); |
1633 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1537 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1634 circle2, |
1538 circle2, |
1635 CLbtTriggerConditionArea::EFireOnEnter); |
1539 CLbtTriggerConditionArea::EFireOnEnter); |
1636 |
1540 |
1639 wait->Start( ); |
1543 wait->Start( ); |
1640 |
1544 |
1641 iLog->Log(_L("Triggers Created")); |
1545 iLog->Log(_L("Triggers Created")); |
1642 notifier->StartNotification( wait ); |
1546 notifier->StartNotification( wait ); |
1643 wait->Start( ); |
1547 wait->Start( ); |
1644 wait->Start( ); |
1548 notifier->After(120000000); |
1645 |
1549 wait->Start( ); |
1646 iLog->Log(_L("Trigger Fired")); |
1550 iLog->Log(_L("Trigger Fired")); |
1647 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1551 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1648 lbt.GetFiredTriggersL(Firedtriggers); |
1552 lbt.GetFiredTriggersL(Firedtriggers); |
1649 RestoreProfileL(); |
|
1650 if(Firedtriggers.Count()==2) |
1553 if(Firedtriggers.Count()==2) |
1651 { |
1554 { |
1652 CleanupStack::PopAndDestroy( notifier ); |
1555 CleanupStack::PopAndDestroy( notifier ); |
1653 CleanupStack::PopAndDestroy( trig ); |
1556 CleanupStack::PopAndDestroy( trig ); |
1654 CleanupStack::Pop( &lbt ); |
1557 CleanupStack::Pop( &lbt ); |
1676 //Testing of cluster of triggers |
1579 //Testing of cluster of triggers |
1677 TInt CAdvancedTriggerSupervision::ATSTest12L( CStifItemParser& aItem ) |
1580 TInt CAdvancedTriggerSupervision::ATSTest12L( CStifItemParser& aItem ) |
1678 { |
1581 { |
1679 |
1582 |
1680 iLog->Log(_L("Entering Test1")); |
1583 iLog->Log(_L("Entering Test1")); |
1681 _LIT( KSimulationFile,"c:\\system\\data\\simu_move2.sps" ); |
1584 _LIT( KSimulationFile,"c:\\system\\data\\test3.nme" ); |
1682 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
1585 // _LIT( KSimulationFile0,"c:\\system\\data\\simu_move2.sps" ); |
1683 |
1586 |
1684 RLbtServer lbtserver; |
1587 RLbtServer lbtserver; |
1685 RLbt lbt; |
1588 RLbt lbt; |
1686 iLog->Log(_L("Before connecting")); |
1589 iLog->Log(_L("Before connecting")); |
1688 CleanupClosePushL( lbtserver ); |
1591 CleanupClosePushL( lbtserver ); |
1689 iLog->Log(_L("Connection to RLbtServer Passed ")); |
1592 iLog->Log(_L("Connection to RLbtServer Passed ")); |
1690 User::LeaveIfError( lbt.Open(lbtserver)); |
1593 User::LeaveIfError( lbt.Open(lbtserver)); |
1691 iLog->Log(_L("Subsession opened ")); |
1594 iLog->Log(_L("Subsession opened ")); |
1692 CleanupClosePushL( lbt ); |
1595 CleanupClosePushL( lbt ); |
1693 |
|
1694 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
1695 // trigger firing. |
|
1696 SetProfileToOfflineL(); |
|
1697 |
1596 |
1698 //Enable only simpsy |
1597 //Enable only simpsy |
1699 EnableSimPSYL(); |
1598 EnableSimPSYL(); |
1700 //Clear all triggers |
1599 //Clear all triggers |
1701 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1600 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1729 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1628 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1730 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1629 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1731 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1630 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1732 // set condition |
1631 // set condition |
1733 |
1632 |
1734 TCoordinate coordinate; |
1633 TCoordinate coordinate(62.5285,23.9385); |
1735 GetCurrentCoordinateL( coordinate ); |
1634 |
1736 |
1635 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
1737 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
|
1738 CleanupStack::PushL( circle ); |
1636 CleanupStack::PushL( circle ); |
1739 |
1637 |
1740 |
1638 |
1741 // ownership of circle object transferred to the condition object |
1639 // ownership of circle object transferred to the condition object |
1742 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1640 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1755 |
1653 |
1756 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1654 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1757 |
1655 |
1758 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1656 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1759 wait->Start( ); |
1657 wait->Start( ); |
1760 TCoordinate movCoordinates( coordinate.Latitude(),coordinate.Longitude() ); |
1658 TCoordinate coordinates[10]= |
1761 |
|
1762 TCoordinate coordinates[4]; |
|
1763 // Initialise the coordinate |
|
1764 for( TInt i=0;i<4;i++ ) |
|
1765 { |
1659 { |
1766 movCoordinates.Move( 90,300 ); |
1660 TCoordinate(62.5285,23.9385) , |
1767 coordinates[i] = movCoordinates; |
1661 TCoordinate(62.5267,23.9636), |
1768 } |
1662 TCoordinate(62.5167,23.9528), |
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)}; |
|
1769 for(int i=0;i<4;i++) |
1670 for(int i=0;i<4;i++) |
1770 { |
1671 { |
1771 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
1672 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,500); |
1772 // coordinate.Move(45,100); |
1673 // coordinate.Move(45,100); |
1773 circle->SetCenter(coordinates[i]); |
1674 circle->SetCenter(coordinates[i]); |
1774 if(i%2==0) |
1675 if(i%2==0) |
1775 { |
1676 { |
1776 |
1677 |
1794 |
1695 |
1795 iLog->Log(_L("Triggers Created")); |
1696 iLog->Log(_L("Triggers Created")); |
1796 |
1697 |
1797 notifier->StartNotification( wait ); |
1698 notifier->StartNotification( wait ); |
1798 wait->Start( ); |
1699 wait->Start( ); |
1799 wait->Start( ); |
1700 notifier->After(600000000); |
1800 wait->Start( ); |
1701 wait->Start( ); |
1801 wait->Start( ); |
|
1802 |
|
1803 |
|
1804 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1702 RArray<TLbtTriggerFireInfo> Firedtriggers; |
1805 lbt.GetFiredTriggersL(Firedtriggers); |
1703 lbt.GetFiredTriggersL(Firedtriggers); |
1806 RestoreProfileL(); |
1704 if(Firedtriggers.Count()==3) |
1807 if(Firedtriggers.Count()==4) |
|
1808 { |
1705 { |
1809 CleanupStack::PopAndDestroy( notifier ); |
1706 CleanupStack::PopAndDestroy( notifier ); |
1810 CleanupStack::PopAndDestroy( trig ); |
1707 CleanupStack::PopAndDestroy( trig ); |
1811 CleanupStack::Pop( &lbt ); |
1708 CleanupStack::Pop( &lbt ); |
1812 CleanupStack::PopAndDestroy( &lbtserver ); |
1709 CleanupStack::PopAndDestroy( &lbtserver ); |
1845 CleanupClosePushL( lbtserver ); |
1742 CleanupClosePushL( lbtserver ); |
1846 iLog->Log(_L("Connection to RLbtServer Passed ")); |
1743 iLog->Log(_L("Connection to RLbtServer Passed ")); |
1847 User::LeaveIfError( lbt.Open(lbtserver)); |
1744 User::LeaveIfError( lbt.Open(lbtserver)); |
1848 iLog->Log(_L("Subsession opened ")); |
1745 iLog->Log(_L("Subsession opened ")); |
1849 CleanupClosePushL( lbt ); |
1746 CleanupClosePushL( lbt ); |
1850 |
|
1851 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
1852 // trigger firing. |
|
1853 SetProfileToOfflineL(); |
|
1854 |
|
1855 //Enable only simpsy |
1747 //Enable only simpsy |
1856 EnableSimPSYL(); |
1748 EnableSimPSYL(); |
1857 //Clear all triggers |
1749 //Clear all triggers |
1858 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1750 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1859 |
1751 |
1884 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1776 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1885 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1777 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1886 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1778 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1887 // set condition |
1779 // set condition |
1888 |
1780 |
1889 TCoordinate coordinate; |
1781 TCoordinate coordinate(62.5285,23.9385); |
1890 GetCurrentCoordinateL( coordinate ); |
1782 // TCoordinate coordinate(62.4438,23.9385); |
1891 coordinate.Move(90,1000); |
1783 coordinate.Move(90,5000); |
1892 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,2000); |
1784 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,10000); |
1893 CleanupStack::PushL( circle ); |
1785 CleanupStack::PushL( circle ); |
1894 |
1786 |
1895 |
1787 |
1896 // ownership of circle object transferred to the condition object |
1788 // ownership of circle object transferred to the condition object |
1897 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1789 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1920 TReal32 trigDistance; |
1812 TReal32 trigDistance; |
1921 TPosition firePosition; |
1813 TPosition firePosition; |
1922 FireInfo = notifier->GetFiredTrigger(); |
1814 FireInfo = notifier->GetFiredTrigger(); |
1923 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
1815 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
1924 firePosition.Distance(coordinate,trigDistance); |
1816 firePosition.Distance(coordinate,trigDistance); |
1925 RestoreProfileL(); |
1817 |
1926 if( FireInfo.iTriggerId==trigId) |
1818 if( trigDistance<=11500 && FireInfo.iTriggerId==trigId) |
1927 { |
1819 { |
1928 |
1820 |
1929 CleanupStack::PopAndDestroy( notifier ); |
1821 CleanupStack::PopAndDestroy( notifier ); |
1930 CleanupStack::PopAndDestroy( trig ); |
1822 CleanupStack::PopAndDestroy( trig ); |
1931 CleanupStack::Pop( &lbt ); |
1823 CleanupStack::Pop( &lbt ); |
1970 CleanupClosePushL( lbtserver ); |
1862 CleanupClosePushL( lbtserver ); |
1971 iLog->Log(_L("Connection to RLbtServer Passed ")); |
1863 iLog->Log(_L("Connection to RLbtServer Passed ")); |
1972 User::LeaveIfError( lbt.Open(lbtserver)); |
1864 User::LeaveIfError( lbt.Open(lbtserver)); |
1973 iLog->Log(_L("Subsession opened ")); |
1865 iLog->Log(_L("Subsession opened ")); |
1974 CleanupClosePushL( lbt ); |
1866 CleanupClosePushL( lbt ); |
1975 |
|
1976 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
1977 // trigger firing. |
|
1978 SetProfileToOfflineL(); |
|
1979 |
|
1980 //Enable only simpsy |
1867 //Enable only simpsy |
1981 EnableSimPSYL(); |
1868 EnableSimPSYL(); |
1982 //Clear all triggers |
1869 //Clear all triggers |
1983 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1870 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
1984 |
1871 |
2010 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
1897 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
2011 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
1898 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
2012 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
1899 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
2013 // set condition |
1900 // set condition |
2014 |
1901 |
2015 TCoordinate coordinate; |
1902 TCoordinate coordinate(62.5285,23.9385); |
2016 GetCurrentCoordinateL( coordinate ); |
|
2017 |
1903 |
2018 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
1904 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
2019 CleanupStack::PushL( circle ); |
1905 CleanupStack::PushL( circle ); |
2020 |
1906 |
2021 |
1907 |
2022 // ownership of circle object transferred to the condition object |
1908 // ownership of circle object transferred to the condition object |
2023 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
1909 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
2037 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
1923 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
2038 |
1924 |
2039 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
1925 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
2040 wait->Start( ); |
1926 wait->Start( ); |
2041 |
1927 |
2042 coordinate.Move(90,500); |
1928 coordinate.Move(90,2000); |
2043 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
1929 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
2044 circle2->SetCenter(coordinate); |
1930 circle2->SetCenter(coordinate); |
2045 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
1931 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
2046 circle2, |
1932 circle2, |
2047 CLbtTriggerConditionArea::EFireOnEnter); |
1933 CLbtTriggerConditionArea::EFireOnEnter); |
2048 |
1934 |
2057 iLog->Log(_L("Trigger Fired")); |
1943 iLog->Log(_L("Trigger Fired")); |
2058 TLbtTriggerFireInfo FireInfo; |
1944 TLbtTriggerFireInfo FireInfo; |
2059 TReal32 trigDistance; |
1945 TReal32 trigDistance; |
2060 TPosition firePosition; |
1946 TPosition firePosition; |
2061 FireInfo = notifier->GetFiredTrigger(); |
1947 FireInfo = notifier->GetFiredTrigger(); |
2062 RestoreProfileL(); |
|
2063 if(FireInfo.iTriggerId!=trigId) |
1948 if(FireInfo.iTriggerId!=trigId) |
2064 { |
1949 { |
2065 // notifier->StartNotification( wait ); |
1950 // notifier->StartNotification( wait ); |
2066 wait->Start( ); |
1951 wait->Start( ); |
2067 } |
1952 } |
2068 FireInfo = notifier->GetFiredTrigger(); |
1953 FireInfo = notifier->GetFiredTrigger(); |
2069 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
1954 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2070 firePosition.Distance(coordinate,trigDistance); |
1955 firePosition.Distance(coordinate,trigDistance); |
2071 |
1956 |
2072 if( FireInfo.iTriggerId==trigId) |
1957 if( trigDistance<=1000 && FireInfo.iTriggerId==trigId) |
2073 { |
1958 { |
2074 |
1959 |
2075 CleanupStack::PopAndDestroy( notifier ); |
1960 CleanupStack::PopAndDestroy( notifier ); |
2076 CleanupStack::PopAndDestroy( trig ); |
1961 CleanupStack::PopAndDestroy( trig ); |
2077 CleanupStack::Pop( &lbt ); |
1962 CleanupStack::Pop( &lbt ); |
2120 CleanupClosePushL( lbtserver ); |
2005 CleanupClosePushL( lbtserver ); |
2121 iLog->Log(_L("Connection to RLbtServer Passed ")); |
2006 iLog->Log(_L("Connection to RLbtServer Passed ")); |
2122 User::LeaveIfError( lbt.Open(lbtserver)); |
2007 User::LeaveIfError( lbt.Open(lbtserver)); |
2123 iLog->Log(_L("Subsession opened ")); |
2008 iLog->Log(_L("Subsession opened ")); |
2124 CleanupClosePushL( lbt ); |
2009 CleanupClosePushL( lbt ); |
2125 |
|
2126 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
2127 // trigger firing. |
|
2128 SetProfileToOfflineL(); |
|
2129 |
|
2130 //Enable only simpsy |
2010 //Enable only simpsy |
2131 EnableSimPSYL(); |
2011 EnableSimPSYL(); |
2132 //Clear all triggers |
2012 //Clear all triggers |
2133 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
2013 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
2134 |
2014 |
2162 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
2042 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
2163 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
2043 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
2164 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
2044 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
2165 // set condition |
2045 // set condition |
2166 |
2046 |
2167 TCoordinate coordinate; |
2047 TCoordinate coordinate(62.5285,23.9385); |
2168 GetCurrentCoordinateL( coordinate ); |
|
2169 |
2048 |
2170 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
2049 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,500); |
2171 CleanupStack::PushL( circle ); |
2050 CleanupStack::PushL( circle ); |
2172 |
2051 |
2173 |
2052 |
2174 // ownership of circle object transferred to the condition object |
2053 // ownership of circle object transferred to the condition object |
2175 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
2054 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
2189 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
2068 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
2190 |
2069 |
2191 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
2070 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
2192 wait->Start( ); |
2071 wait->Start( ); |
2193 |
2072 |
2194 coordinate.Move(90,300); |
2073 coordinate.Move(90,2000); |
2195 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
2074 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,800); |
2196 circle2->SetCenter(coordinate); |
2075 circle2->SetCenter(coordinate); |
2197 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
2076 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
2198 circle2, |
2077 circle2, |
2199 CLbtTriggerConditionArea::EFireOnEnter); |
2078 CLbtTriggerConditionArea::EFireOnEnter); |
2200 |
2079 |
2201 trig->SetCondition(condition2); |
2080 trig->SetCondition(condition2); |
2202 notifier->CreateTriggers( lbt,*trig,trigIdtochange,ETrue,wait ); |
2081 notifier->CreateTriggers( lbt,*trig,trigIdtochange,ETrue,wait ); |
2203 wait->Start( ); |
2082 wait->Start( ); |
2204 |
2083 |
2205 coordinate.Move(90,400); |
2084 coordinate.Move(90,2000); |
2206 CLbtGeoCircle* circle3=CLbtGeoCircle::NewL(coordinate,100); |
2085 CLbtGeoCircle* circle3=CLbtGeoCircle::NewL(coordinate,700); |
2207 circle3->SetCenter(coordinate); |
2086 circle3->SetCenter(coordinate); |
2208 CLbtTriggerConditionArea* condition3=CLbtTriggerConditionArea::NewL( |
2087 CLbtTriggerConditionArea* condition3=CLbtTriggerConditionArea::NewL( |
2209 circle3, |
2088 circle3, |
2210 CLbtTriggerConditionArea::EFireOnEnter); |
2089 CLbtTriggerConditionArea::EFireOnEnter); |
2211 |
2090 |
2226 TReal32 trigDistance; |
2105 TReal32 trigDistance; |
2227 TPosition firePosition; |
2106 TPosition firePosition; |
2228 FireInfo = notifier->GetFiredTrigger(); |
2107 FireInfo = notifier->GetFiredTrigger(); |
2229 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2108 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2230 firePosition.Distance(coordinate,trigDistance); |
2109 firePosition.Distance(coordinate,trigDistance); |
2231 RestoreProfileL(); |
|
2232 if(FireInfo.iTriggerId ==trigIdtochange) |
2110 if(FireInfo.iTriggerId ==trigIdtochange) |
2233 { |
2111 { |
2234 |
2112 |
2235 CleanupStack::PopAndDestroy( notifier ); |
2113 CleanupStack::PopAndDestroy( notifier ); |
2236 CleanupStack::PopAndDestroy( trig ); |
2114 CleanupStack::PopAndDestroy( trig ); |
2278 iLog->Log(_L("Subsession opened ")); |
2156 iLog->Log(_L("Subsession opened ")); |
2279 CleanupClosePushL( lbt ); |
2157 CleanupClosePushL( lbt ); |
2280 User::LeaveIfError( lbt1.Open(lbtserver)); |
2158 User::LeaveIfError( lbt1.Open(lbtserver)); |
2281 iLog->Log(_L("Subsession opened ")); |
2159 iLog->Log(_L("Subsession opened ")); |
2282 CleanupClosePushL( lbt1 ); |
2160 CleanupClosePushL( lbt1 ); |
2283 |
|
2284 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
2285 // trigger firing. |
|
2286 SetProfileToOfflineL(); |
|
2287 |
|
2288 //Enable only simpsy |
2161 //Enable only simpsy |
2289 EnableSimPSYL(); |
2162 EnableSimPSYL(); |
2290 //Clear all triggers |
2163 //Clear all triggers |
2291 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
2164 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
2292 |
2165 |
2319 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
2192 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
2320 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
2193 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
2321 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
2194 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
2322 // set condition |
2195 // set condition |
2323 |
2196 |
2324 TCoordinate coordinate; |
2197 TCoordinate coordinate(62.5285,23.9385); |
2325 GetCurrentCoordinateL( coordinate ); |
|
2326 |
2198 |
2327 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
2199 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
2328 CleanupStack::PushL( circle ); |
2200 CleanupStack::PushL( circle ); |
2329 |
2201 |
2330 |
2202 |
2331 // ownership of circle object transferred to the condition object |
2203 // ownership of circle object transferred to the condition object |
2332 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
2204 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
2346 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
2218 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
2347 |
2219 |
2348 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
2220 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
2349 wait->Start( ); |
2221 wait->Start( ); |
2350 |
2222 |
2351 coordinate.Move(90,500); |
2223 coordinate.Move(90,10000); |
2352 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
2224 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
2353 circle2->SetCenter(coordinate); |
2225 circle2->SetCenter(coordinate); |
2354 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
2226 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
2355 circle2, |
2227 circle2, |
2356 CLbtTriggerConditionArea::EFireOnEnter); |
2228 CLbtTriggerConditionArea::EFireOnEnter); |
2357 |
2229 |
2361 notifier->StartNotification( wait ); |
2233 notifier->StartNotification( wait ); |
2362 wait->Start( ); |
2234 wait->Start( ); |
2363 // User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile)); |
2235 // User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, KSimulationFile)); |
2364 // notifier->After(3000000); |
2236 // notifier->After(3000000); |
2365 // wait->Start( ); |
2237 // wait->Start( ); |
2366 coordinate.Move(270,200); |
2238 coordinate.Move(270,5000); |
2367 CLbtGeoCircle* circle3=CLbtGeoCircle::NewL(coordinate,100); |
2239 CLbtGeoCircle* circle3=CLbtGeoCircle::NewL(coordinate,500); |
2368 circle3->SetCenter(coordinate); |
2240 circle3->SetCenter(coordinate); |
2369 CLbtTriggerConditionArea* condition3=CLbtTriggerConditionArea::NewL( |
2241 CLbtTriggerConditionArea* condition3=CLbtTriggerConditionArea::NewL( |
2370 circle3, |
2242 circle3, |
2371 CLbtTriggerConditionArea::EFireOnEnter); |
2243 CLbtTriggerConditionArea::EFireOnEnter); |
2372 |
2244 |
2386 TReal32 trigDistance; |
2258 TReal32 trigDistance; |
2387 TPosition firePosition; |
2259 TPosition firePosition; |
2388 FireInfo = notifier->GetFiredTrigger(); |
2260 FireInfo = notifier->GetFiredTrigger(); |
2389 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2261 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2390 firePosition.Distance(coordinate,trigDistance); |
2262 firePosition.Distance(coordinate,trigDistance); |
2391 RestoreProfileL(); |
2263 |
2392 if(FireInfo.iTriggerId ==trigIdtochange) |
2264 if(FireInfo.iTriggerId ==trigIdtochange) |
2393 { |
2265 { |
2394 CleanupStack::PopAndDestroy( notifier ); |
2266 CleanupStack::PopAndDestroy( notifier ); |
2395 CleanupStack::PopAndDestroy( trig ); |
2267 CleanupStack::PopAndDestroy( trig ); |
2396 CleanupStack::Pop( &lbt1 ); |
2268 CleanupStack::Pop( &lbt1 ); |
2437 CleanupClosePushL( lbtserver ); |
2309 CleanupClosePushL( lbtserver ); |
2438 iLog->Log(_L("Connection to RLbtServer Passed ")); |
2310 iLog->Log(_L("Connection to RLbtServer Passed ")); |
2439 User::LeaveIfError( lbt.Open(lbtserver)); |
2311 User::LeaveIfError( lbt.Open(lbtserver)); |
2440 iLog->Log(_L("Subsession opened ")); |
2312 iLog->Log(_L("Subsession opened ")); |
2441 CleanupClosePushL( lbt ); |
2313 CleanupClosePushL( lbt ); |
2442 |
|
2443 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
2444 // trigger firing. |
|
2445 SetProfileToOfflineL(); |
|
2446 |
|
2447 //Enable only simpsy |
2314 //Enable only simpsy |
2448 EnableSimPSYL(); |
2315 EnableSimPSYL(); |
2449 //Clear all triggers |
2316 //Clear all triggers |
2450 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
2317 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
2451 |
2318 |
2478 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
2345 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
2479 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
2346 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
2480 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
2347 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
2481 // set condition |
2348 // set condition |
2482 |
2349 |
2483 TCoordinate coordinate; |
2350 TCoordinate coordinate(62.5285,23.9385); |
2484 GetCurrentCoordinateL( coordinate ); |
|
2485 |
2351 |
2486 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,100); |
2352 CLbtGeoCircle* circle=CLbtGeoCircle::NewL(coordinate,1000); |
2487 CleanupStack::PushL( circle ); |
2353 CleanupStack::PushL( circle ); |
2488 |
2354 |
2489 |
2355 |
2490 // ownership of circle object transferred to the condition object |
2356 // ownership of circle object transferred to the condition object |
2491 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
2357 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
2505 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
2371 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
2506 |
2372 |
2507 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
2373 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
2508 wait->Start( ); |
2374 wait->Start( ); |
2509 |
2375 |
2510 coordinate.Move(90,500); |
2376 coordinate.Move(90,5000); |
2511 CLbtGeoCircle* circle3=CLbtGeoCircle::NewL(coordinate,100); |
2377 CLbtGeoCircle* circle3=CLbtGeoCircle::NewL(coordinate,500); |
2512 circle3->SetCenter(coordinate); |
2378 circle3->SetCenter(coordinate); |
2513 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
2379 CLbtTriggerConditionArea* condition2=CLbtTriggerConditionArea::NewL( |
2514 circle3, |
2380 circle3, |
2515 CLbtTriggerConditionArea::EFireOnEnter); |
2381 CLbtTriggerConditionArea::EFireOnEnter); |
2516 |
2382 |
2517 trig->SetCondition(condition2); |
2383 trig->SetCondition(condition2); |
2518 notifier->CreateTriggers( lbt,*trig,trigIdtochange,ETrue,wait ); |
2384 notifier->CreateTriggers( lbt,*trig,trigIdtochange,ETrue,wait ); |
2519 wait->Start( ); |
2385 wait->Start( ); |
2520 |
2386 |
2521 coordinate.Move(90,500); |
2387 coordinate.Move(90,5000); |
2522 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,100); |
2388 CLbtGeoCircle* circle2=CLbtGeoCircle::NewL(coordinate,500); |
2523 circle2->SetCenter(coordinate); |
2389 circle2->SetCenter(coordinate); |
2524 CLbtTriggerConditionArea* condition3=CLbtTriggerConditionArea::NewL( |
2390 CLbtTriggerConditionArea* condition3=CLbtTriggerConditionArea::NewL( |
2525 circle2, |
2391 circle2, |
2526 CLbtTriggerConditionArea::EFireOnEnter); |
2392 CLbtTriggerConditionArea::EFireOnEnter); |
2527 |
2393 |
2542 TReal32 trigDistance; |
2408 TReal32 trigDistance; |
2543 TPosition firePosition; |
2409 TPosition firePosition; |
2544 FireInfo = notifier->GetFiredTrigger(); |
2410 FireInfo = notifier->GetFiredTrigger(); |
2545 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2411 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2546 firePosition.Distance(coordinate,trigDistance); |
2412 firePosition.Distance(coordinate,trigDistance); |
2547 RestoreProfileL(); |
|
2548 if(FireInfo.iTriggerId ==trigIdtochange) |
2413 if(FireInfo.iTriggerId ==trigIdtochange) |
2549 { |
2414 { |
2550 CleanupStack::PopAndDestroy( notifier ); |
2415 CleanupStack::PopAndDestroy( notifier ); |
2551 CleanupStack::PopAndDestroy( trig ); |
2416 CleanupStack::PopAndDestroy( trig ); |
2552 CleanupStack::Pop( &lbt ); |
2417 CleanupStack::Pop( &lbt ); |
2591 CleanupClosePushL( lbtserver ); |
2456 CleanupClosePushL( lbtserver ); |
2592 iLog->Log(_L("Connection to RLbtServer Passed ")); |
2457 iLog->Log(_L("Connection to RLbtServer Passed ")); |
2593 User::LeaveIfError( lbt.Open(lbtserver)); |
2458 User::LeaveIfError( lbt.Open(lbtserver)); |
2594 iLog->Log(_L("Subsession opened ")); |
2459 iLog->Log(_L("Subsession opened ")); |
2595 CleanupClosePushL( lbt ); |
2460 CleanupClosePushL( lbt ); |
2596 |
|
2597 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
2598 // trigger firing. |
|
2599 SetProfileToOfflineL(); |
|
2600 |
|
2601 //Enable only simpsy |
2461 //Enable only simpsy |
2602 EnableSimPSYL(); |
2462 EnableSimPSYL(); |
2603 //Clear all triggers |
2463 //Clear all triggers |
2604 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
2464 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
2605 |
2465 |
2699 TReal32 trigDistance; |
2559 TReal32 trigDistance; |
2700 TPosition firePosition; |
2560 TPosition firePosition; |
2701 FireInfo = notifier->GetFiredTrigger(); |
2561 FireInfo = notifier->GetFiredTrigger(); |
2702 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2562 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2703 firePosition.Distance(coordinate,trigDistance); |
2563 firePosition.Distance(coordinate,trigDistance); |
2704 RestoreProfileL(); |
|
2705 if( trigDistance>=1000) |
2564 if( trigDistance>=1000) |
2706 { |
2565 { |
2707 _LIT(KProcessToSearch, "About"); |
2566 _LIT(KProcessToSearch, "About"); |
2708 //_LIT(KProcessToSearch, "TestServerStarter"); |
2567 //_LIT(KProcessToSearch, "TestServerStarter"); |
2709 TFullName fullName; |
2568 TFullName fullName; |
2765 CleanupClosePushL( lbtserver ); |
2624 CleanupClosePushL( lbtserver ); |
2766 iLog->Log(_L("Connection to RLbtServer Passed ")); |
2625 iLog->Log(_L("Connection to RLbtServer Passed ")); |
2767 User::LeaveIfError( lbt.Open( lbtserver ) ); |
2626 User::LeaveIfError( lbt.Open( lbtserver ) ); |
2768 iLog->Log(_L("Subsession opened ")); |
2627 iLog->Log(_L("Subsession opened ")); |
2769 CleanupClosePushL( lbt ); |
2628 CleanupClosePushL( lbt ); |
2770 |
|
2771 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
2772 // trigger firing. |
|
2773 SetProfileToOfflineL(); |
|
2774 |
|
2775 //Enable only simpsy |
2629 //Enable only simpsy |
2776 EnableSimPSYL(); |
2630 EnableSimPSYL(); |
2777 //Clear all triggers |
2631 //Clear all triggers |
2778 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
2632 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
2779 |
2633 |
2854 TReal32 trigDistance; |
2708 TReal32 trigDistance; |
2855 TPosition firePosition; |
2709 TPosition firePosition; |
2856 FireInfo = notifier->GetFiredTrigger(); |
2710 FireInfo = notifier->GetFiredTrigger(); |
2857 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2711 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2858 firePosition.Distance(coordinate,trigDistance); |
2712 firePosition.Distance(coordinate,trigDistance); |
2859 RestoreProfileL(); |
|
2860 if( trigDistance<=1000 &¬ifier->iTriggerFireCount ==2) |
2713 if( trigDistance<=1000 &¬ifier->iTriggerFireCount ==2) |
2861 { |
2714 { |
2862 CleanupStack::PopAndDestroy( notifier ); |
2715 CleanupStack::PopAndDestroy( notifier ); |
2863 CleanupStack::PopAndDestroy( trig ); |
2716 CleanupStack::PopAndDestroy( trig ); |
2864 CleanupStack::Pop( &lbt ); |
2717 CleanupStack::Pop( &lbt ); |
2899 CleanupClosePushL( lbtserver ); |
2752 CleanupClosePushL( lbtserver ); |
2900 iLog->Log(_L("Connection to RLbtServer Passed ")); |
2753 iLog->Log(_L("Connection to RLbtServer Passed ")); |
2901 User::LeaveIfError( lbt.Open( lbtserver ) ); |
2754 User::LeaveIfError( lbt.Open( lbtserver ) ); |
2902 iLog->Log(_L("Subsession opened ")); |
2755 iLog->Log(_L("Subsession opened ")); |
2903 CleanupClosePushL( lbt ); |
2756 CleanupClosePushL( lbt ); |
2904 |
|
2905 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
2906 // trigger firing. |
|
2907 SetProfileToOfflineL(); |
|
2908 |
|
2909 //Enable only simpsy |
2757 //Enable only simpsy |
2910 EnableSimPSYL(); |
2758 EnableSimPSYL(); |
2911 //Clear all triggers |
2759 //Clear all triggers |
2912 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
2760 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
2913 |
2761 |
2984 TReal32 trigDistance; |
2832 TReal32 trigDistance; |
2985 TPosition firePosition; |
2833 TPosition firePosition; |
2986 FireInfo = notifier->GetFiredTrigger(); |
2834 FireInfo = notifier->GetFiredTrigger(); |
2987 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2835 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2988 firePosition.Distance(coordinate,trigDistance); |
2836 firePosition.Distance(coordinate,trigDistance); |
2989 RestoreProfileL(); |
|
2990 if( trigDistance>=1000 &¬ifier->iTriggerFireCount ==2) |
2837 if( trigDistance>=1000 &¬ifier->iTriggerFireCount ==2) |
2991 { |
2838 { |
2992 CleanupStack::PopAndDestroy( notifier ); |
2839 CleanupStack::PopAndDestroy( notifier ); |
2993 CleanupStack::PopAndDestroy( trig ); |
2840 CleanupStack::PopAndDestroy( trig ); |
2994 CleanupStack::Pop( &lbt ); |
2841 CleanupStack::Pop( &lbt ); |
3028 CleanupClosePushL( lbtserver ); |
2875 CleanupClosePushL( lbtserver ); |
3029 iLog->Log(_L("Connection to RLbtServer Passed ")); |
2876 iLog->Log(_L("Connection to RLbtServer Passed ")); |
3030 User::LeaveIfError( lbt.Open( lbtserver ) ); |
2877 User::LeaveIfError( lbt.Open( lbtserver ) ); |
3031 iLog->Log(_L("Subsession opened ")); |
2878 iLog->Log(_L("Subsession opened ")); |
3032 CleanupClosePushL( lbt ); |
2879 CleanupClosePushL( lbt ); |
3033 |
|
3034 // Set profile to offline mode.This is required to avoid movement detection blocking the |
|
3035 // trigger firing. |
|
3036 SetProfileToOfflineL(); |
|
3037 |
|
3038 //Enable only simpsy |
2880 //Enable only simpsy |
3039 EnableSimPSYL(); |
2881 EnableSimPSYL(); |
3040 //Clear all triggers |
2882 //Clear all triggers |
3041 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
2883 TRAP_IGNORE(lbt.DeleteTriggersL()) ; |
3042 |
2884 |
3112 TReal32 trigDistance; |
2954 TReal32 trigDistance; |
3113 TPosition firePosition; |
2955 TPosition firePosition; |
3114 FireInfo = notifier->GetFiredTrigger(); |
2956 FireInfo = notifier->GetFiredTrigger(); |
3115 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
2957 FireInfo.iFiredPositionInfo.GetPosition(firePosition); |
3116 firePosition.Distance(coordinate,trigDistance); |
2958 firePosition.Distance(coordinate,trigDistance); |
3117 RestoreProfileL(); |
|
3118 if( trigDistance<=1000 &¬ifier->iTriggerFireCount ==2) |
2959 if( trigDistance<=1000 &¬ifier->iTriggerFireCount ==2) |
3119 { |
2960 { |
3120 CleanupStack::PopAndDestroy( notifier ); |
2961 CleanupStack::PopAndDestroy( notifier ); |
3121 CleanupStack::PopAndDestroy( trig ); |
2962 CleanupStack::PopAndDestroy( trig ); |
3122 CleanupStack::Pop( &lbt ); |
2963 CleanupStack::Pop( &lbt ); |