|
1 /* |
|
2 * Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Test module to implement Advanced trigger supervision cases |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include "AsynOperationAO.h" |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CTriggerFireObserver::CTriggerFireObserver |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 CTriggerFireObserver::CTriggerFireObserver( TCoordinate& aCoordinate ):CTimer( CTimer::EPriorityStandard ),iCoordinate(aCoordinate), |
|
37 iWait(NULL) |
|
38 { |
|
39 |
|
40 CActiveScheduler::Add(this); |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CTriggerFireObserver::ConstructL |
|
45 // Symbian 2nd phase constructor can leave. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 void CTriggerFireObserver::ConstructL( RLbt& aLbt ) |
|
49 { |
|
50 |
|
51 iTriggerFireCount =0; |
|
52 CTimer::ConstructL(); |
|
53 iNotifier = CLbtTriggerFiringEventNotifier::NewL( aLbt,*this ); |
|
54 |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CTriggerFireObserver::NewL |
|
59 // Two-phased constructor. |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 CTriggerFireObserver* CTriggerFireObserver::NewL( RLbt& aLbt,TCoordinate& aCoordinate ) |
|
63 { |
|
64 |
|
65 CTriggerFireObserver* self = new (ELeave) CTriggerFireObserver( aCoordinate ); |
|
66 |
|
67 CleanupStack::PushL( self ); |
|
68 self->ConstructL( aLbt ); |
|
69 CleanupStack::Pop(); |
|
70 |
|
71 return self; |
|
72 |
|
73 } |
|
74 |
|
75 // Destructor |
|
76 CTriggerFireObserver::~CTriggerFireObserver() |
|
77 { |
|
78 |
|
79 Cancel(); |
|
80 // Delete notifier object |
|
81 delete iNotifier; |
|
82 delete iWait; |
|
83 // iWait=NULL; |
|
84 |
|
85 |
|
86 } |
|
87 |
|
88 void CTriggerFireObserver::TriggerFiredL( const TLbtTriggerFireInfo& aFireInfo ) |
|
89 { |
|
90 iTriggerFireCount++; |
|
91 iWaitStatus =0; |
|
92 iFireInfo=aFireInfo; |
|
93 if( iWait->IsStarted() ) |
|
94 { |
|
95 iWait->AsyncStop( ); |
|
96 } |
|
97 CheckPositionInfoL( aFireInfo ); |
|
98 } |
|
99 |
|
100 void CTriggerFireObserver::StartNotification( CActiveSchedulerWait* aWait ) |
|
101 { |
|
102 |
|
103 iWait=aWait; |
|
104 iNotifier->Start( ); |
|
105 } |
|
106 |
|
107 void CTriggerFireObserver::CancelNotification( ) |
|
108 { |
|
109 |
|
110 iNotifier->Cancel( ); |
|
111 } |
|
112 |
|
113 void CTriggerFireObserver::RunL( ) |
|
114 { |
|
115 |
|
116 if( iWait->IsStarted() ) |
|
117 { |
|
118 iWait->AsyncStop( ); |
|
119 } |
|
120 } |
|
121 |
|
122 void CTriggerFireObserver::DoCancel( ) |
|
123 { |
|
124 |
|
125 |
|
126 } |
|
127 |
|
128 |
|
129 void CTriggerFireObserver::CheckPositionInfoL( const TLbtTriggerFireInfo& aFireInfo ) |
|
130 { |
|
131 |
|
132 |
|
133 } |
|
134 |
|
135 |
|
136 TInt CTriggerFireObserver::GetFireCount( ) |
|
137 |
|
138 { |
|
139 return iTriggerFireCount; |
|
140 } |
|
141 |
|
142 |
|
143 TLbtTriggerFireInfo CTriggerFireObserver::GetFiredTrigger( ) |
|
144 |
|
145 { |
|
146 return iFireInfo; |
|
147 } |
|
148 |
|
149 void CTriggerFireObserver::CreateTriggers( RLbt& aLbt, |
|
150 CLbtTriggerEntry& aEntry, |
|
151 TLbtTriggerId& aId, |
|
152 TBool aFireOnCreation, |
|
153 CActiveSchedulerWait* aWait |
|
154 ) |
|
155 { |
|
156 |
|
157 iWait=aWait; |
|
158 aLbt.CreateTrigger( aEntry,aId,aFireOnCreation,iStatus ); |
|
159 SetActive( ); |
|
160 } |
|
161 |
|
162 void CTriggerFireObserver::GetTriggersList(RLbt& aLbt, RPointerArray < CLbtTriggerInfo >& aTriggerList, |
|
163 CActiveSchedulerWait* aWait,CLbtListTriggerOptions* aListOptions ) |
|
164 { |
|
165 |
|
166 iWait=aWait; |
|
167 aLbt.GetTriggers(iStatus,aTriggerList,aListOptions); |
|
168 SetActive( ); |
|
169 } |
|
170 |
|
171 void CTriggerFireObserver::ListTriggerIdsList(RLbt& aLbt, RArray < TLbtTriggerId >& aTriggerIdList, |
|
172 CActiveSchedulerWait* aWait,CLbtListTriggerOptions* aListOptions) |
|
173 { |
|
174 |
|
175 iWait=aWait; |
|
176 aLbt.ListTriggerIds(iStatus,aTriggerIdList,aListOptions); |
|
177 SetActive( ); |
|
178 } |
|
179 |
|
180 |
|
181 void CTriggerFireObserver::CreateIterator(RLbt& aLbt, |
|
182 CActiveSchedulerWait* aWait,CLbtListTriggerOptions* aListOptions) |
|
183 { |
|
184 |
|
185 iWait=aWait; |
|
186 // aLbt.CreateGetTriggerIteratorL(aListOptions,iStatus); |
|
187 SetActive( ); |
|
188 } |
|
189 // End of File |