diff options
Diffstat (limited to 'src/FLoc_LocationProviderImpl.h')
-rw-r--r-- | src/FLoc_LocationProviderImpl.h | 106 |
1 files changed, 92 insertions, 14 deletions
diff --git a/src/FLoc_LocationProviderImpl.h b/src/FLoc_LocationProviderImpl.h index 3b78e53..cc23a48 100644 --- a/src/FLoc_LocationProviderImpl.h +++ b/src/FLoc_LocationProviderImpl.h @@ -28,9 +28,12 @@ #include <unique_ptr.h> #include <FAppIActiveAppEventListener.h> #include <FBaseColAllElementsDeleter.h> -#include <FBaseRtTimer.h> #include <FBaseRtIEventListener.h> +#include <FBaseRtITimerEventListener.h> +#include <FBaseRtTimer.h> #include <FLocLocationCriteria.h> +#include <FSysAlarm.h> +#include <FSysIAlarmEventListener.h> #include <FBaseRt_Event.h> #include "FLoc_ILocationManagerListener.h" #include "FLoc_ILocProviderEventListener.h" @@ -56,6 +59,8 @@ class _LocationProviderImpl , public Tizen::Locations::_ILocationManagerListener , public Tizen::Locations::_ILocProviderEventListener , public Tizen::App::IActiveAppEventListener + , public Tizen::Base::Runtime::ITimerEventListener + , public Tizen::System::IAlarmEventListener { public: /** @@ -175,6 +180,16 @@ private: */ virtual void OnActiveAppChanged(const Tizen::App::AppId& appId); + /** + * @see @ref Tizen::System::IAlarmEventListener::OnAlarmExpired() + */ + virtual void OnAlarmExpired(Tizen::System::Alarm& alarm); + + /** + * @see @ref Tizen::Base::Runtime::ITimerEventListener::OnTimerExpired() + */ + virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer); + // This method requests the location update to the Location Manager. // // @since 2.0 @@ -226,29 +241,92 @@ private: // void NotifyServiceStatus(_LocProviderEventType eventType, LocationServiceStatus svcStatus); - // This method is returns the bool value depicting the privilege details depending on the location settings. + // This method returns the bool value depicting the privilege details depending on the location settings. // // @since 2.0 // static bool GetUserPrivilege(void); + // This method starts the location updates and the timer for region monitoring. + // + // @since 2.0 + // + result ActivateRegionMonitoring(void); + + // This method stops the location updates and cancels the timer and alarm set for the area monitoring. + // + // @since 2.0 + // + void StopRegionMonitoring(void); + + // This method determines the time for the alarm to be set for next cycle of region monitoring. + // + // @since 2.0 + // + void SetNextRegionMonitoringTime(void); + private: - bool __firstLocationUpdate; - bool __regionMonitoringActive; - bool __awakeEnabled; - int __updateInterval; - LocationUpdateType __locationUpdateType; - LocationServiceStatus __locationUpdateStatus; - LocationServiceStatus __regionMonitorStatus; + class _LocationUpdater + { + public: + _LocationUpdater(void) + : firstLocationUpdate(true) + , awakeEnabled(false) + , updateInterval(0) + , status(LOC_SVC_STATUS_IDLE) + , type(_LOCATION_UPDATE_TYPE_NONE) + , reqId(-1) + , distanceThreshold(0.0) + , pLocation(null) + { + } + + ~_LocationUpdater(void) + { + } + + public: + bool firstLocationUpdate; + bool awakeEnabled; + int updateInterval; + LocationServiceStatus status; + LocationUpdateType type; + RequestId reqId; + double distanceThreshold; + std::unique_ptr<Tizen::Locations::Location> pLocation; + }__locationUpdater; + + class _RegionMonitor + { + public: + _RegionMonitor(void) + : reqId(-1) + , status(LOC_SVC_STATUS_IDLE) + , pTimer(null) + , pAlarm(null) + , pLocation(null) + , pRegionList(null) + { + } + + ~_RegionMonitor(void) + { + } + + public: + RequestId reqId; + LocationServiceStatus status; + std::unique_ptr<Tizen::Base::Runtime::Timer> pTimer; + std::unique_ptr<Tizen::System::Alarm> pAlarm; + std::unique_ptr<Tizen::Locations::Location> pLocation; + std::unique_ptr< Tizen::Base::Collection::ArrayList, Tizen::Base::Collection::AllElementsDeleter > pRegionList; + }__regionMonitor; + LocationAccuracy __lastLocationAccuracy; - RequestId __reqId; - RequestId __regionReqId; - double __distanceThreshold; LocationCriteria __criteria; ILocationProviderListener* __pLocationListener; _LocationManager* __pLocationManager; - std::unique_ptr< Tizen::Locations::Location > __pLastLocation; - std::unique_ptr< Tizen::Base::Collection::ArrayList, Tizen::Base::Collection::AllElementsDeleter > __pRegionList; + }; // _LocationProviderImpl }} // Tizen::Locations |