31 #include "mdesession.h" |
31 #include "mdesession.h" |
32 #include "mdenamespacedef.h" |
32 #include "mdenamespacedef.h" |
33 #include "mdeobjectdef.h" |
33 #include "mdeobjectdef.h" |
34 #include "mdepropertydef.h" |
34 #include "mdepropertydef.h" |
35 #include "mdcserializationbuffer.h" |
35 #include "mdcserializationbuffer.h" |
36 #ifdef LOC_REVERSEGEOCODE |
|
37 #include "clocationgeotagtimerao.h" |
36 #include "clocationgeotagtimerao.h" |
38 #endif //LOC_REVERSEGEOCODE |
|
39 #include "nwregistrationstatushandler.h" |
37 #include "nwregistrationstatushandler.h" |
40 |
38 |
41 using namespace MdeConstants; |
39 using namespace MdeConstants; |
42 using namespace CommsDat; |
40 using namespace CommsDat; |
43 |
41 |
114 iRemoveLocation( EFalse ), |
112 iRemoveLocation( EFalse ), |
115 iWaitForPositioningStopTimeout ( EFalse ), |
113 iWaitForPositioningStopTimeout ( EFalse ), |
116 iTelServerIsOpen(EFalse), |
114 iTelServerIsOpen(EFalse), |
117 iPhoneIsOpen(EFalse), |
115 iPhoneIsOpen(EFalse), |
118 iNwRegistrationStatusHandler(NULL), |
116 iNwRegistrationStatusHandler(NULL), |
119 iHomeNwInfoAvailableFlag(EFalse) |
117 iHomeNwInfoAvailableFlag(EFalse), |
|
118 iGeoTagTimer(NULL) |
120 #ifdef LOC_REVERSEGEOCODE |
119 #ifdef LOC_REVERSEGEOCODE |
121 ,iGeoTagTimer(NULL) |
|
122 ,iGeoTaggingPendingReqObj(NULL) |
120 ,iGeoTaggingPendingReqObj(NULL) |
123 ,iEcomSession(NULL) |
121 ,iEcomSession(NULL) |
124 #endif //LOC_REVERSEGEOCODE |
122 #endif //LOC_REVERSEGEOCODE |
125 { |
123 { |
126 } |
124 } |
169 iTrackLog->AddGpxObserver( this ); |
167 iTrackLog->AddGpxObserver( this ); |
170 |
168 |
171 CRepository* repository = CRepository::NewLC( KRepositoryUid ); |
169 CRepository* repository = CRepository::NewLC( KRepositoryUid ); |
172 TInt err = repository->Get( KLocationTrailShutdownTimer, iLocManStopDelay ); |
170 TInt err = repository->Get( KLocationTrailShutdownTimer, iLocManStopDelay ); |
173 |
171 |
174 LOG1("CLocationManagerServer::ConstructL, iLocManStopDelay:%d", iLocManStopDelay); |
172 LOG1("iLocManStopDelay:%d", iLocManStopDelay); |
175 |
173 |
176 if ( err != KErrNone ) |
174 if ( err != KErrNone ) |
177 { |
175 { |
178 LOG1("CLocationManagerServer::ConstructL, iLocManStopDelay err:%d", err); |
176 LOG1("iLocManStopDelay err:%d", err); |
179 iLocManStopDelay = KLocationTrailShutdownDelay; |
177 iLocManStopDelay = KLocationTrailShutdownDelay; |
180 } |
178 } |
181 |
179 |
182 err = repository->Get( KLocationTrailRemapShutdownTimer, iLocManStopRemapDelay ); |
180 err = repository->Get( KLocationTrailRemapShutdownTimer, iLocManStopRemapDelay ); |
183 CleanupStack::PopAndDestroy( repository ); |
181 CleanupStack::PopAndDestroy( repository ); |
184 |
182 |
185 LOG1("CLocationManagerServer::ConstructL, iLocManStopRemapDelay:%d", iLocManStopRemapDelay); |
183 LOG1("iLocManStopRemapDelay:%d", iLocManStopRemapDelay); |
186 |
184 |
187 if ( err != KErrNone ) |
185 if ( err != KErrNone ) |
188 { |
186 { |
189 LOG1("CLocationManagerServer::ConstructL, iLocManStopRemapDelay err:%d", err); |
187 LOG1("iLocManStopRemapDelay err:%d", err); |
190 iLocManStopRemapDelay = KLocationTrailRemapShutdownDelay; |
188 iLocManStopRemapDelay = KLocationTrailRemapShutdownDelay; |
191 } |
189 } |
192 |
190 |
193 #ifdef LOC_REVERSEGEOCODE |
|
194 //Create the instance of the geotagging timer object |
191 //Create the instance of the geotagging timer object |
|
192 // Create timer, if n/w or reverse geo code based feature flag is enabled |
|
193 #if defined(LOC_REVERSEGEOCODE) || defined(LOC_GEOTAGGING_CELLID) |
195 iGeoTagTimer = CLocationGeoTagTimerAO::NewL(*iMdeSession, *this); |
194 iGeoTagTimer = CLocationGeoTagTimerAO::NewL(*iMdeSession, *this); |
196 //Schedule a task for geotagging every day at 3.00 AM |
195 //Schedule a task for geotagging every day at 3.00 AM |
197 iGeoTagTimer->StartTimer(); |
196 iGeoTagTimer->StartTimer(); |
198 #endif //LOC_REVERSEGEOCODE |
197 #endif |
199 } |
198 } |
200 else |
199 else |
201 { |
200 { |
202 LOG("Unable to open MDE session. Closing.."); |
201 LOG("Unable to open MDE session. Closing.."); |
203 User::Leave(KErrCouldNotConnect); |
202 User::Leave(KErrCouldNotConnect); |
211 // -------------------------------------------------------------------------- |
210 // -------------------------------------------------------------------------- |
212 // |
211 // |
213 CLocationManagerServer::~CLocationManagerServer() |
212 CLocationManagerServer::~CLocationManagerServer() |
214 { |
213 { |
215 LOG("CLocationManagerServer::~CLocationManagerServer ,begin"); |
214 LOG("CLocationManagerServer::~CLocationManagerServer ,begin"); |
216 |
215 #if defined(LOC_REVERSEGEOCODE) || defined(LOC_GEOTAGGING_CELLID) |
|
216 delete iGeoTagTimer; |
|
217 iGeoTagTimer = NULL; |
|
218 #endif |
217 #ifdef LOC_REVERSEGEOCODE |
219 #ifdef LOC_REVERSEGEOCODE |
218 delete iGeoTagTimer; |
|
219 delete iGeoTaggingPendingReqObj; |
220 delete iGeoTaggingPendingReqObj; |
|
221 iGeoTaggingPendingReqObj = NULL; |
220 #endif //LOC_REVERSEGEOCODE |
222 #endif //LOC_REVERSEGEOCODE |
221 |
223 |
222 delete iLocationRecord; |
224 delete iLocationRecord; |
|
225 iLocationRecord = NULL; |
223 delete iTrackLog; |
226 delete iTrackLog; |
|
227 iTrackLog = NULL; |
224 delete iTimer; |
228 delete iTimer; |
|
229 iTimer = NULL; |
225 delete iASW; |
230 delete iASW; |
|
231 iASW = NULL; |
226 delete iMdeSession; |
232 delete iMdeSession; |
|
233 iMdeSession = NULL; |
227 delete iNwRegistrationStatusHandler; |
234 delete iNwRegistrationStatusHandler; |
|
235 iNwRegistrationStatusHandler = NULL; |
228 iTargetObjectIds.Close(); |
236 iTargetObjectIds.Close(); |
229 CancelRequests(iNotifReqs); |
237 CancelRequests(iNotifReqs); |
230 iNotifReqs.Close(); |
238 iNotifReqs.Close(); |
231 CancelRequests(iLocationReqs); |
239 CancelRequests(iLocationReqs); |
232 iLocationReqs.Close(); |
240 iLocationReqs.Close(); |
472 // CLocationManagerServer::RemoveSession |
480 // CLocationManagerServer::RemoveSession |
473 // -------------------------------------------------------------------------- |
481 // -------------------------------------------------------------------------- |
474 // |
482 // |
475 void CLocationManagerServer::RemoveSession() |
483 void CLocationManagerServer::RemoveSession() |
476 { |
484 { |
|
485 LOG1( "CLocationManagerServer::RemoveSession. Session count - %d", iSessionCount); |
477 iSessionCount--; |
486 iSessionCount--; |
478 if ( !iSessionCount |
487 StopServer(); |
479 && iLocationRecord |
|
480 && !iLocationRecord->TaggingInProgress()) |
|
481 { |
|
482 // Nothing in progress. shutdown the server |
|
483 CActiveScheduler::Stop(); |
|
484 } |
|
485 } |
488 } |
486 |
489 |
487 // -------------------------------------------------------------------------- |
490 // -------------------------------------------------------------------------- |
488 // CLocationManagerServer::StartGPSPositioningL |
491 // CLocationManagerServer::StartGPSPositioningL |
489 // -------------------------------------------------------------------------- |
492 // -------------------------------------------------------------------------- |
1655 LOG("Completing the request"); |
1658 LOG("Completing the request"); |
1656 iGeoTaggingMessage.Complete(aError); |
1659 iGeoTaggingMessage.Complete(aError); |
1657 iGeoTaggingMessage = RMessage2 (); |
1660 iGeoTaggingMessage = RMessage2 (); |
1658 } |
1661 } |
1659 #endif //LOC_REVERSEGEOCODE |
1662 #endif //LOC_REVERSEGEOCODE |
|
1663 StopServer(); |
|
1664 LOG("CLocationManagerServer::GeoTaggingCompleted ,end"); |
|
1665 } |
|
1666 |
|
1667 |
|
1668 // -------------------------------------------------------------------------- |
|
1669 // CLocationManagerServer::StopServer |
|
1670 // -------------------------------------------------------------------------- |
|
1671 // |
|
1672 |
|
1673 void CLocationManagerServer::StopServer() |
|
1674 { |
|
1675 LOG("CLocationManagerServer::StopServer ,begin"); |
1660 // once geo tagging completed, check whether, we can terminate the server |
1676 // once geo tagging completed, check whether, we can terminate the server |
|
1677 // dont't stop this process if |
|
1678 // 1. when client are connected. |
|
1679 // 2. 3AM timer is going on. |
|
1680 // 3. Tagging is in progress. |
1661 if ( !iSessionCount |
1681 if ( !iSessionCount |
|
1682 #if defined(LOC_REVERSEGEOCODE) || defined(LOC_GEOTAGGING_CELLID) |
|
1683 && iGeoTagTimer == NULL |
|
1684 #endif |
1662 && iLocationRecord |
1685 && iLocationRecord |
1663 && !iLocationRecord->TaggingInProgress()) |
1686 && !iLocationRecord->TaggingInProgress()) |
1664 { |
1687 { |
1665 // Nothing in progress. shutdown the server |
1688 // Nothing in progress. shutdown the server |
|
1689 LOG("Stop the schedular"); |
1666 CActiveScheduler::Stop(); |
1690 CActiveScheduler::Stop(); |
1667 } |
1691 } |
1668 LOG("CLocationManagerServer::GeoTaggingCompleted ,end"); |
1692 LOG("CLocationManagerServer::StopServer ,end"); |
1669 } |
1693 } |
1670 |
|
1671 |
1694 |
1672 // -------------------------------------------------------------------------- |
1695 // -------------------------------------------------------------------------- |
1673 // CLocationManagerServer::PendingGeoTagReqComplete |
1696 // CLocationManagerServer::PendingGeoTagReqComplete |
1674 // -------------------------------------------------------------------------- |
1697 // -------------------------------------------------------------------------- |
1675 // |
1698 // |
1786 iGeoTaggingMessage = RMessage2 (); |
1809 iGeoTaggingMessage = RMessage2 (); |
1787 iLocationRecord->CancelGeoTagging(); |
1810 iLocationRecord->CancelGeoTagging(); |
1788 } |
1811 } |
1789 aMessage.Complete(KErrNone); |
1812 aMessage.Complete(KErrNone); |
1790 #else |
1813 #else |
1791 aMessage.Complete(KErrNotSupported); |
1814 aMessage.Complete(KErrNotSupported); |
1792 #endif //LOC_REVERSEGEOCODE |
1815 #endif //LOC_REVERSEGEOCODE |
1793 } |
1816 } |
1794 |
1817 |
1795 |
1818 |
1796 // -------------------------------------------------------------------------- |
1819 // -------------------------------------------------------------------------- |