00001 /* 00002 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). 00003 * All rights reserved. 00004 * This component and the accompanying materials are made available 00005 * under the terms of "Eclipse Public License v1.0" 00006 * which accompanies this distribution, and is available 00007 * at the URL "http://www.eclipse.org/legal/epl-v10.html". 00008 * 00009 * Initial Contributors: 00010 * Nokia Corporation - initial contribution. 00011 * 00012 * Contributors: 00013 * 00014 * Description: 00015 * 00016 */ 00017 00018 #ifndef __LBSLOCATOR_H__ 00019 #define __LBSLOCATOR_H__ 00020 00094 #include <e32base.h> 00095 00096 #include <lbserrors.h> 00097 #include <lbslocation.h> 00098 #include <lbsmovementevent.h> 00099 #include <lbslocationobserver.h> 00100 #include <lbsmovementobserver.h> 00101 00103 const TUid KLbsProfileIdDefault = { 0x00000000 }; 00105 const TUid KLbsProfileIdAreaMonitor = { 0x00000001 }; 00107 const TUid KLbsProfileIdLazyTracker = { 0x00000002 }; 00108 00109 //Forward declarations 00110 class CLbsLocatorImpl; 00111 00138 class CLbsLocator : public CBase 00139 { 00140 public: 00144 enum TLbsLocatorOption 00145 { 00147 ELocatorStatusTimer = 1, 00148 }; 00149 00150 IMPORT_C static CLbsLocator* NewL(); 00151 IMPORT_C static CLbsLocator* NewL(MLbsLocationObserver& aObserver); 00152 00153 IMPORT_C ~CLbsLocator(); 00154 00155 // Select the desired profile. If none selected "TLbsProfileIdDefault" is assumed. 00156 IMPORT_C TInt SetLocatorProfile(TUid aProfileId); 00157 IMPORT_C TUid LocatorProfile() const; 00158 00159 // Start and stop requesting updates. Updates are sent to "observers" of the interface. 00160 // StartUpdatesL() will consume resources even if there are no observers. 00161 IMPORT_C void StartUpdatesL(); 00162 IMPORT_C void StopUpdates(); 00163 00164 // Modify the bahviour of the active profile. 00165 IMPORT_C TInt SetLocatorOption(TLbsLocatorOption aOption, TInt aValue); 00166 IMPORT_C TInt GetLocatorOption(TLbsLocatorOption aOption, TInt& aValue) const; 00167 00168 // Add and Remove more position observers. 00169 // If no observers present, then resouces may be consumed until StopUpdates() is called. 00170 IMPORT_C void AddLocationObserverL(MLbsLocationObserver& aObserver); 00171 IMPORT_C TInt RemoveLocationObserver(MLbsLocationObserver& aObserver); 00172 00173 IMPORT_C void AddMovementObserverL(MLbsMovementObserver& aObserver); 00174 IMPORT_C TInt RemoveMovementObserver(MLbsMovementObserver& aObserver); 00175 00176 private: 00177 CLbsLocator(); 00178 void ConstructL(MLbsLocationObserver* aObserver); 00179 00180 CLbsLocatorImpl *iImpl; 00181 }; 00182 00183 #endif //__LBSLOCATOR_H__ 00184