# HG changeset patch # User Billy Gibson # Date 1272627210 -3600 # Node ID a06e4186b3d510cf3a1c527182f3fc8ac13374dd # Parent 8737440d6ade281a5e21558fa44c779cdf8080b0 Initial Draft of Location Profiles API diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/bwins/lbslocatoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/bwins/lbslocatoru.def Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,47 @@ +EXPORTS + ??0TLbsLocation@@QAE@XZ @ 1 NONAME ; TLbsLocation::TLbsLocation(void) + ??0TLbsLocatorClassTypeBase@@IAE@XZ @ 2 NONAME ; TLbsLocatorClassTypeBase::TLbsLocatorClassTypeBase(void) + ??0TLbsMovementEvent@@QAE@XZ @ 3 NONAME ; TLbsMovementEvent::TLbsMovementEvent(void) + ??1CLbsLocator@@UAE@XZ @ 4 NONAME ; CLbsLocator::~CLbsLocator(void) + ?Accuracy@TLbsLocation@@QBEMXZ @ 5 NONAME ; float TLbsLocation::Accuracy(void) const + ?AddLocationObserverL@CLbsLocator@@QAEXAAVMLbsLocationObserver@@@Z @ 6 NONAME ; void CLbsLocator::AddLocationObserverL(class MLbsLocationObserver &) + ?AddMovementObserverL@CLbsLocator@@QAEXAAVMLbsMovementObserver@@@Z @ 7 NONAME ; void CLbsLocator::AddMovementObserverL(class MLbsMovementObserver &) + ?Altitude@TLbsLocation@@QBEMXZ @ 8 NONAME ; float TLbsLocation::Altitude(void) const + ?AltitudeAccuracy@TLbsLocation@@QBEMXZ @ 9 NONAME ; float TLbsLocation::AltitudeAccuracy(void) const + ?Course@TLbsLocation@@QBEMXZ @ 10 NONAME ; float TLbsLocation::Course(void) const + ?CourseAccuracy@TLbsLocation@@QBEMXZ @ 11 NONAME ; float TLbsLocation::CourseAccuracy(void) const + ?GetBearingTo@TLbsLocation@@QBEHABV1@AAM@Z @ 12 NONAME ; int TLbsLocation::GetBearingTo(class TLbsLocation const &, float &) const + ?GetDistance@TLbsLocation@@QBEHABV1@AAM@Z @ 13 NONAME ; int TLbsLocation::GetDistance(class TLbsLocation const &, float &) const + ?GetLocatorOption@CLbsLocator@@QBEHW4TLbsLocatorOption@1@AAH@Z @ 14 NONAME ; int CLbsLocator::GetLocatorOption(enum CLbsLocator::TLbsLocatorOption, int &) const + ?GetMeanSpeed@TLbsLocation@@QBEHABV1@AAM@Z @ 15 NONAME ; int TLbsLocation::GetMeanSpeed(class TLbsLocation const &, float &) const + ?IsAltitudeValid@TLbsLocation@@QBEHXZ @ 16 NONAME ; int TLbsLocation::IsAltitudeValid(void) const + ?IsCourseValid@TLbsLocation@@QBEHXZ @ 17 NONAME ; int TLbsLocation::IsCourseValid(void) const + ?IsLatLongValid@TLbsLocation@@QBEHXZ @ 18 NONAME ; int TLbsLocation::IsLatLongValid(void) const + ?IsSpeedValid@TLbsLocation@@QBEHXZ @ 19 NONAME ; int TLbsLocation::IsSpeedValid(void) const + ?Latitude@TLbsLocation@@QBENXZ @ 20 NONAME ; double TLbsLocation::Latitude(void) const + ?LocatorClassSize@TLbsLocatorClassTypeBase@@QBEIXZ @ 21 NONAME ; unsigned int TLbsLocatorClassTypeBase::LocatorClassSize(void) const + ?LocatorClassType@TLbsLocatorClassTypeBase@@QBEKXZ @ 22 NONAME ; unsigned long TLbsLocatorClassTypeBase::LocatorClassType(void) const + ?LocatorProfile@CLbsLocator@@QBE?AVTUid@@XZ @ 23 NONAME ; class TUid CLbsLocator::LocatorProfile(void) const + ?Longitude@TLbsLocation@@QBENXZ @ 24 NONAME ; double TLbsLocation::Longitude(void) const + ?Move@TLbsLocation@@QAEHMM@Z @ 25 NONAME ; int TLbsLocation::Move(float, float) + ?MovementEvent@TLbsMovementEvent@@QBE?AW4TLbsMovementEventType@1@XZ @ 26 NONAME ; enum TLbsMovementEvent::TLbsMovementEventType TLbsMovementEvent::MovementEvent(void) const + ?NewL@CLbsLocator@@SAPAV1@AAVMLbsLocationObserver@@@Z @ 27 NONAME ; class CLbsLocator * CLbsLocator::NewL(class MLbsLocationObserver &) + ?NewL@CLbsLocator@@SAPAV1@XZ @ 28 NONAME ; class CLbsLocator * CLbsLocator::NewL(void) + ?RemoveLocationObserver@CLbsLocator@@QAEHAAVMLbsLocationObserver@@@Z @ 29 NONAME ; int CLbsLocator::RemoveLocationObserver(class MLbsLocationObserver &) + ?RemoveMovementObserver@CLbsLocator@@QAEHAAVMLbsMovementObserver@@@Z @ 30 NONAME ; int CLbsLocator::RemoveMovementObserver(class MLbsMovementObserver &) + ?SetAltitude@TLbsLocation@@QAEHMM@Z @ 31 NONAME ; int TLbsLocation::SetAltitude(float, float) + ?SetCourse@TLbsLocation@@QAEHMM@Z @ 32 NONAME ; int TLbsLocation::SetCourse(float, float) + ?SetLocation@TLbsLocation@@QAEHNNM@Z @ 33 NONAME ; int TLbsLocation::SetLocation(double, double, float) + ?SetLocatorOption@CLbsLocator@@QAEHW4TLbsLocatorOption@1@H@Z @ 34 NONAME ; int CLbsLocator::SetLocatorOption(enum CLbsLocator::TLbsLocatorOption, int) + ?SetLocatorProfile@CLbsLocator@@QAEHVTUid@@@Z @ 35 NONAME ; int CLbsLocator::SetLocatorProfile(class TUid) + ?SetMovementEvent@TLbsMovementEvent@@QAEXW4TLbsMovementEventType@1@@Z @ 36 NONAME ; void TLbsMovementEvent::SetMovementEvent(enum TLbsMovementEvent::TLbsMovementEventType) + ?SetSpeed@TLbsLocation@@QAEHMM@Z @ 37 NONAME ; int TLbsLocation::SetSpeed(float, float) + ?SetSystemTimeStamp@TLbsLocation@@QAEHVTTime@@@Z @ 38 NONAME ; int TLbsLocation::SetSystemTimeStamp(class TTime) + ?SetSystemTimeStamp@TLbsMovementEvent@@QAEHVTTime@@@Z @ 39 NONAME ; int TLbsMovementEvent::SetSystemTimeStamp(class TTime) + ?Speed@TLbsLocation@@QBEMXZ @ 40 NONAME ; float TLbsLocation::Speed(void) const + ?SpeedAccuracy@TLbsLocation@@QBEMXZ @ 41 NONAME ; float TLbsLocation::SpeedAccuracy(void) const + ?StartUpdatesL@CLbsLocator@@QAEXXZ @ 42 NONAME ; void CLbsLocator::StartUpdatesL(void) + ?StopUpdates@CLbsLocator@@QAEXXZ @ 43 NONAME ; void CLbsLocator::StopUpdates(void) + ?SystemTimeStamp@TLbsLocation@@QBE?AVTTime@@XZ @ 44 NONAME ; class TTime TLbsLocation::SystemTimeStamp(void) const + ?SystemTimeStamp@TLbsMovementEvent@@QBE?AVTTime@@XZ @ 45 NONAME ; class TTime TLbsMovementEvent::SystemTimeStamp(void) const + diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/eabi/lbslocatoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/eabi/lbslocatoru.def Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,58 @@ +EXPORTS + _ZN11CLbsLocator11StopUpdatesEv @ 1 NONAME + _ZN11CLbsLocator13StartUpdatesLEv @ 2 NONAME + _ZN11CLbsLocator16SetLocatorOptionENS_17TLbsLocatorOptionEi @ 3 NONAME + _ZN11CLbsLocator17SetLocatorProfileE4TUid @ 4 NONAME + _ZN11CLbsLocator20AddLocationObserverLER20MLbsLocationObserver @ 5 NONAME + _ZN11CLbsLocator20AddMovementObserverLER20MLbsMovementObserver @ 6 NONAME + _ZN11CLbsLocator22RemoveLocationObserverER20MLbsLocationObserver @ 7 NONAME + _ZN11CLbsLocator22RemoveMovementObserverER20MLbsMovementObserver @ 8 NONAME + _ZN11CLbsLocator4NewLER20MLbsLocationObserver @ 9 NONAME + _ZN11CLbsLocator4NewLEv @ 10 NONAME + _ZN11CLbsLocatorD0Ev @ 11 NONAME + _ZN11CLbsLocatorD1Ev @ 12 NONAME + _ZN11CLbsLocatorD2Ev @ 13 NONAME + _ZN12TLbsLocation11SetAltitudeEff @ 14 NONAME + _ZN12TLbsLocation11SetLocationEddf @ 15 NONAME + _ZN12TLbsLocation18SetSystemTimeStampE5TTime @ 16 NONAME + _ZN12TLbsLocation4MoveEff @ 17 NONAME + _ZN12TLbsLocation8SetSpeedEff @ 18 NONAME + _ZN12TLbsLocation9SetCourseEff @ 19 NONAME + _ZN12TLbsLocationC1Ev @ 20 NONAME + _ZN12TLbsLocationC2Ev @ 21 NONAME + _ZN17TLbsMovementEvent16SetMovementEventENS_21TLbsMovementEventTypeE @ 22 NONAME + _ZN17TLbsMovementEvent18SetSystemTimeStampE5TTime @ 23 NONAME + _ZN17TLbsMovementEventC1Ev @ 24 NONAME + _ZN17TLbsMovementEventC2Ev @ 25 NONAME + _ZN24TLbsLocatorClassTypeBaseC1Ev @ 26 NONAME + _ZN24TLbsLocatorClassTypeBaseC2Ev @ 27 NONAME + _ZNK11CLbsLocator14LocatorProfileEv @ 28 NONAME + _ZNK11CLbsLocator16GetLocatorOptionENS_17TLbsLocatorOptionERi @ 29 NONAME + _ZNK12TLbsLocation11GetDistanceERKS_Rf @ 30 NONAME + _ZNK12TLbsLocation12GetBearingToERKS_Rf @ 31 NONAME + _ZNK12TLbsLocation12GetMeanSpeedERKS_Rf @ 32 NONAME + _ZNK12TLbsLocation12IsSpeedValidEv @ 33 NONAME + _ZNK12TLbsLocation13IsCourseValidEv @ 34 NONAME + _ZNK12TLbsLocation13SpeedAccuracyEv @ 35 NONAME + _ZNK12TLbsLocation14CourseAccuracyEv @ 36 NONAME + _ZNK12TLbsLocation14IsLatLongValidEv @ 37 NONAME + _ZNK12TLbsLocation15IsAltitudeValidEv @ 38 NONAME + _ZNK12TLbsLocation15SystemTimeStampEv @ 39 NONAME + _ZNK12TLbsLocation16AltitudeAccuracyEv @ 40 NONAME + _ZNK12TLbsLocation5SpeedEv @ 41 NONAME + _ZNK12TLbsLocation6CourseEv @ 42 NONAME + _ZNK12TLbsLocation8AccuracyEv @ 43 NONAME + _ZNK12TLbsLocation8AltitudeEv @ 44 NONAME + _ZNK12TLbsLocation8LatitudeEv @ 45 NONAME + _ZNK12TLbsLocation9LongitudeEv @ 46 NONAME + _ZNK17TLbsMovementEvent13MovementEventEv @ 47 NONAME + _ZNK17TLbsMovementEvent15SystemTimeStampEv @ 48 NONAME + _ZNK24TLbsLocatorClassTypeBase16LocatorClassSizeEv @ 49 NONAME + _ZNK24TLbsLocatorClassTypeBase16LocatorClassTypeEv @ 50 NONAME + _ZTI11CLbsLocator @ 51 NONAME ; ## + _ZTI20MLbsLocationObserver @ 52 NONAME ; ## + _ZTI20MLbsMovementObserver @ 53 NONAME ; ## + _ZTV11CLbsLocator @ 54 NONAME ; ## + _ZTV20MLbsLocationObserver @ 55 NONAME ; ## + _ZTV20MLbsMovementObserver @ 56 NONAME ; ## + diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/group/BLD.INF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/group/BLD.INF Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The common build file. +* +*/ + +// Main projects, in build order +PRJ_EXPORTS +../inc/lbslocatorclasstypes.h lbslocatorclasstypes.h +../inc/lbslocator.h lbslocator.h +../inc/lbslocation.h lbslocation.h +../inc/lbsmovementevent.h lbsmovementevent.h +../inc/lbslocationobserver.h lbslocationobserver.h +../inc/lbsmovementobserver.h lbsmovementobserver.h + +PRJ_MMPFILES +lbslocator.mmp + diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/group/lbslocator.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/group/lbslocator.mmp Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,40 @@ +// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +// NOTE: ***** TEST UID BELOW***** +TARGET lbslocator.dll +TARGETTYPE DLL +UID 0x1000007A 0xE36F1DC6 + + +CAPABILITY Location + + +SOURCEPATH ../src +SOURCE lbslocatorclasstypes.cpp +SOURCE lbslocator.cpp +SOURCE lbslocation.cpp +SOURCE lbsmovementevent.cpp +SOURCE lbslocationobserver.cpp +SOURCE lbsmovementobserver.cpp + +USERINCLUDE ../inc + +SYSTEMINCLUDE ../inc +SYSTEMINCLUDE /epoc32/include + +LIBRARY euser.lib +LIBRARY lbs.lib + diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/inc/lbslocation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/inc/lbslocation.h Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __LBSLOCATION_H__ +#define __LBSLOCATION_H__ + +#include +#include + +/** +@file +@internalTechnology +@prototype +*/ + +/** + * TLbsLocation - Contains a position and its accuracy. May contain altitude, speed and course. + * See .cpp file for extended comments. + */ + +class TLbsLocation : public TLbsLocatorClassTypeBase + { +public: + IMPORT_C TLbsLocation(); + + /* Latitude, Longitude and Accuracy methods return 0 if not assigned */ + IMPORT_C TBool IsLatLongValid() const; + IMPORT_C TReal64 Latitude() const; + IMPORT_C TReal64 Longitude() const; + IMPORT_C TReal32 Accuracy() const; + + /* Altitude and AltitudeAccuracy return 0 if not assigned */ + IMPORT_C TBool IsAltitudeValid() const; + IMPORT_C TReal32 Altitude() const; + IMPORT_C TReal32 AltitudeAccuracy()const; + + /*Speed and accuracy return 0 if not assigned */ + IMPORT_C TBool IsSpeedValid() const; + IMPORT_C TReal32 Speed() const; + IMPORT_C TReal32 SpeedAccuracy() const; + + /* Course and accuracy returns 0 if not assigned */ + IMPORT_C TBool IsCourseValid() const; + IMPORT_C TReal32 Course() const; + IMPORT_C TReal32 CourseAccuracy() const; + + /* Calculate the differences from this location to another location*/ + IMPORT_C TInt GetMeanSpeed(const TLbsLocation& aOtherLocation, TReal32& aMeanSpeed)const; + IMPORT_C TInt GetDistance(const TLbsLocation& aOtherLocation, TReal32& aDistance) const; + IMPORT_C TInt GetBearingTo(const TLbsLocation& aOtherLocation, TReal32& aBearing) const; + + /* Translate this location along the bearing to the specified distance */ + IMPORT_C TInt Move(TReal32 aBearing, TReal32 aDistance); + + /* SystemTimeStamp returns a time of 0 if not assigned */ + IMPORT_C TTime SystemTimeStamp() const; + + /* Methods to set values - see detailed comments for valid parameter ranges */ + IMPORT_C TInt SetLocation(TReal64 aLatitude, TReal64 aLongitude, TReal32 aAccuracy); + IMPORT_C TInt SetAltitude(TReal32 aAltitude, TReal32 aAccuracy); + IMPORT_C TInt SetSpeed(TReal32 aSpeed, TReal32 aAccuracy); + IMPORT_C TInt SetCourse(TReal32 aCourse, TReal32 aAccuracy); + IMPORT_C TInt SetSystemTimeStamp(TTime aTimeStamp); + +private: + TBool iIsLocationValid; + TReal64 iLatitude; + TReal64 iLongitude; + TReal32 iHorizontalAccuracy; + + TBool iIsAltitudeValid; + TReal32 iAltitude; + TReal32 iAltitudeAccuracy; + + TBool iIsSpeedValid; + TReal32 iSpeed; + TReal32 iSpeedAccuracy; + + TBool iIsCourseValid; + TReal32 iCourse; + TReal32 iCourseAccuracy; + + TTime iSystemTimeStamp; + + TInt iReserved[24]; + }; + + +#endif //__LBSLOCATION_H__ diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/inc/lbslocationobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/inc/lbslocationobserver.h Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __LBSLOCATIONOBSERVER_H__ +#define __LBSLOCATIONOBSERVER_H__ + +/** +@file +@internalTechnology +@prototype +*/ + +#include + +/** + * MLbsLocationObserver - Provides callback methods for CLbsLocator to send location updates + * and status reports to the application. + * + * Location updates provide Latitude and Longitude information and may contain Altitude, + * Course and Speed data. + * + * The frequency and accuracy of these updates and the power consumed is dependent on + * the performance profile being used. + * + * Applications need only to implement the HandleLocationUpdate() method of this class. + * If status information is important then HandleLocationStatus() should also be implemented. + * + * @see CLbsLocator + * @see TLbsLocation + */ +class MLbsLocationObserver + { +public: + virtual void HandleLocationUpdate(const TLbsLocation& aLocation) = 0; + virtual void HandleLocationStatus(TInt aStatus); + virtual TVersion Version() const; + }; + +#endif //__LBSLOCATIONOBSERVER_H__ diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/inc/lbslocator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/inc/lbslocator.h Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __LBSLOCATOR_H__ +#define __LBSLOCATOR_H__ + +/*! \mainpage Locator API (CLbsLocator) + * + * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.\n\n + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html".\n\n + * + * Initial Contributors:\n\n + * - Nokia Corporation - initial contribution.\n\n + * + * Contributors:\n\n + * + * Description:\n\n + * + * API Version 0.5. Status: Draft. + * + * The interface class CLbsLocator provides a simple but powerful means of obtaining + * location and movement information. Application should #include and + * link against the library lbslocator.lib + * + * A location contains a latitude and longitude and may include altitude, speed and direction. + * Movement information provides a general indication of whether the device is stationary or moving. + * It may also indicate whether the user is walking. + * + * Applications request location and movement information via CLbsLocator with updates being + * sent to observer classes. To receive Location information, the application must derive from + * MLbsLocationObserver. The data class TLbsLocation is supplied as the callback parameter and + * holds the location information. + * + * Movement updates are sent to the application via the observer class MLbsMovementObserver. + * The movement details are passed as a callback parameter of type TLbsMovementEvent. + * + * The CLbsLocator API supersedes the RPositionServer/RPositioner interface. However, those interfaces are + * still supported. + * + * The API abstracts which technologies are used to provide location and movement information. + * Although the underlying technologies could include GPS, Network Cell, W-LAN positioning, + * accelerometer and compass, these are hidden from the application. + * + * The application indicates its desired level of accuracy and performance by specifying the + * profile to use. Profiles are predefined by the API and encompass a set of rules and + * performance targets - for example, position accuracy and the distance between updates. + * Each profile is suited to a particular use case. The method CLbsLocator::SetLocatorProfile() + * is used to select the active profile. + * + * This version of the API defines the following profiles: + * - KLbsProfileIdDefault + * - Suitable for legacy applications requiring satellite based position updates every second.\n\n + * - KLbsProfileIdAreaMonitor + * - Enables applications to determine the town or which part of a city the device is + * currently situated. Locations are updated as the device moves into other areas. + * This profile is designed to use very low power.\n\n + * - KLbsProfileIdLazyTracker + * - Provides a more power effecient means than the default profile of accurately recording + * the movements of the device over an extended period. + * + * See CLbsLocator::SetLocatorProfile() for more information. + * + * The active profile can be dynamically changed by the application. This allows applications + * to easily switch to a different level of performance depending on the stage of their lifecycle. + * + * Change History + * - 0.5: 30 Arpil 2010 + * - Initial draft contribued to Foundation + */ + +/** +@file +@internalTechnology +@prototype +*/ + +#include + +#include +#include +#include +#include +#include + +/** Target accuracy of 20m. Updates every second. See CLbsLocator::SetLocatorProfile() for more information */ +const TUid KLbsProfileIdDefault = { 0x00000000 }; +/** Accuracy of approximately 3km. Updates between 100m and 3km. See CLbsLocator::SetLocatorProfile() for more information */ +const TUid KLbsProfileIdAreaMonitor = { 0x00000001 }; +/** Target accuracy of 20m. Updates when device moves 30m or more. See CLbsLocator::SetLocatorProfile() for more information */ +const TUid KLbsProfileIdLazyTracker = { 0x00000002 }; + +//Forward declarations +class CLbsLocatorImpl; + +/** + * CLbsLocator - Interface class to request location and movement information. + * + * After creating a new instance of the interface via one of the NewL() methods, applications + * should set their desired profile using SetLocatorProfile(). To begin receiving + * updates, the StartUpdatesL() method must be called. + * + * The frequency and accuracy of these updates and the power consumed is dependent on + * the profile being used. + * + * Updates are sent to one or more Observers. + * The MLbsLocationObserver class is used to receive location updates (i.e. containing + * latitude and longitude). The MLbsMovementObserver class is used to receive events + * related to the movement of the device (for example stationary or moving). + * + * A location observer may be supplied via the NewL() but observers can also be added using + * AddLocationObserverL() and AddMovementObserverL(). It is possible to have multiple + * observers for each type of update. + * + * At least one observer should be present before the application calls StartUpdatesL(). + * + * Applications must have the Location capability to receive location updates. + * + * @see MLbsLocationObserver + * @see MLbsMovementObserver + */ +class CLbsLocator : public CBase + { +public: + /** Used a parameter to SetLocatorOption() to tailor the behaviour of the active profile. + * When the profile is changed, any previously modified option is returned to the default. + * @see SetLocatorOption() @see GetLocatorOption()*/ + enum TLbsLocatorOption + { + /** Controls when status updates are generated. */ + ELocatorStatusTimer = 1, + }; + + IMPORT_C static CLbsLocator* NewL(); + IMPORT_C static CLbsLocator* NewL(MLbsLocationObserver& aObserver); + + IMPORT_C ~CLbsLocator(); + + // Select the desired profile. If none selected "TLbsProfileIdDefault" is assumed. + IMPORT_C TInt SetLocatorProfile(TUid aProfileId); + IMPORT_C TUid LocatorProfile() const; + + // Start and stop requesting updates. Updates are sent to "observers" of the interface. + // StartUpdatesL() will consume resources even if there are no observers. + IMPORT_C void StartUpdatesL(); + IMPORT_C void StopUpdates(); + + // Modify the bahviour of the active profile. + IMPORT_C TInt SetLocatorOption(TLbsLocatorOption aOption, TInt aValue); + IMPORT_C TInt GetLocatorOption(TLbsLocatorOption aOption, TInt& aValue) const; + + // Add and Remove more position observers. + // If no observers present, then resouces may be consumed until StopUpdates() is called. + IMPORT_C void AddLocationObserverL(MLbsLocationObserver& aObserver); + IMPORT_C TInt RemoveLocationObserver(MLbsLocationObserver& aObserver); + + IMPORT_C void AddMovementObserverL(MLbsMovementObserver& aObserver); + IMPORT_C TInt RemoveMovementObserver(MLbsMovementObserver& aObserver); + +private: + CLbsLocator(); + void ConstructL(MLbsLocationObserver* aObserver); + + CLbsLocatorImpl *iImpl; + }; + +#endif //__LBSLOCATOR_H__ + diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/inc/lbslocatorclasstypes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/inc/lbslocatorclasstypes.h Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __LBSLOCATORCLASSTYPES_H__ +#define __LBSLOCATORCLASSTYPES_H__ + +#include + +/** +@file +@internalTechnology +@prototype +*/ + +enum TLbsLocatorClassTypes + { + ELbsLocatorBaseClassType = 0x01, + ELbsLocationClassType = 0x02, + ELbsMovementEventClassType = 0x04 + }; + +/** + * TLbsLocatorClassTypeBase - Base class for data generated by CLbsLocator. + * + * + */ +class TLbsLocatorClassTypeBase + { +public: + IMPORT_C TUint32 LocatorClassType() const; + + IMPORT_C TUint LocatorClassSize() const; + +protected: + TLbsLocatorClassTypeBase(); + +protected: + /** The type of the derived class */ + TUint32 iClassType; + /** The size of the derived class */ + TUint iClassSize; + }; + +#endif //__LBSLOCATORCLASSTYPES_H__ diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/inc/lbsmovementevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/inc/lbsmovementevent.h Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __LBSMOVEMENTEVENT_H__ +#define __LBSMOVEMENTEVENT_H__ + +#include +#include + +/** +@file +@internalTechnology +@prototype +*/ + +/** + * TLbsMovementEvent - Contains the movement status of the device. + * + * To receive movement events, the application must add an movement event observer using + * CLbsLocator::AddMovementObserverL() and implement the callback method + * MLbsMovementObserver::HandleMovementUpdate(). + * + * To begin receiving updates, the application should call CLbsLocator::StartUpdatesL(). + * Although this only needs to be called once irrespective of the number or type of + * observers. + * + * Not all profiles support movement events. Some profiles only support a limited + * subset of the possible event types. See CLbsLocator::SetLocatorProfile() for information + * about the movement events supported by each profile. + * + */ +class TLbsMovementEvent : public TLbsLocatorClassTypeBase + { +public: + /** TLbsMovementEventType - Contain a bit mask of movement event types. + * For example, the application be notified that both walking and general movement has been detected. + * Note: This enum may be expanded to include other types of events related to movement. + */ + enum TLbsMovementEventType + { + EMovementEventUnknown = 0, + EMovementEventStationary = 1, + EMovementEventMoving = 2, + EMovementEventWalking = 4, + EMovementEventLastBit = 1 << 31 + }; + + IMPORT_C TLbsMovementEvent(); + + IMPORT_C TLbsMovementEventType MovementEvent() const; + IMPORT_C TTime SystemTimeStamp() const; + + IMPORT_C void SetMovementEvent(TLbsMovementEventType aEvent); + IMPORT_C TInt SetSystemTimeStamp(TTime aTimeStamp); + +private: + TLbsMovementEventType iEvent; + TTime iSystemTimeStamp; + TInt iReserved[24]; + }; + + +#endif //__LBSMOVEMENTEVENT_H__ diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/inc/lbsmovementobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/inc/lbsmovementobserver.h Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __LBSMOVEMENTOBSERVER_H__ +#define __LBSMOVEMENTOBSERVER_H__ + +/** +@file +@internalTechnology +@prototype +*/ + +#include +#include + +/** + * MLbsMovementObserver - Provides callback methods for CLbsLocator to send movement events + * to the application. + * + * Movement events provide an indication of wherether the user is stationary or moving. + * Potentially, they may also indicate whether the user is walking. + * + * The range of movement detection supported and the power consumed is dependent on + * the performance profile being used. + * + * Applications need only to implement the HandleMovementUpdate() method of this class. + * If status information is important then HandleMovementStatus() should also be defined. + * + * @see CLbsLocator + * @see TLbsMovementEvent + */ +class MLbsMovementObserver + { +public: + virtual void HandleMovementUpdate(const TLbsMovementEvent& aEvent) = 0; + virtual void HandleMovementStatus(TInt aStatus); + virtual TVersion Version() const; + }; + + +#endif //__LBSMOVEMENTOBSERVER_H__ diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/src/lbslocation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/src/lbslocation.cpp Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,549 @@ +// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + +/** +@file +@internalTechnology +@prototype +*/ + +#include + +//============================================================================= +// Constructor +//============================================================================= + +EXPORT_C TLbsLocation::TLbsLocation() + { + iClassSize = sizeof(TLbsLocation); + iClassType |= ELbsLocationClassType; + + iIsLocationValid = EFalse; + iLatitude = 0.0; + iLongitude = 0.0; + iHorizontalAccuracy = 0.0; + + iIsAltitudeValid = EFalse; + iAltitude = 0.0; + iAltitudeAccuracy = 0.0; + + iIsSpeedValid = EFalse; + iSpeed = 0.0; + iSpeedAccuracy = 0.0; + + iIsCourseValid = EFalse; + iCourse = 0.0; + iCourseAccuracy = 0.0; + +#pragma message ("***Need to initiase timestamp***") + //iSystemTimeStamp = ... + } + + +//============================================================================= +// Latitude and Longitude +//============================================================================= + +/** + * Determines if a latitude and longitude and (horizontal) accuracy has been assigned. + * + * Positions returned by the location subsystem will have a valid latitude, longitude + * and accuracy. + * + * When applications create their own instances of the TLbsLocation class this + * method will return EFalse until a latitude and longitude has been assigned. + * + * @return ETrue When a valid latitude and longitude are available for the location. + * @return EFalse When no valid latitude and longitude are available for the location. + * @see Latitude() + * @see Longitude() + * @see Accuracy() + * @see SetLocation() + */ +EXPORT_C TBool TLbsLocation::IsLatLongValid() const + { + return iIsLocationValid; + } + +/** + * Retrieves the latitude of the location. Coordinates are referenced to WGS84 datum. + * + * If the latitude has not been assigned the method returns zero. + * + * Applications should use IsLatLongValid() to determine if there is a valid latitude. + * + * @return The latitude of the location in degrees from the range -90 to +90 when the location contains a valid latitude. + * @return Zero if the latitude has not been assigned. + * @see IsLatLongValid() + * @see Longitude() + * @see Accuracy() + * @see SetLocation() + */ +EXPORT_C TReal64 TLbsLocation::Latitude() const + { + return iLatitude; + } + +/** + * Retrieves the longitude of the location. Coordinates are referenced to WGS84 datum. + * + * If the longitude has not been assigned the method returns zero. + * + * Applications should use IsLatLongValid() to determine if there is a valid longitude. + * + * @return The longitude of the location in degrees from the range 0 up to (but not including) 360 when the location contains a valid longitude. + * @return Zero if the longitude has not been assigned. + * @see IsLatLongValid() + * @see Latitude() + * @see Accuracy() + * @see SetLocation() + */ +EXPORT_C TReal64 TLbsLocation::Longitude() const + { + return iLongitude; + } + +/** + * Retrieves the horizontal (circular) accuracy of the latitude and longitude in meters. + * + * If the accuracy has not been assigned the method returns zero. + * + * Applications should use IsLatLongValid() to determine if there is a valid accuracy. + * + * @return The circular accuracy in meters of the latitude and longitude + * @return Zero if the location accuracy has not been assigned. + * @see IsLatLongValid() + * @see Latitude() + * @see Longitude() + * @see SetLocation() + */ +EXPORT_C TReal32 TLbsLocation::Accuracy() const + { + return iHorizontalAccuracy; + } + +/** + * Sets the position information for the location. + * + * If the latitude and longitude paramaters are outside the range [-90,+90], [0,360) the position + * will be automatically adjusted to fall within the valid range. For example, attempting to set + * a position of latitude 91, longitude 0 will be converted into 89, 180, respectively. + * + * After these parameters have been successfully assigned, the method IsLatLongValid() will return ETrue. + * + * @param[in] aLatitude The latitude of the location in degrees. Normal range is 0 up to (but not including) 360 degrees. + * @param[in] aLongitude The longitude of the location in degrees. Normal range is -90 to +90 (inclusive). + * @param[in] aAccuracy The accuracy of the course in degrees. Value cannot be negative + * @return KErrNone If parameter aAccuracy is in range and have been set successfully. + * @return KErrArgument If parameter aAccuracy is negative. + * @see IsLatLongValid() + * @see Latitude() + * @see Longitude() + * @see Accuracy() + */ +EXPORT_C TInt TLbsLocation::SetLocation(TReal64 aLatitude, TReal64 aLongitude, TReal32 aAccuracy) + { + iLatitude = aLatitude; + iLongitude = aLongitude; + iHorizontalAccuracy = aAccuracy; + iIsLocationValid = ETrue; + return KErrNone; + } + +//============================================================================= +// Altitude +//============================================================================= + +/** + * Determines if an altitude has been assigned. + * + * Availability of altitude information is dependent on the underlying positioning technology and + * will not always be present. + * + * @return ETrue When a valid altitude is available for the location. + * @return EFalse When altitude information is unavailable. + * @see Altitude() + * @see AltitudeAccuracy() + * @see SetAltitude() + */ +EXPORT_C TBool TLbsLocation::IsAltitudeValid() const + { + return iIsAltitudeValid; + } + +/** + * Retrieves the altitude in meters for the location. + * + * If the altitude is not available the method returns zero. + * Availability of altitude information is dependent on the underlying positioning technology and + * will not always be present. + * + * Applications should use IsAltitudeValid() to determine if there is a valid altitude. + * + * @return The altitude in meters when the location contains a valid altitude. + * @return Zero when altitude information is unavailable. + * @see IsAltitudeValid() + * @see AltitudeAccuracy() + * @see SetAltitude() + */ +EXPORT_C TReal32 TLbsLocation::Altitude() const + { + return iAltitude; + } + +/** + * Retrieves the vertical accuracy of the location. + * + * If the altitude is not available the method returns zero. + * Availability of altitude information is dependent on the underlying positioning technology and + * will not always be present. + * + * Applications should use IsAltitudeValid() to determine if there is a valid altitude. + * + * @return The vertical accuracy in meters when the location contains a valid altitide. + * @return Zero when altitude information is unavailable. + * @see IsAltitudeValid() + * @see Altitude() + * @see SetAltitude() + */ +EXPORT_C TReal32 TLbsLocation::AltitudeAccuracy() const + { + return iAltitudeAccuracy; + } + +/** + * Sets the altitude information for the location. + * + * After the altitude has been successfully assigned, the method IsAltitudeValid will return ETrue. + * + * @param[in] aAltitude The altitude of the location in meters. + * @param[in] aAccuracy The accuracy of the course in degrees. Value cannot be negative + * @return KErrNone If parameter aAccuracy is in range and have been set successfully. + * @return KErrArgument If parameter aAccuracy is negative. + * @see IsAltitudeValid() + * @see Altitude() + * @see AltitudeAccuracy() + */ +EXPORT_C TInt TLbsLocation::SetAltitude(TReal32 aAltitude, TReal32 aAccuracy) + { + iAltitude = aAltitude; + iAltitudeAccuracy = aAccuracy; + iIsAltitudeValid = ETrue; + return KErrNone; + } + + +//============================================================================= +// Speed +//============================================================================= + +/** + * Determines if a valid speed is available. + * + * Availability of speed information is dependent on the underlying positioning technology and + * will not always be present. + * Even satellite based technologies may not provide speed information in certain circumstances. + * + * @return ETrue When a valid speed is available for the location. + * @return EFalse When speed information is unavailable. + * @see Speed() + * @see SpeedAccuracy() + * @see SetSpeed() + */ +EXPORT_C TBool TLbsLocation::IsSpeedValid() const + { + return iIsSpeedValid; + } + +/** + * Retrieves the speed in meters per second. + * + * If the speed is not available the method returns zero. + * + * Availability of speed information is dependent on the underlying positioning technology and + * will not always be present. + * Even satellite based technologies may not provide speed information in certain circumstances. + * + * Applications should use IsSpeedValid() to determine if there is a valid speed. + * + * @return The speed in meters per second when the location contains a valid speed. + * @return Zero when speed is unavailable. + * @see IsSpeedValid() + * @see SpeedAccuracy() + * @see SetSpeed() + */ +EXPORT_C TReal32 TLbsLocation::Speed() const + { + return iSpeed; + } + +/** + * Retrieves the accuracy of the speed information in meters per second. + * + * If the speed is not available the method returns zero. + * + * Availability of speed information is dependent on the underlying positioning + * technology and will not always be present. + * + * When speed information is available, the accuracy indicates the size of the error band. + * The actual speed may be above or below the reported speed but the difference should be + * less than or equal to the speed accuracy. + * + * Applications should use IsSpeedValid() to determine if there is a valid speed. + * + * @return The accuracy speed in meters per second when the location contains a valid speed. + * @return Zero when the speed is unavailable. + * @see IsSpeedValid() + * @see Speed() + * @see SetSpeed() + */ +EXPORT_C TReal32 TLbsLocation::SpeedAccuracy() const + { + return iSpeedAccuracy; + } + +/** + * Sets the speed information for the location. + * + * After the speed has been successfully assigned, the method IsSpeedValid() will return ETrue. + * + * @param[in] aSpeed The speed that is related to the location in meters per second. Value cannot be negative. + * @param[in] aAccuracy The accuracy of the speed in meters per second. Value cannot be negative. + * + * @return KErrNone If all parameters are in range and have been set successfully. + * @return KErrArgument If either parameter is negative. + * @see IsSpeedValid() + * @see Speed() + * @see SpeedAccuracy() + */ +EXPORT_C TInt TLbsLocation::SetSpeed(TReal32 aSpeed, TReal32 aAccuracy) + { + iSpeed = aSpeed; + iSpeedAccuracy = aAccuracy; + iIsSpeedValid = ETrue; + return KErrNone; + } + +//============================================================================= +// Course +//============================================================================= + +/** + * Determines if a valid course is available. + * + * Availability of course information is dependent on the underlying positioning technology and + * will not always be present. + * Even satellite based technologies may not provide course information in certain circumstances. + * + * @return ETrue When a valid course is available for the location. + * @return EFalse When course information is unavailable. + * @see Course() + * @see CourseAccuracy() + * @see SetCourse() + */ +EXPORT_C TBool TLbsLocation::IsCourseValid() const + { + return iIsCourseValid; + } + +/** + * Retrieves the course in degrees counting clockwise relative to true north. + * + * If the course is not available, the method returns zero. + * + * Availability of course information is dependent on the underlying positioning technology and + * will not always be present. + * Even satellite based technologies may not provide course information in certain circumstances. + * + * Applications should use IsCourseValid() to determine if there is a valid course. + * + * When there is a valid course, the range of values will be from [0 to 360). + * That is: values can be up to (but will not include) 360. A value of 0 indicates the device is heading north. + * + * @return The course in degrees from the range [0 to 360) when the location contains a valid course. + * @return Zero when course information is unavailable. + * @see IsCourseValid() + * @see CourseAccuracy() + * @see SetCourse() + */ +EXPORT_C TReal32 TLbsLocation::Course() const + { + return iCourse; + } + +/** + * Retrieves the accuracy of the course information in degrees. + * + * If the course is not available the method returns zero. + * + * Availability of course information is dependent on the underlying positioning technology and + * will not always be present. + * + * Applications should use IsCourseValid() to determine if there is a valid course. + * + * When course information is available, the accuracy indicates the size of the error band. + * The actual course may be vary from the reported course but the difference should be less + * than or equal to the course accuracy. + * + * @return The accuracy of the course in degrees when the location contains a valid course. + * @return Zero when course information is unavailable. + * @see IsCourseValid() + * @see Course() + * @see SetCourse() + */ +EXPORT_C TReal32 TLbsLocation::CourseAccuracy() const + { + return iCourseAccuracy; + } + +/** + * Sets the course information for the location. + * + * If the course paramater is outside the range [0,360) it will be automatically + * adjusted to fall within the valid range. For example, attempting to set a course + * 361 degrees will be converted to 1 degree. + * + * After the course has been successfully assigned, the method IsCourseValid() will return ETrue. + * + * @param[in] aCourse Degrees counting clockwise relative to true north. Normal range is 0 up to (but not including) 360. + * @param[in] aAccuracy The accuracy of the course in degrees. Value cannot be negative + * @return KErrNone If parameter aAccuracy is in range and have been set successfully. + * @return KErrArgument If parameter aAccuracy is negative. + * @see IsCourseValid() + * @see Course() + * @see CourseAccuracy() + */ +EXPORT_C TInt TLbsLocation::SetCourse(TReal32 aCourse, TReal32 aAccuracy) + { + iCourse = aCourse; + iCourseAccuracy = aAccuracy; + iIsCourseValid = ETrue; + return KErrNone; + } + + +//============================================================================= +// Timestamp +//============================================================================= + +/** + * Retrieves the time on the device when the location entered the system. + * + * If this time stamp has not been assigned, a TTime of "zero" will be returned. + * + * This timestamp is assigned by the local device and reflects when the location information injected. + * In particular, this timestamp does not provide technology specific information such as GPS time. + * + * @return The time when the location entered the system. + * @return Zero If no valid course is available. + * @see SetSystemTimeStamp() + */ +EXPORT_C TTime TLbsLocation::SystemTimeStamp() const + { + return iSystemTimeStamp; + } + +/** + * Sets the system time stamp for the location information. + * + * This is the time when the location information entered the system. + * + * The parameter aTimeStamp must contain a valid time and cannot be "zero". + * + * @param[in] aTimeStamp The system time that is related to the location information. + * @return KErrNone If the time stamp has been set. + * @return KErrArgument If the parameter is invalid. For example, a time stamp of zero was supplied. + * @see SystemTimeStamp() + */ +EXPORT_C TInt TLbsLocation::SetSystemTimeStamp(TTime aTimeStamp) + { + iSystemTimeStamp = aTimeStamp; + return KErrNone; + } + +//============================================================================= +// GetMeanSpeed / GetDistance / GetBearingTo / Move +//============================================================================= + +/** + * This method calculates the mean horizontal speed in meters per second between + * this location and the supplied aOtherLocation. The speed is calculated based on the + * latitude and longitude of each of the locations and their system timestamps. + * + * @param[in] aOtherLocation A point different from this Location. + * @param[out] aMeanSpeed Upon successful completion, this is set to the speed + * indicated by being at this position at its recorded time, and at aOtherLocation + * at its recorded time. Always positive, in meters per second. + * @return KErrNone When the mean speed has been successfully calculated. + * @return KErrArgument If any of the Latitudes, Longitudes, or System Timestamps have not been assigned. + * @return KErrArgument If the System Timestamp for this or aOtherLocation are the same. + * @return A Symbian OS error code if some other problem prevents the calculation. + */ +EXPORT_C TInt TLbsLocation::GetMeanSpeed(const TLbsLocation& /*aOtherLocation*/, TReal32& /*aMeanSpeed*/) const + { + return KErrNotSupported; + } + +/** + * Calculate the distance between this location and the supplied location. + * @param[in] aOtherLocation A point different from this Location. + * @param[out] aDistance Upon successful completion, this is set to the distance + * between this location and aOtherLocation, in meters. + * @return KErrNone When the distance has been successfully calculated. + * @return KErrArgument If any of the Latitudes or Longitudes have not been assigned. + * @return A Symbian OS error code if some other problem prevents the calculation. + */ +EXPORT_C TInt TLbsLocation::GetDistance(const TLbsLocation& /*aOtherLocation*/, TReal32& /*aDistance*/) const + { + return KErrNotSupported; + } + +/** + * Calculate the bearing in degrees from this location to the supplied location. + * + * @param[in] aOtherLocation Target location. + * @param[out] aBearing Upon successful completion, this is set to the bearing + * from this location to aOtherLocation. Value is in degrees counting clockwise relative to true north. + * + * @return KErrNone When the bearing has been successfully calculated. + * @return KErrArgument If any of the Latitudes or Longitudes have not been assigned. + * @return KErrPositionIncalculable if this location is at a pole or if the + * two locations are the same or antipodal. + * @return A Symbian OS error code if some other problem prevents the calculation. + */ +EXPORT_C TInt TLbsLocation::GetBearingTo(const TLbsLocation& /*aOtherLocation*/, TReal32& /*aBearing*/) const + { + return KErrNotSupported; + } + + +/** + * This method moves this location aDistance in the direction specified + * by aBearing + * + * @param[in] aBearing The direction to move this location. Value is in degrees + * counting clockwise relative to true north. + * @param[in] aDistance The distance to move this Location. Value is in meters. + * + * @return KErrNone When the move has been successfully completed. + * @return KErrArgument If the Latitude or Longitude for this location have not been assigned. + * @return KErrPositionIncalculable if this location is at a pole. + * @return A Symbian OS error code if some other problem prevents the calculation. + */ +EXPORT_C TInt TLbsLocation::Move(TReal32 /*aBearing*/, TReal32 /*aDistance*/) + { + return KErrNotSupported; + } diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/src/lbslocationobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/src/lbslocationobserver.cpp Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,141 @@ +// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** +@file +@internalTechnology +@prototype +*/ + +#include "lbslocationobserver.h" + +//============================================================================= +// MLbsLocationLocationObserver +//============================================================================= + +/** + * Applications must implement this method to receive location updates. + * + * To begin receiving updates the application must call CLbsLocator::StartUpdatesL(). + * + * After calling StartUpdatesL(), the first update an application will receive is a cached location + * (if available). The application should check the accuracy of this initial update to determine + * how useful it is. The accuracy of cached positions is likely to vary from a few kilometers up + * to the country level. That is, an application may receive an initial position only based on the + * country they are in. + * + * Only after delivering any initial cached position will the system attempt obtain the current + * location. Application will normally be sent location updates with improving accuracy until + * the target accuracy for the active profile is achieved. + * + * When an application no longer wishes to receive updates it should call CLbsLocator::StopUpdates(). + * It is legal, valid and usual to stop updates from within the HandleLocationUpdate() callback. + * Stopping updates while the initial cached position is being deliverd, prevents the search for the + * current positioning being initiated. This is a useful technique to reduce cost and power consumption. + * + * The point at which subsequent updates sent to the application depends on the active profile. + * Applications will receive updates when the device has moved a designated distance and/or after + * a time period. + * + * Applications may received notification about the loss of accuracy and unavailability of position + * information by implementing the HandleLocationStatus() method. This method is also used to pass error + * information to the application. + * + * @param[in] aLocation Initially may contain a cached location if available, subsequent updates hold the current location of the device.\n + * The accuracy of the location should be checked to determine how useful it is to the application. + * + * @see TLbsLocation + * @see HandleLocationStatus + * @see CLbsLocator::StartUpdatesL() + * @see CLbsLocator::StopUpdates() + * @see CLbsLocator::SetLocatorProfile() + * @see CLbsLocator::SetLocatorOption() + */ +void MLbsLocationObserver::HandleLocationUpdate(const TLbsLocation& /*aLocation*/) + { + } + +/** + * Applications must implement this method to receive location status updates. + * + * To begin receiving status updates the application must call CLbsLocator::StartUpdatesL(). + * + * Status updates are typically generated when it has not been possible to obtain either a sufficiently + * accurate position for the active profile or indeed any position. Such events are normal and are + * often transient. They do not indicate an error with the hardware or system. + * + * In these types of situations, the parameter aStatus will contain a positive value. The + * system will continue to try and obtain a more accurate position and there is + * generally no need for the application to change profiles, stop or restart updates. + * + * When positions of target accuracy has been achieved, HandleLocationStatus() will be called with + * the status code of KErrNone. + * + * It depends on the active profile when status updates about the accuracy or availability + * of positions are sent to the application . Applications can change this timer period by calling + * CLbsLocator::SetLocatorOption() with the options ELocatorStatusTimer. + * + * If HandleLocationStatus() is called with a negative status code, this indicates there has been an + * error inside the location subsystem or with the connected hardware. These situations are generally + * not recoverable and the application would normally stop using the interface. + * + * When an application no longer wishes to receive updates it should call CLbsLocator::StopUpdates(). + * It is possible to call this method from within the HandleLocationStatus() callback. + * + * Typical values of parameter aStatus include: + * - KPositionQualityLoss: Indicates that although it is still possible to obtain a position for + * the current location, its accuracy does not meet that expected for the active profile. + * For example, in the Lazy Tracker profile this will occurr when it has not been possible to + * obatin a GPS position but a cell based location is available.\n\n + * + * - KPositionNotAvailable: This status code informs that application that no position information + * can be obatined for the current location.\n\n + * + * - KErrNone: Indicates that a previously reported problem related to the position availability + * or accuracy has passed. It is has now been possible to obtain positions that meets the target + * of the active profile.\n\n + * + * - When a Symbian OS (negative) error code is passed, this indicates there is a problem with + * the system and/or the hardware. This will normally prevent any position information being + * returned. + * + * @param[in] aStatus A positive value indicates there is a loss of accuracy or no position + * is currently available. This is generally a transient situation. A negative value means an + * error has occurred that will normally prevent any position information being returned. + * KErrNone is returned when normal service has been restored. + * + * @see HandleLocationUpdate + * @see CLbsLocator::SetLocatorOption() + * @see CLbsLocator::StartUpdatesL() + * @see CLbsLocator::StopUpdates() + * @see CLbsLocator::SetLocatorProfile() + */ +void MLbsLocationObserver::HandleLocationStatus(TInt /*aStatus*/) + { + } + + +/** + * This method should not be overridden by the application. + * + * It is queried by the location subsystem to determine the version of the observer interface used + * by the application. + * + */ +TVersion MLbsLocationObserver::Version() const + { + return TVersion(0,0,1); + } + diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/src/lbslocator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/src/lbslocator.cpp Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,495 @@ +// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + +/** +@file +@internalTechnology +@prototype +*/ + +//#include + +#include "lbslocator.h" + +//============================================================================= +// CLbsLocator - Constructors and Destructor +//============================================================================= + +/** + * Default constructor for the cell information retriever. + */ +CLbsLocator::CLbsLocator() + { + } + +/** + * Default constructor for the cell information retriever. + */ +void CLbsLocator::ConstructL(MLbsLocationObserver* /*aObserver*/) + { + //iImpl = CLbsCellInfoImpl::NewL(aObserver); + } + +/** + * Closes all open resources and stops updates being sent to the application. + * + * If an application wishes to temporarily halt updates it should use the StopUpdates() method. + * + * The destructor is normally called as the application is closing down. It is not a requirement + * to call StopUpdates() before deleting the interface but it is recommended to do so. + * + * Note: The destructor must not be invoked during any form of callback from the interface to one + * of the application's observers. For example during a location or movement update. + * This is a programming error and is likely to result in an application crash. + * + * It is however possible and legal to call StopUpdates() during an update callback. + * + * @see StopUpdates() + */ +EXPORT_C CLbsLocator::~CLbsLocator() + { + //delete iImpl; + //iImpl = NULL; + } + +/** + * Creates a new instance of the CLbsLocator interface class. + * + * After the instance of the interface has been created, the application should select the desired + * profile using SetLocatorProfile(). To begin receiving location and/or movement information, + * the application must call StartUpdatesL(). The frequency and accuracy of these updates + * depend on the profile selected. + * + * Additional observers can be added by the methods AddLocationObserverL() or AddMovementObserverL(). + * + * Note: The application must have the Location capability to call this version of NewL(). + * Otherwise, the method will leave with the error KErrPermissionDenied. + * + * @param[in] aObserver The observer will receive location updates. + * + * @return A pointer to a new instance of the CLbsLocator interface class. The calling application becomes the + * owner of the returned object and is responsible its disposal. + * + * @leave KErrPermissionDenied When the application does not have the Location capability. + * @leave KErrNoMemory If there has been a memory allocation problem. + * @leave OtherStatusCode When if some other issue prevents the observer being added + * + * @capability Location + * + * @see NewL() + * @see SetLocatorProfile() + * @see StartUpdatesL() + * @see StopUpdates() + * @see AddLocationObserverL() + * @see RemoveLocationObserver() + */ +EXPORT_C CLbsLocator* CLbsLocator::NewL(MLbsLocationObserver& aObserver) + { + CLbsLocator* newClass = new (ELeave) CLbsLocator(); + CleanupStack::PushL(newClass); + newClass->ConstructL(&aObserver); + CleanupStack::Pop(newClass); + return newClass; + } + + +/** + * Creates a new instance of the CLbsLocator interface class. + * + * After the instance of the interface has been created using this method, the application should select + * the desired profile using SetLocatorProfile() and add one or more observers. + * To begin receiving location and/or movement information, the application must call StartUpdatesL(). + * The frequency and accuracy of these updates depend on the profile selected. + * + * Observers can be added by the methods AddLocationObserverL() or AddMovementObserverL(). + * + * Note: No platform capabilities are required to create an instance of the interface using this NewL() + * overload. However, the application must have the Location capability if it intends to received location + * updates. Platform security capabilities are checked when AddLocationObserverL() is called. + * No capabilities are required to receive movement events using AddMovementObserverL(). + * + * @return A pointer to a new instance of the CLbsLocator interface class. The calling application becomes the + * owner of the returned class and is responsible its disposal. + * + * @see NewL(MLbsLocationObserver& aObserver) + * @see SetLocatorProfile() + * @see AddLocationObserverL() + * @see AddMovementObserverL() + * @see StartUpdatesL() + * @see StopUpdates() + */ +EXPORT_C CLbsLocator* CLbsLocator::NewL() + { + CLbsLocator* newClass = new (ELeave) CLbsLocator(); + CleanupStack::PushL(newClass); + newClass->ConstructL(NULL); + CleanupStack::Pop(newClass); + return newClass; + } + + +//============================================================================= +// CLbsLocator - Set / Get Profile +//============================================================================= + +/** + * Specify the active profile to use for location and status updates. + * + * The profile should initially be selected before StartUpdatesL() is called but can be + * changed at any time. Selecting a profile automatically affects subsequent updates. + * There is no need to request that updates are stopped and/or re-started. + * + * If no profile is selected by an application the "Default" profile is used (KLbsProfileIdDefault). + * + * Available Profiles are: + * - KLbsProfileIdDefault + * - KLbsProfileIdAreaMonitor + * - KLbsProfileIdLazyTracker + * + * The "Default" profile (KLbsProfileIdDefault) allows existing S60 location based applications + * to easily move to the CLbsLocator API. + * - The target accuracy of this profile is 20 meters or better. + * - Applications will initially receive a cached location if available. + * - The minimum time between location updates is 1 second. + * - No movement information is supported. + * + * The "Area Monitor" profile (KLbsProfileIdAreaMonitor) is designed to allow applications + * to discover the town or which part of a city the device is currently situated. + * The profile is designed to be power efficient and is suitable for long running applications + * that only need to know when their approximate location changes. + * - The target accuracy of this profile is 3km. + * - Applications will initially receive a cached location if available. + * - Location updates are generated when the device moves between 100m and 3km. + * - Stationary and Movement detection are supported. + * - Movement updates indicate the device has moved more than 100m (but more typically 3km). + * + * The "Lazy Tracker" profile (KLbsProfileIdLazyTracker) enables applications to record + * the movements of the device over an extended period of time. A key goal of this + * profile is to be more power efficient than the default profile. This profile will + * attempt to save power by various techniques including switching GPS off if the device + * has been stationary for an extended period. It will also attempt to use other + * positioning technologies such as WLAN (if available) when it is not possible to + * obtain a satellite based location. + * The profile is not normally suited to turn-by-turn navigation. + * - The target accuracy of this profile is 20m or better. + * - Applications will initially receive a cached location if available. + * - Location updates are generated when the device moves 30 meters or more. + * - Stationary, Movement and Walking detection are supported. + * + * For all profiles, if position of the target accuracy cannot be obtained within the time out period, + * the location observer will receive an error notification of KErrTimedOut. See SetLocatorOption(). + * + * @param[in] aProfileId The UID of the profiles will receive location and status updates. + * @return KErrNone When the specified profile was successfully selected. + * @return KErrArgument When parameter aProfileId contains an invalid profile ID. + * @return KErrNotSupported When parameter aProfileId contains a profile that is not currently available. + * @see StartUpdatesL() + * @see StopUpdates() + * @see LocatorProfile() + * @see SetLocatorOption() + */ +EXPORT_C TInt CLbsLocator::SetLocatorProfile(TUid /*aProfileId*/) + { + return KErrNotSupported; + } + +/** + * Return the ID of the profile in use. + * + * If the application has not selected a profile, the "Default" profile is used. + * In this situation LocatorProfile() will return KLbsProfileIdDefault. + * @return The UID of the profile currently in use. + * @see SetLocatorProfile() + */ +EXPORT_C TUid CLbsLocator::LocatorProfile() const + { + return KLbsProfileIdDefault; + } + +//============================================================================= +// CLbsLocator - Start, Stop and Force Updates +//============================================================================= + +/** + * Requests the location related updates are sent to the observers. + * + * After the instance of the interface has been created, the application should select + * the desired profile using SetLocatorProfile() and ensure there is at least one observer. + * To begin receiving location information, the application must call StartUpdatesL(). + * + * After calling StartUpdatesL(), the observers will receive a cached location and current + * movement status if available. The frequency and accuracy of subsequent updates depend on + * the active profile. See SetLocatorProfile() for more information. + * + * The StopUpdates() method should be used when an application no longer wishes to receive + * any new location, movement or status updates. + * + * Calling StartUpdatesL() when there are no specified observers will not result in an error but + * will consume system resources and may drain additional battery power. + * + * NewL() + * @see SetLocatorProfile() + * @see StopUpdates() + * @see AddLocationObserverL() + * @see RemoveLocationObserver() + */ +EXPORT_C void CLbsLocator::StartUpdatesL() + { + } + +/** + * Requests that all location and status updates are stopped. + * + * The StopUpdates() method is used when an application no longer wishes to receive + * new location, movement or status updates. It can be used to temporarily or permanently + * halt updates. It is recommended (but not obligatory) to call StopUpdates() before the + * destructor is called. + * + * It is legal and often convenient to call StopUdatesL() during an update callback. + * For example, within the application's HandleLocationUpdate() method. This pattern + * can be used when the application only wants to find the current location and has received an + * update of satisfactory accuracy. + * + * When there are multiple observers and the application calls StopUpdates() from within an + * observer's callback, the current update will continue to be delivered to any remaining + * observers. That is, StopUpdates() prevents subsequent (i.e. new) updates being generated. + * + * To re-start updates the StartUpdatesL() method must be used. That re-activates the + * profile from the beginning. In particular, a cached position will initially be sent to the + * application. + * + * @see StartUpdatesL() + * @see RemoveLocationObserver() + * @see ~CLbsLocator() + */ +EXPORT_C void CLbsLocator::StopUpdates() + { + } + +//============================================================================= +// CLbsLocator - Set and Get Options +//============================================================================= + +/** + * Modifies the behaviour of the currently active profile. + * + * + * When an application changes the active profile using SetLocatorProfile()any previously modified + * option is lost. Applications must re-specify its desired options each time it changes profiles. + * + * Changing a profile option has effect immediately. + * + * Parameter aOption can be one of the following + * - ELocatorStatusTimer + * - Parameter aValue is the timer period in seconds.\n\n + * - The status timer indicates how long the subsystem should wait before informing the application + * that it has not been able to obtain a position of the target accuracy for the current profile. + * The method MLbsLocationObserver::HandleLocationStatus() is called after that period.\n\n + * Note: The status timer does NOT indicate how long the subsystem should try and get accurate + * positions. It only controls when the application is informed about the accuracy or position loss.\n\n + * The location subsystem will continue to try and obtain accurate positions until the + * application calls StopUpdates().\n\n + * - A value of -1 is the default and indicates that profile specific logic should be used.\n\n + * - A value of 0 can be used by the application when it wants to know if a cached + * position for the current location is NOT available.\n\n + * When a cached position is available, it is always the first location sent to the application + * after it calls StartUpdatesL(). When there is no cache position available the subsystem + * will (normally) start to calculate a new position start away.\n\n + * Setting the Status Timer to 0 gives the application an opportunity to prevent a new position + * being calculated when there is no cached position. In this situation, the status message + * KPositionNotAvailable is sent to the application after it calls StartUpdatesL(). + * If the application does not want a new location to be calculated it should call StopUpdates() + * during the status callback. If updates are not stopped at this stage then a new position + * will be calculated.\n\n + * After the cached position or the initial status message has been sent to the application, + * the default value of the status timer is then used.\n\n + * Note: Although this mechanism allows an application to query the cached position it is not + * intended for "listening" for location updates. Applications should use one of the + * alternative intefaces if this is required. + * + * For more information on target accuracies and supported options for each profile see SetLocatorProfile(). + * + * @param[in] aOption The profile option to be modified from TLbsLocatorOption. + * @param[in] aValue The new value of option. + * @return KErrNone When the specified option and value were accepted. + * @return KErrNotSupported When parameter aOption is not supported by the current profile. + * @return KErrArgument When the parameter aValue is not with the allowed range for aOption. + * + * + * @see TLbsLocatorOption + * @see MLbsLocationObserver::HandleLocationStatus() + * @see SetLocatorProfile() + * @see GetLocatorOption() + */ +EXPORT_C TInt CLbsLocator::SetLocatorOption(TLbsLocatorOption /*aOption*/, TInt /*aValue*/) + { + return KErrNotSupported; + } + + +/** + * Retrieves the value for of an Option of the currently active profile. + * + * @param[in] aOption The profile option to be modified from TLbsLocatorOption. + * @param[out] aValue The current value of option. + * @return KErrNone When the specified current value was successfully retrieved. + * @return KErrNotSupported When parameter aOption is not supported by the current profile. + * @see TLbsLocatorOption + * @see SetLocatorOption + * @see SetLocatorProfile() + */ +EXPORT_C TInt CLbsLocator::GetLocatorOption(TLbsLocatorOption /*aOption*/, TInt& /*aValue*/) const + { + return KErrNotSupported; + } + +//============================================================================= +// CLbsLocator - Add and Remove Location Observers +//============================================================================= + + +/** + * Adds a Location Observer. + * + * The specified observer will start to receive location updates when they are next generated. + * It is possible to have multiple location observers. + * + * Location observers can be specified using AddLocationObserverL() or (optionally) when + * the interface class is created via the NewL(MLbsLocationObserver& aObserver) overload. + * To begin receiving updates the application must first call StartUpdatesL(). + * + * Observers can be added before or after StartUpdatesL() is called. If an observer is after + * updates have been started it will automatically receive the next location update. + * + * Attempting to add an observer that is already present has no effect. That is, duplicate + * observers are not added but the method does not leave. + * + * Location observers can be removed using RemoveLocationObserver(). + * + * In order to add a location observer, the application must have the Location capability. + * Otherwise, this method will Leave with the error KErrPermissionDenied. + * + * The observer will not be added if the method leaves. + * + * @param[in] aObserver The observer to be added. + * + * @leave KErrPermissionDenied When the application does not have the Location capability. + * @leave KErrNoMemory If there has been a memory allocation problem. + * @leave OtherStatusCode When if some other issue prevents the observer being added + * @capability Location + * + * @see StartUpdatesL() + * @see NewL(MLbsLocationObserver& aObserver) + * @see RemoveLocationObserver() + */ +EXPORT_C void CLbsLocator::AddLocationObserverL(MLbsLocationObserver& /*aObserver*/) + { + User::Leave(KErrNoMemory); + User::Leave(KErrPermissionDenied); + } + +/** + * Removes a Location Observer. The specified observer will no longer receive location updates. + * + * It is possible to remove any of the current observers - including that supplied via + * NewL(MLbsLocationObserver& aObserver) overload. + * + * Removing all observes without calling StopUpdates() may continue to consume resources + * and is not recommended. + * + * Observers may be removed whilst the application is currently processing an update. + * For example, from within one observer's MLbsLocationObserver::HandleLocationUpdate() method. + * In this situation, the removed observer will not receive the current update (if it has + * has still to be delivered to it). + * + * @param[in] aObserver The observer to be removed. + * @return KErrNone When the specified observer has been removed. + * @return KErrNotFound When aObserver could not be found in the current list of location observers + * + * @see NewL(MLbsLocationObserver& aObserver) + * @see AddLocationObserverL() + * @see StopUpdates() + */ +EXPORT_C TInt CLbsLocator::RemoveLocationObserver(MLbsLocationObserver& /*aObserver*/) + { + return KErrNotSupported; + } + + +//============================================================================= +// CLbsLocator - Add and Remove Movement Observers +//============================================================================= + + +/** + * Adds a Movement Observer. + * + * The specified observer will start to receive movement event updates when they are next + * generated. It is possible to have multiple movement observers and no location observers. + * + * To begin receiving updates the application must first call StartUpdatesL(). + * + * Observers can be added before or after StartUpdatesL() is called. If an observer is after + * updates have been started it will automatically receive the next movement update. + * + * The range of movement detection supported and the power consumed is dependent on + * the profile being used. See SetLocatorProfile() for more information. + * + * Attempting to add an observer that is already present has no effect. That is, duplicate + * observers are not added but the method does not leave. + * + * Movement observers can be removed using RemoveMovementObserver(). + * + * Note: No security capabilities are required to add a movement observer or receive movement events. + * + * The observer will not be added if the method leaves. + * + * @param[in] aObserver The observer to be added. + * + * @leave KErrNoMemory If there has been a memory allocation problem. + * @leave OtherStatusCode When if some other issue prevents the observer being added + * + * @param[in] aObserver The observer to be added. + * @see SetLocatorProfile() + * @see StartUpdatesL() + * @see NewL() + * @see RemoveMovementObserver() + */ +EXPORT_C void CLbsLocator::AddMovementObserverL(MLbsMovementObserver& /*aObserver*/) + { + } + +/** + * Removes a Movement Observer. The specified observer will no longer receive Movement updates. + * + * Removing all observes without calling StopUpdates() may continue to consume resources + * and is not recommended. + * + * Observers may be removed whilst the application is currently processing an update. + * For example, from within one observer's MLbsMovementObserver::HandleMovementUpdate() method. + * In this situation, the removed observer will not receive the current update (if it has + * has still to be delivered to it). + * + * @param[in] aObserver The observer to be removed. + * @return KErrNone When the specified observer has been removed. + * @return KErrNotFound When aObserver could not be found in the current list of Movement observers + * @see AddMovementObserverL() + * @see StopUpdates() + */ +EXPORT_C TInt CLbsLocator::RemoveMovementObserver(MLbsMovementObserver& /*aObserver*/) + { + return KErrNotSupported; + } diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/src/lbslocatorclasstypes.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/src/lbslocatorclasstypes.cpp Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,51 @@ +// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + +/** +@file +@internalTechnology +@prototype +*/ + +#include + +//============================================================================= +// Constructor +//============================================================================= + +EXPORT_C TLbsLocatorClassTypeBase::TLbsLocatorClassTypeBase() + { + iClassSize = sizeof(TLbsLocatorClassTypeBase); + iClassType = ELbsLocatorBaseClassType; + } + +/** + * Retrives a bit mask containing the type of the locator generated class. + * @return A bit mask containing the type of the TLbsLocatorClassTypeBase-derived class + */ +EXPORT_C TUint32 TLbsLocatorClassTypeBase::LocatorClassType() const + { + return iClassType; + } + +/** + * Retrieves the size of the locator based class. + * @return The size of the TPositionClassTypeBase-derived class + */ +EXPORT_C TUint TLbsLocatorClassTypeBase::LocatorClassSize() const + { + return iClassSize; + } diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/src/lbsmovementevent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/src/lbsmovementevent.cpp Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,99 @@ +// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** +@file +@internalTechnology +@prototype +*/ + +#include + +//============================================================================= +// Constructor +//============================================================================= + +EXPORT_C TLbsMovementEvent::TLbsMovementEvent() + { + iClassSize = sizeof(TLbsMovementEvent); + iClassType |= ELbsMovementEventClassType; + + iEvent = EMovementEventUnknown; + +#pragma message ("***Need to initiase timestamp***") + //iSystemTimeStamp = ... + } + + + +//============================================================================= +// Movement Events +//============================================================================= + +/** + * Retrieves a bit mask of detected movement events. + * + * @return EMovementEventUnknown When no event as been assigned. + * + * see TLbsMovementEventType + */ +EXPORT_C TLbsMovementEvent::TLbsMovementEventType TLbsMovementEvent::MovementEvent() const + { + return iEvent; + } + +/** + * Sets a bit mask of detected movement events. + * + * @param[in] aEvent A bit mask of detected movement events. + * + * @see TLbsMovementEventType + * @see MovementEvent() + */ +EXPORT_C void TLbsMovementEvent::SetMovementEvent(TLbsMovementEventType aEvent) + { + iEvent = aEvent; + } + + +//============================================================================= +// Timestamp +//============================================================================= + +/** + * Retrieves the system time when the movement event was generated. + * + * If the time stamp has not been assigned, a TTime of "zero" will be returned. + * @return The time when the movement event was detected. + */ +EXPORT_C TTime TLbsMovementEvent::SystemTimeStamp() const + { + return iSystemTimeStamp; + } + +/** + * Sets the system time when the movement event was detected. + * + * @param[in] aTimeStamp The system time when the movement event was detected. The value cannot be zero. + * + * @return KErrNone If the time stamp has been set. + * @return KErrArgument If the parameter is invalid. For example, a time stamp of zero was supplied. + * @see SystemTimeStamp() + */ +EXPORT_C TInt TLbsMovementEvent::SetSystemTimeStamp(TTime aTimeStamp) + { + iSystemTimeStamp = aTimeStamp; + return KErrNone; + } diff -r 8737440d6ade -r a06e4186b3d5 locationmgmt/locationcore/LbsClient/lbslocator/src/lbsmovementobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsClient/lbslocator/src/lbsmovementobserver.cpp Fri Apr 30 12:33:30 2010 +0100 @@ -0,0 +1,92 @@ +// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + +/** +@file +@internalTechnology +@prototype +*/ + +#include "lbsmovementobserver.h" + +//============================================================================= +// MLbsLocationLocationObserver +//============================================================================= + + +/** + * Informs the application of movement events. + * + * To begin receiving updates the application must call CLbsLocator::StartUpdatesL(). + * + * After calling StartUpdatesL(), the first update an application will receive is the current + * movement status if known. The application will then receive movement events but the + * frequency and information available depends on the active profile. See + * CLbsLocator::SetLocatorProfile() for more information. + * + * When an application no longer wishes to receive updates it should call CLbsLocator::StopUpdates(). + * It is legal, valid and usual to stop updates from within the HandleMovementUpdate() callback. + * + * @param[in] aEvent The current movement indicator. + * + * @see TLbsMovementEvent + * @see HandleMovementStatus + * @see CLbsLocator::SetLocatorProfile() + * @see CLbsLocator::StartUpdatesL() + * @see CLbsLocator::StopUpdates() + */ +void MLbsMovementObserver::HandleMovementUpdate(const TLbsMovementEvent& /*aEvent*/) + { + } + +/** + * Applications must implement this method to receive movement status updates. + * + * To begin receiving status updates the application must call CLbsLocator::StartUpdatesL(). + * + * + * When HandleMovementStatus() is called with a negative status code, this indicates there has been an + * error inside the location subsystem or with the connected hardware. These situations are generally + * not recoverable and the application would normally stop using the interface. + * + * When an application no longer wishes to receive updates it should call CLbsLocator::StopUpdates(). + * It is possible to call this method from within the HandleLocationStatus() callback. + * + * + * @param[in] aStatus A negative value represents a Symbian OS system wide error. This will normally prevent any + * movement information from being returned. KErrNone is returned when normal service has been restored. + * + * @see HandleMovementUpdate + * @see CLbsLocator::StartUpdatesL() + * @see CLbsLocator::StopUpdates() + */ +void MLbsMovementObserver::HandleMovementStatus(TInt /*aStatus*/) + { + } + + +/** + * This method should not be overridden by the application. + * + * It is queried by the location subsystem to determine the version of the observer interface used + * by the application. + * + */ +TVersion MLbsMovementObserver::Version() const + { + return TVersion(0,0,1); + } +