LOCATIONS_METHOD_HYBRID, /**< This method selects the best method available at the moment */
LOCATIONS_METHOD_GPS, /**< This method uses Global Positioning System */
LOCATIONS_METHOD_WPS, /**< This method uses WiFi Positioning System */
+ LOCATIONS_METHOD_PASSIVE, /**< This method can be used to passively receive location updates without power consumption (Since 3.0)*/
} location_method_e;
/**
* @param[in] user_data The user data to be passed to the callback function
* @retval #LOCATIONS_ERROR_NONE Successful
* @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
* @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
* @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
* @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
#include "locations.h"
#include "location_internal.h"
-static location_setting_changed_s g_location_setting[LOCATIONS_METHOD_WPS + 1];
+static location_setting_changed_s g_location_setting[LOCATIONS_METHOD_PASSIVE + 1];
static location_method_e __convert_location_method_e(LocationMethod method)
{
case LOCATIONS_METHOD_WPS:
_method = LOCATION_METHOD_WPS;
break;
+ case LOCATIONS_METHOD_PASSIVE:
+ _method = LOCATION_METHOD_PASSIVE;
+ break;
case LOCATIONS_METHOD_NONE:
default:
_method = LOCATION_METHOD_NONE;
LOCATIONS_LOGE("LOCATIONS_ERROR_NOT_SUPPORTED(0x%08x) : fail to location feature", LOCATIONS_ERROR_NOT_SUPPORTED);
return LOCATIONS_ERROR_NOT_SUPPORTED;
}
+ } else if (method == LOCATIONS_METHOD_PASSIVE) {
+ if (__is_location_supported() == LOCATIONS_ERROR_NOT_SUPPORTED) {
+ LOCATIONS_LOGE("LOCATIONS_ERROR_NOT_SUPPORTED(0x%08x) : fail to location feature", LOCATIONS_ERROR_NOT_SUPPORTED);
+ return LOCATIONS_ERROR_NOT_SUPPORTED;
+ }
}
LocationMethod _method = __convert_LocationMethod(method);
if (!handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED])
handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED] = g_signal_connect(handle->object, "service-updated", G_CALLBACK(__cb_service_updated), handle);
- if (handle->method >= LOCATIONS_METHOD_HYBRID && handle->method <= LOCATIONS_METHOD_WPS) {
+ if (handle->method >= LOCATIONS_METHOD_HYBRID && handle->method <= LOCATIONS_METHOD_PASSIVE) {
if (!handle->sig_id[_LOCATION_SIGNAL_ZONE_IN])
handle->sig_id[_LOCATION_SIGNAL_ZONE_IN] = g_signal_connect(handle->object, "zone-in", G_CALLBACK(__cb_zone_in), handle);
return ret;
ret = location_request_single_location(handle->object, timeout);
- if (ret != LOCATION_ERROR_NONE)
+ if (ret != LOCATION_ERROR_NONE) {
+ if (ret == LOCATION_ERROR_NOT_SUPPORTED) {
+ LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD : method - %d", handle->method);
+ return LOCATIONS_ERROR_INCORRECT_METHOD;
+ }
return __convert_error_code(ret);
+ }
return LOCATIONS_ERROR_NONE;
}
handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED] = 0;
}
- if (handle->method >= LOCATIONS_METHOD_HYBRID && handle->method <= LOCATIONS_METHOD_WPS) {
+ if (handle->method >= LOCATIONS_METHOD_HYBRID && handle->method <= LOCATIONS_METHOD_PASSIVE) {
if (handle->sig_id[_LOCATION_SIGNAL_ZONE_IN]) {
g_signal_handler_disconnect(handle->object, handle->sig_id[_LOCATION_SIGNAL_ZONE_IN]);
handle->sig_id[_LOCATION_SIGNAL_ZONE_IN] = 0;
case LOCATION_METHOD_WPS:
*method = LOCATIONS_METHOD_WPS;
break;
+ case LOCATION_METHOD_PASSIVE:
+ *method = LOCATIONS_METHOD_PASSIVE;
+ break;
default: {
LOCATIONS_LOGE("[LOCATIONS_ERROR_INVALID_PARAMETER] method : %d ", method);
return LOCATIONS_ERROR_INVALID_PARAMETER;