2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FLocILocationProviderListener.h
20 * @brief This is the header file for the %ILocationProviderListener interface.
22 * This header file contains the declarations of the %ILocationProviderListener interface.
25 #ifndef _FLOC_ILOCATION_PROVIDER_LISTENER_H_
26 #define _FLOC_ILOCATION_PROVIDER_LISTENER_H_
28 #include <FBaseRtIEventListener.h>
29 #include <FLocTypes.h>
31 namespace Tizen { namespace Locations
37 * @interface ILocationProviderListener
38 * @brief This interface defines listener interfaces to get asynchronous notifications from the location provider.
42 * The %ILocationProviderListener interface defines listener interfaces to get asynchronous notifications from the location provider.
43 * An application should implement this listener interface and construct the location provider with the listener
44 * to get the asynchronous notifications for the location updates and region monitoring requests.
46 * @see LocationProvider
48 class _OSP_EXPORT_ ILocationProviderListener
49 : virtual public Tizen::Base::Runtime::IEventListener
53 * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called
54 * when the destructor of this interface is called.
58 virtual ~ILocationProviderListener(void) {}
61 * Called when the location update is running.
63 * The location update is started when an application calls the LocationProvider::StartLocationUpdatesByInterval() or LocationProvider::StartLocationUpdatesByDistance() methods.
65 * Note that, the updated locations may not always fall into the requested accuracy level that the application has specified in the criteria.
66 * The application is able to filter out less accurate locations by checking the location accuracy with the Location::GetHorizontalAccuracy() method
67 * if it matters to the application.
69 * During updating locations, along with changes in the location's accuracy, changes in the service status are also notified.
73 * @param[in] location The location to update
74 * @remarks An application should implement this method when it requests for the location updates and wants to handle the updated locations.
75 * @see OnAccuracyChanged()
76 * @see OnLocationUpdateStatusChanged()
78 virtual void OnLocationUpdated(const Tizen::Locations::Location& location) { }
81 * Called when the location provider detects a movement entering into the registered region.
83 * A region is registered for monitoring by calling LocationProvider::AddMonitoringRegion() and is identified by the region ID.
85 * While monitoring regions, the changes in the location's accuracy and the changes in the service status are notified.
89 * @param[in] regionId The ID for the registered region
90 * @remarks An application should implement this method when it requests for the region monitoring and wants to handle the movement into the region.
91 * @see OnAccuracyChanged()
92 * @see OnRegionMonitoringStatusChanged()
94 virtual void OnRegionEntered(Tizen::Locations::RegionId regionId) { }
97 * Called when the location provider detects a movement leaving from the registered region.
99 * A region is registered for monitoring by calling LocationProvider::AddMonitoringRegion() and identified by the region ID.
101 * While monitoring regions, the changes in the location's accuracy and the changes in the service status are notified.
105 * @param[in] regionId The ID for the registered region
106 * @remarks An application should implement this method when it requests the region monitoring and wants to handle the movement out of the region.
107 * @see OnAccuracyChanged()
108 * @see OnRegionMonitoringStatusChanged()
110 virtual void OnRegionLeft(Tizen::Locations::RegionId regionId) { }
113 * Called when the service status of the location updates change.
115 * The status changes to @c LOC_SVC_STATUS_RUNNING, when the location provider successfully runs the requested service.
117 * The status changes to @c LOC_SVC_STATUS_NOT_FIXED, when the location provider is not able to run the requested service because it
118 * cannot fix the current location due to poor circumstances such as weak radio for positioning.
119 * When this status continues for a fairly long time, it is recommended to cancel the request. The request should be run after some time in order to avoid excessive battery consumption.
121 * When the user withdraws the permission for an application to use the location information, the status changes to
122 * @c LOC_SVC_STATUS_DENIED and the location provider stops all ongoing services to the application.
123 * In that case, the application might ask the user to grant permission to continue the aborted service
124 * or to finalize all resources for the location provider.
126 * The status @c LOC_SVC_STATUS_PAUSED is displayed when the location provider pauses the ongoing service. This happens when the application requests for the location updates without keeping the location updates awake. The status will be changed to others
127 * once the location provider resumes the paused service.
129 * Note that, the application can get notifications about the location updates and accuracy changes
130 * only when the service status is @c LOC_SVC_STATUS_RUNNING.
134 * @param[in] status The service status of the location updates
135 * @remarks An application should implement this method when it requests for the location updates and wants to handle status changes of the service.
137 virtual void OnLocationUpdateStatusChanged(Tizen::Locations::LocationServiceStatus status) { }
141 * Called when the service status of the region monitoring changes.
143 * The status changes to @c LOC_SVC_STATUS_RUNNING, when the location provider successfully runs the requested service.
145 * The status changes to @c LOC_SVC_STATUS_NOT_FIXED, when the location provider is not able to run the requested service because it
146 * cannot fix the location that is suitable for monitoring the regions.
148 * When the user withdraws the permission for an application to use the location information, the status changes to
149 * @c LOC_SVC_STATUS_DENIED and the location provider stops all ongoing services to the application.
150 * In that case, the application might ask the user to grant permission to continue the aborted service
151 * or to finalize all resources for the location provider.
153 * Note that, the application can get notifications about the movement around regions and accuracy changes
154 * only when the service status is @c LOC_SVC_STATUS_RUNNING.
158 * @param[in] status The service status of the region monitoring
159 * @remarks An application should implement this method when it requests for the region monitoring and wants to handle status changes of the service.
161 virtual void OnRegionMonitoringStatusChanged(Tizen::Locations::LocationServiceStatus status) { }
165 * Called when the accuracy level of the location changes.
167 * The location provider tries to provide accurate location services as specified in the criteria,
168 * but the location provided by location provider may not always fall into the requested accuracy level.
169 * The %OnAccuracyChanged() listener method is called whenever the current accuracy of the location provided by location provider is changed.
171 * The accuracy changes to @c LOC_ACCURACY_INVALID when the location provider is not running any services in @c LOC_SVC_STATUS_RUNNING
176 * @param[in] accuracy The accuracy of the location
178 virtual void OnAccuracyChanged(Tizen::Locations::LocationAccuracy accuracy) = 0;
182 //This method is for internal use only. Using this method can cause behavioral, security-related,
183 //and consistency-related issues in the application.
185 virtual void ILocationProviderListener_Reserved1(void) { }
188 //This method is for internal use only. Using this method can cause behavioral, security-related,
189 //and consistency-related issues in the application.
191 virtual void ILocationProviderListener_Reserved2(void) { }
194 //This method is for internal use only. Using this method can cause behavioral, security-related,
195 //and consistency-related issues in the application.
197 virtual void ILocationProviderListener_Reserved3(void) { }
198 }; // ILocationProviderListener
199 }} // Tizen::Locations
200 #endif // _FLOC_ILOCATION_PROVIDER_LISTENER_H_