int __is_gps_satellite_supported(void);
int __is_wps_supported(void);
int __is_batch_supported(void);
+int __is_fused_supported(void);
int __is_location_supported(void);
int __set_callback(_location_event_e type, location_manager_h manager, void *callback, void *user_data);
int __unset_callback(_location_event_e type, location_manager_h manager);
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)*/
+ LOCATIONS_METHOD_FUSED, /**< This method uses Fused location (Since 4.0) */
} location_method_e;
LOCATIONS_ACCESS_STATE_ALLOWED, /**< Access authorized */
} location_accessibility_state_e;
+/**
+ * @brief Enumeration for the fused location service.
+ * @since_tizen 4.0
+ */
+typedef enum {
+ LOCATIONS_FUSED_HIGH_ACCURACY = 0, /**< High accuracy */
+ LOCATIONS_FUSED_BALANCED_POWER, /**< Balanced power */
+} location_fused_mode_e;
/**
* @brief The location manager handle.
*/
int location_manager_clear_mock_location(location_manager_h manager);
+/**
+ * @brief Changes behavior of the location source selection in the fused location method.
+ * @since_tizen 4.0
+ * @param[in] manager The location manager handle
+ * @param[in] mode The fused mode.
+ * @return @c 0 on success, otherwise a negative error value
+ * @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 The service is not available
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @see location_manager_create()
+ */
+int location_manager_set_fused_mode(location_manager_h manager, location_fused_mode_e mode);
+
/**
* @}
Name: capi-location-manager
Summary: A Location Manager library in Tizen Native API
-Version: 0.7.11
+Version: 0.8.0
Release: 1
Group: Location/API
License: Apache-2.0
return LOCATIONS_ERROR_NONE; //LCOV_EXCL_LINE
}
+int __is_fused_supported(void)
+{
+ bool is_supported = false;
+ int retval = 0;
+
+ retval = system_info_get_platform_bool("http://tizen.org/feature/location.fused", &is_supported);
+ if (retval != SYSTEM_INFO_ERROR_NONE)
+ LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval);
+
+ if (is_supported == false)
+ return LOCATIONS_ERROR_NOT_SUPPORTED;
+
+ return LOCATIONS_ERROR_NONE; //LCOV_EXCL_LINE
+}
+
int __set_callback(_location_event_e type, location_manager_h manager, void *callback, void *user_data)
{
LOCATIONS_NULL_ARG_CHECK(manager);
#include "locations.h"
#include "location_internal.h"
-static location_setting_changed_s g_location_setting[LOCATIONS_METHOD_PASSIVE + 1];
+#define LOCATIONS_METHOD_FIRST LOCATIONS_METHOD_HYBRID
+#define LOCATIONS_METHOD_LAST LOCATIONS_METHOD_FUSED
+
+static location_setting_changed_s g_location_setting[LOCATIONS_METHOD_LAST + 1];
static location_method_e __convert_location_method_e(LocationMethod method)
{
case LOCATIONS_METHOD_PASSIVE:
_method = LOCATION_METHOD_PASSIVE;
break;
+ case LOCATIONS_METHOD_FUSED:
+ _method = LOCATION_METHOD_FUSED;
+ break;
case LOCATIONS_METHOD_NONE:
default:
_method = LOCATION_METHOD_NONE;
LOCATIONS_NOT_SUPPORTED_CHECK(__is_wps_supported());
else if (method == LOCATIONS_METHOD_PASSIVE)
LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ else if (method == LOCATIONS_METHOD_FUSED)
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_fused_supported());
LocationMethod _method = __convert_LocationMethod(method);
if (_method == LOCATION_METHOD_NONE) {
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_PASSIVE) {
+ if (handle->method >= LOCATIONS_METHOD_FIRST && handle->method <= LOCATIONS_METHOD_LAST) {
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);
handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED] = 0;
}
- if (handle->method >= LOCATIONS_METHOD_HYBRID && handle->method <= LOCATIONS_METHOD_PASSIVE) {
+ if (handle->method >= LOCATIONS_METHOD_FIRST && handle->method <= LOCATIONS_METHOD_LAST) {
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_PASSIVE:
*method = LOCATIONS_METHOD_PASSIVE;
break;
+ case LOCATION_METHOD_FUSED:
+ *method = LOCATIONS_METHOD_FUSED;
+ break;
default: {
LOCATIONS_LOGE("[LOCATIONS_ERROR_INVALID_PARAMETER] invalid method"); //LCOV_EXCL_LINE
return LOCATIONS_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
if (_method == LOCATION_METHOD_NONE) {
return __convert_error_code(LOCATION_ERROR_PARAMETER);
- } else if (_method == LOCATION_METHOD_PASSIVE) {
+ } else if (_method == LOCATION_METHOD_PASSIVE || _method == LOCATION_METHOD_FUSED) {
LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD"); //LCOV_EXCL_LINE
return LOCATIONS_ERROR_INCORRECT_METHOD; //LCOV_EXCL_LINE
}
if (_method == LOCATION_METHOD_NONE) {
return __convert_error_code(LOCATION_ERROR_PARAMETER);
- } else if (_method == LOCATION_METHOD_PASSIVE) {
+ } else if (_method == LOCATION_METHOD_PASSIVE || _method == LOCATION_METHOD_FUSED) {
LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD"); //LCOV_EXCL_LINE
return LOCATIONS_ERROR_INCORRECT_METHOD; //LCOV_EXCL_LINE
}
return __convert_error_code(ret);
}
+
+EXPORT_API int location_manager_set_fused_mode(location_manager_h manager, location_fused_mode_e mode)
+{
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_fused_supported());
+ LOCATIONS_NULL_ARG_CHECK(manager);
+ LOCATIONS_CHECK_CONDITION(mode >= LOCATIONS_FUSED_HIGH_ACCURACY && mode <= LOCATIONS_FUSED_BALANCED_POWER, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER");
+
+ location_manager_s *handle = (location_manager_s *) manager;
+ int ret = LOCATION_ERROR_NONE;
+
+ ret = location_set_fused_mode(handle->object, mode);
+ if (ret == LOCATION_ERROR_NOT_SUPPORTED) {
+ LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD");
+ return LOCATIONS_ERROR_INCORRECT_METHOD;
+ }
+
+ return __convert_error_code(ret);
+}
bool _get_location_cb(double latitude, double longitude, double altitude, double speed, double direction, double horizontal, double vertical, time_t timestamp, void *user_data)
{
- fprintf(stderr, "-------------------------- batch: get location --------------------------\n");
- fprintf(stderr, "[%ld] lat[%f] lon[%f] alt[%f] speed[%lf] direction[%lf], horizontal_accuracy[%lf]\n", timestamp, latitude, longitude, altitude, speed, direction, horizontal);
+ fprintf(stderr, "[%ld] pos[%f, %f, %f] spd[%.1f] dir[%.1f], hor[%.1f]\n", timestamp, latitude, longitude, altitude, speed, direction, horizontal);
return TRUE;
}
fprintf(stderr, "gps: %d, ", is_enabled);
location_manager_is_enabled_method(LOCATIONS_METHOD_WPS, &is_enabled);
- fprintf(stderr, "wps: %d, ", is_enabled);
+ fprintf(stderr, "wps: %d \n", is_enabled);
}
static int enable_method(location_method_e method, bool enable)
{
int ret = 0;
if (manager != NULL) {
- ret = location_manager_stop(manager);
- fprintf(stderr, "stop: %d\n", ret);
+ if (menu == 31) {
+ ret = location_manager_stop_batch(manager);
+ fprintf(stderr, "stop_batch: %d\n", ret);
+
+ ret = location_manager_unset_location_batch_cb(manager);
+ fprintf(stderr, "unset_batch_cb: %d\n", ret);
+ } else {
+ ret = location_manager_stop(manager);
+ fprintf(stderr, "stop: %d\n", ret);
+
+ ret = gps_status_unset_satellite_updated_cb(manager);
+ fprintf(stderr, "gps_status_unset_satellite_updated_cb: %d\n", ret);
+ }
ret = location_manager_unset_service_state_changed_cb(manager);
fprintf(stderr, "unset_service_state_changed_cb: %d\n", ret);
ret = location_manager_unset_position_updated_cb(manager);
fprintf(stderr, "unset_position_updated_cb: %d\n", ret);
- ret = gps_status_unset_satellite_updated_cb(manager);
- fprintf(stderr, "gps_status_unset_satellite_updated_cb: %d\n", ret);
-
ret = location_manager_destroy(manager);
fprintf(stderr, "destroy: %d\n", ret);
manager = NULL;