From: Genie Kim Date: Thu, 9 May 2013 14:16:20 +0000 (+0900) Subject: sync PRIVATE and RSA for tizen2.1 X-Git-Tag: accepted/tizen/20130520.100703^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fapi%2Flocation-manager.git;a=commitdiff_plain;h=f7a18abac1fbc210b083455b1bf83afa544ece08 sync PRIVATE and RSA for tizen2.1 Change-Id: I18b06112d034cda5091a5c72cb005d9cfc6ad5b0 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index abb007e..4f9efb7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ FOREACH(flag ${${fw_name}_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fvisibility=hidden -fPIC -Wall -Werror") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") IF("${ARCH}" STREQUAL "arm") @@ -27,6 +27,7 @@ IF("${ARCH}" STREQUAL "arm") ENDIF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +ADD_DEFINITIONS("-DEXPORT_API=__attribute__((visibility(\"default\")))") ADD_DEFINITIONS("-DTIZEN_DEBUG") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}") diff --git a/include/location_preference.h b/include/location_preference.h index a698cf2..db780a6 100644 --- a/include/location_preference.h +++ b/include/location_preference.h @@ -381,6 +381,32 @@ int location_preference_set_country_code(location_service_h service, const char* int location_preference_get_country_code(location_service_h service, char** country_code); /** + * @brief Sets the account. + * @param[in] location_service The memory pointer of location service handle. + * It must be converted into location_service_h by GET_LOCATION_SERVICE(). + * @param[in] maps_key The maps key + * @return 0 on success, otherwise a negative error value. + * @retval #LOCATION_PREFERENCE_ERROR_NONE Successful + * @retval #LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter + * @see GET_LOCATION_SERVICE() + * @see location_preference_get_maps_key() + */ +int location_preference_set_maps_key(location_service_h service, const char* maps_key); + +/** + * @brief Gets the account. + * @param[in] location_service The memory pointer of location service handle. + * It must be converted into location_service_h by GET_LOCATION_SERVICE(). + * @param[out] maps_key The maps key + * @return 0 on success, otherwise a negative error value. + * @retval #LOCATION_PREFERENCE_ERROR_NONE Successful + * @retval #LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter + * @see GET_LOCATION_SERVICE() + * @see location_preference_set_maps_key() + */ +int location_preference_get_maps_key(location_service_h service, char** maps_key); + +/** * @} */ diff --git a/include/locations.h b/include/locations.h index 4c3f9e7..581be11 100644 --- a/include/locations.h +++ b/include/locations.h @@ -341,6 +341,34 @@ int location_manager_get_method(location_manager_h manager, location_method_e *m int location_manager_get_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp); /** + * @brief Gets the current position information. + * @details + * The result is current altitude, latitude, longitude, climb, direction, speed, level, horizontal and verticalwith a measurement timestamp. + * + * If @a altitude is negative, only altitude and latitude are available (fix status is 2D). + * If @a altitude is positive, fix status is 3D and returned altitude value is the result of measurement. + * + * @param[in] manager The location manager handle + * @param[out] altitude The current altitude (meters) + * @param[out] latitude The current latitude [-90.0 ~ 90.0] (degrees) + * @param[out] longitude The current longitude [-180.0 ~ 180.0] (degrees) + * @param[out] climb The climb (km/h) + * @param[out] direction The direction, degrees from the north + * @param[out] speed The speed (km/h) + * @param[out] level The accuracy level + * @param[out] horizontal The horizontal accuracy (meters) + * @param[out] vertical The vertical accuracy (meters) + * @param[out] timestamp The timestamp (time when measurement took place or 0 if valid) + * @return 0 on success, otherwise a negative error value. + * @retval #LOCATIONS_ERROR_NONE Successful + * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument + * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available + * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled + * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start() + */ +int location_manager_get_location(location_manager_h manager, double *altitude, double *latitude, double *longitude, double *climb, double *direction, double *speed, location_accuracy_level_e *level, double *horizontal, double *vertical, time_t *timestamp); + +/** * @brief Gets the current velocity information. * @details * The result is current climb, direction, and speed, with a measurement timestamp. @@ -392,6 +420,30 @@ int location_manager_get_accuracy(location_manager_h manager, location_accuracy_ int location_manager_get_last_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp); /** + * @brief Gets the last location information. + * @details The @a altitude, @a latitude, @a longitude, @a climb, @a direction, @a speed and @c timestamp values should be 0, if there is no record of any previous position information. + * @details If @a altitude is negative, only altitude and latitude are available (fix status is 2D). + * @details If @a altitude is positive, fix status is 3D and returned altitude value is the result of measurement. + * @param[in] manager The location manager handle + * @param[out] altitude The current altitude (meters) + * @param[out] latitude The current latitude [-90.0 ~ 90.0] (degrees) + * @param[out] longitude The current longitude [-180.0 ~ 180.0] (degrees) + * @param[out] climb The climb (km/h) + * @param[out] direction The direction, degrees from the north + * @param[out] speed The speed (km/h) + * @param[out] level The accuracy level + * @param[out] horizontal The horizontal accuracy (meters) + * @param[out] vertical The vertical accuracy (meters) + * @param[out] timestamp The timestamp (time when measurement took place or 0 if valid) + * @return 0 on success, otherwise a negative error value. + * @retval #LOCATIONS_ERROR_NONE Successful + * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument + * @pre The location manager handle must be created by location_manager_create() + */ +int location_manager_get_last_location(location_manager_h manager, double *altitude, double *latitude, double *longitude, double *climb, double *direction, double *speed, location_accuracy_level_e *level, double *horizontal, double *vertical, time_t *timestamp); + + +/** * @brief Gets the last velocity information which is recorded. * @details * The @a climb, @a direction and @a speed values should be 0, if there is no record of any previous velocity information. diff --git a/packaging/capi-location-manager.spec b/packaging/capi-location-manager.spec index 5e20c79..cb35c62 100755 --- a/packaging/capi-location-manager.spec +++ b/packaging/capi-location-manager.spec @@ -1,7 +1,7 @@ #sbs-git:slp/api/location-manager capi-location-manager 0.1.0 d1ee09a32e8bc0e9ed48ece37c641a7393c086c5 Name: capi-location-manager Summary: A Location Manager library in Tizen Native API -Version: 0.1.9 +Version: 0.1.11 Release: 1 Group: System/Libraries License: Apache License, Version 2.0 diff --git a/src/location_bounds.c b/src/location_bounds.c index d60283c..1819f27 100755 --- a/src/location_bounds.c +++ b/src/location_bounds.c @@ -52,7 +52,7 @@ static location_bounds_type_e __convert_bounds_type(LocationBoundaryType type) return ret; } -int location_bounds_create_rect(location_coords_s top_left, location_coords_s bottom_right, location_bounds_h * bounds) +EXPORT_API int location_bounds_create_rect(location_coords_s top_left, location_coords_s bottom_right, location_bounds_h * bounds) { LOCATIONS_NULL_ARG_CHECK(bounds); LOCATIONS_CHECK_CONDITION(top_left.latitude>=-90 && top_left.latitude<=90,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER,"LOCATION_BOUNDS_ERROR_INVALID_PARAMETER"); @@ -98,7 +98,7 @@ int location_bounds_create_rect(location_coords_s top_left, location_coords_s bo return LOCATION_BOUNDS_ERROR_NONE; } -int location_bounds_create_circle(location_coords_s center, double radius, location_bounds_h * bounds) +EXPORT_API int location_bounds_create_circle(location_coords_s center, double radius, location_bounds_h * bounds) { LOCATIONS_NULL_ARG_CHECK(bounds); LOCATIONS_CHECK_CONDITION(radius>=0,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER,"LOCATION_BOUNDS_ERROR_INVALID_PARAMETER"); @@ -134,7 +134,7 @@ int location_bounds_create_circle(location_coords_s center, double radius, locat return LOCATION_BOUNDS_ERROR_NONE; } -int location_bounds_create_polygon(location_coords_s * coords_list, int length, location_bounds_h * bounds) +EXPORT_API int location_bounds_create_polygon(location_coords_s * coords_list, int length, location_bounds_h * bounds) { LOCATIONS_NULL_ARG_CHECK(coords_list); LOCATIONS_NULL_ARG_CHECK(bounds); @@ -189,7 +189,7 @@ int location_bounds_create_polygon(location_coords_s * coords_list, int length, return LOCATION_BOUNDS_ERROR_NONE; } -bool location_bounds_contains_coordinates(location_bounds_h bounds, location_coords_s coords) +EXPORT_API bool location_bounds_contains_coordinates(location_bounds_h bounds, location_coords_s coords) { if (!bounds) return FALSE; @@ -209,7 +209,7 @@ bool location_bounds_contains_coordinates(location_bounds_h bounds, location_coo return result; } -int location_bounds_get_type(location_bounds_h bounds, location_bounds_type_e * type) +EXPORT_API int location_bounds_get_type(location_bounds_h bounds, location_bounds_type_e * type) { LOCATIONS_NULL_ARG_CHECK(bounds); LOCATIONS_NULL_ARG_CHECK(type); @@ -218,7 +218,7 @@ int location_bounds_get_type(location_bounds_h bounds, location_bounds_type_e * return LOCATION_BOUNDS_ERROR_NONE; } -int location_bounds_get_rect_coords(location_bounds_h bounds, location_coords_s * top_left, location_coords_s * bottom_right) +EXPORT_API int location_bounds_get_rect_coords(location_bounds_h bounds, location_coords_s * top_left, location_coords_s * bottom_right) { LOCATIONS_NULL_ARG_CHECK(bounds); LOCATIONS_NULL_ARG_CHECK(top_left); @@ -236,7 +236,7 @@ int location_bounds_get_rect_coords(location_bounds_h bounds, location_coords_s return LOCATION_BOUNDS_ERROR_NONE; } -int location_bounds_get_circle_coords(location_bounds_h bounds, location_coords_s * center, double *radius) +EXPORT_API int location_bounds_get_circle_coords(location_bounds_h bounds, location_coords_s * center, double *radius) { LOCATIONS_NULL_ARG_CHECK(bounds); LOCATIONS_NULL_ARG_CHECK(center); @@ -253,7 +253,7 @@ int location_bounds_get_circle_coords(location_bounds_h bounds, location_coords_ return LOCATION_BOUNDS_ERROR_NONE; } -int location_bounds_foreach_polygon_coords(location_bounds_h bounds, polygon_coords_cb callback, void *user_data) +EXPORT_API int location_bounds_foreach_polygon_coords(location_bounds_h bounds, polygon_coords_cb callback, void *user_data) { LOCATIONS_NULL_ARG_CHECK(bounds); LOCATIONS_NULL_ARG_CHECK(callback); @@ -279,7 +279,7 @@ int location_bounds_foreach_polygon_coords(location_bounds_h bounds, polygon_coo return LOCATION_BOUNDS_ERROR_NONE; } -int location_bounds_destroy(location_bounds_h bounds) +EXPORT_API int location_bounds_destroy(location_bounds_h bounds) { LOCATIONS_NULL_ARG_CHECK(bounds); location_bounds_s *handle = (location_bounds_s *) bounds; @@ -295,7 +295,7 @@ int location_bounds_destroy(location_bounds_h bounds) return LOCATION_BOUNDS_ERROR_NONE; } -int location_bounds_set_state_changed_cb(location_bounds_h bounds, location_bounds_state_changed_cb callback, void *user_data) +EXPORT_API int location_bounds_set_state_changed_cb(location_bounds_h bounds, location_bounds_state_changed_cb callback, void *user_data) { LOCATIONS_NULL_ARG_CHECK(bounds); LOCATIONS_NULL_ARG_CHECK(callback); @@ -305,7 +305,7 @@ int location_bounds_set_state_changed_cb(location_bounds_h bounds, location_boun return LOCATION_BOUNDS_ERROR_NONE; } -int location_bounds_unset_state_changed_cb(location_bounds_h bounds) +EXPORT_API int location_bounds_unset_state_changed_cb(location_bounds_h bounds) { LOCATIONS_NULL_ARG_CHECK(bounds); location_bounds_s *handle = (location_bounds_s *) bounds; diff --git a/src/location_preference.c b/src/location_preference.c index 2905fc5..c2d1f73 100755 --- a/src/location_preference.c +++ b/src/location_preference.c @@ -59,7 +59,7 @@ static int __convert_error_code(int code) /* * Public Implementation */ -int location_preference_foreach_available_property_keys(location_service_h service, location_preference_available_property_key_cb callback, void* user_data) +EXPORT_API int location_preference_foreach_available_property_keys(location_service_h service, location_preference_available_property_key_cb callback, void* user_data) { LocationMapObject* object = NULL; GList* keys = NULL; @@ -88,7 +88,7 @@ int location_preference_foreach_available_property_keys(location_service_h servi } } -int location_preference_foreach_available_property_values(location_service_h service, const char* key, location_preference_available_property_value_cb callback, void* user_data) +EXPORT_API int location_preference_foreach_available_property_values(location_service_h service, const char* key, location_preference_available_property_value_cb callback, void* user_data) { LOCATION_PREFERENCE_NULL_ARG_CHECK(service); LOCATION_PREFERENCE_NULL_ARG_CHECK(key); @@ -96,7 +96,7 @@ int location_preference_foreach_available_property_values(location_service_h ser return LOCATION_PREFERENCE_ERROR_RESULT_NOT_FOUND; } -int location_preference_foreach_available_languages(location_service_h service, location_preference_available_language_cb callback, void* user_data) +EXPORT_API int location_preference_foreach_available_languages(location_service_h service, location_preference_available_language_cb callback, void* user_data) { LocationMapObject* object = NULL; GList* keys = NULL; @@ -125,7 +125,7 @@ int location_preference_foreach_available_languages(location_service_h service, } } -int location_preference_foreach_available_country_codes(location_service_h service, location_preference_available_country_code_cb callback, void* user_data) +EXPORT_API int location_preference_foreach_available_country_codes(location_service_h service, location_preference_available_country_code_cb callback, void* user_data) { LocationMapObject* object = NULL; GList* keys = NULL; @@ -154,7 +154,7 @@ int location_preference_foreach_available_country_codes(location_service_h servi return LOCATION_PREFERENCE_ERROR_NONE; } -int location_preference_foreach_properties(location_service_h service, location_preference_property_cb callback, void* user_data) +EXPORT_API int location_preference_foreach_properties(location_service_h service, location_preference_property_cb callback, void* user_data) { LocationMapPref* pref = NULL; LocationMapObject* object = NULL; @@ -182,7 +182,7 @@ int location_preference_foreach_properties(location_service_h service, location_ return LOCATION_PREFERENCE_ERROR_NONE; } -int location_preference_set(location_service_h service, const char* key, const char* value) +EXPORT_API int location_preference_set(location_service_h service, const char* key, const char* value) { LocationMapPref* pref = NULL; LocationMapObject* object = NULL; @@ -202,7 +202,7 @@ int location_preference_set(location_service_h service, const char* key, const c return LOCATION_PREFERENCE_ERROR_NONE; } -int location_preference_get(location_service_h service, const char* key, char** value) +EXPORT_API int location_preference_get(location_service_h service, const char* key, char** value) { LocationMapPref* pref = NULL; LocationMapObject* object = NULL; @@ -232,7 +232,7 @@ int location_preference_get(location_service_h service, const char* key, char** return LOCATION_PREFERENCE_ERROR_NONE; } -int location_preference_set_provider(location_service_h service, char* provider) +EXPORT_API int location_preference_set_provider(location_service_h service, char* provider) { LOCATION_PREFERENCE_NULL_ARG_CHECK(service); LOCATION_PREFERENCE_NULL_ARG_CHECK(provider); @@ -260,7 +260,7 @@ int location_preference_set_provider(location_service_h service, char* provider) return LOCATION_PREFERENCE_ERROR_NONE; } -int location_preference_get_provider(location_service_h service, char** provider) +EXPORT_API int location_preference_get_provider(location_service_h service, char** provider) { LOCATION_PREFERENCE_NULL_ARG_CHECK(service); LOCATION_PREFERENCE_NULL_ARG_CHECK(provider); @@ -285,7 +285,7 @@ int location_preference_get_provider(location_service_h service, char** provider return LOCATION_PREFERENCE_ERROR_NONE; } -int location_preference_get_default_provider(location_service_h service, char** provider) +EXPORT_API int location_preference_get_default_provider(location_service_h service, char** provider) { LOCATION_PREFERENCE_NULL_ARG_CHECK(service); LOCATION_PREFERENCE_NULL_ARG_CHECK(provider); @@ -302,7 +302,7 @@ int location_preference_get_default_provider(location_service_h service, char** return LOCATION_PREFERENCE_ERROR_NONE; } -int location_preference_foreach_supported_provider(location_service_h service, location_preference_supported_provider_cb callback , void *user_data) +EXPORT_API int location_preference_foreach_supported_provider(location_service_h service, location_preference_supported_provider_cb callback , void *user_data) { LOCATION_PREFERENCE_NULL_ARG_CHECK(service); LOCATION_PREFERENCE_NULL_ARG_CHECK(callback); @@ -324,7 +324,7 @@ int location_preference_foreach_supported_provider(location_service_h service, l return LOCATION_PREFERENCE_ERROR_NONE; } -int location_preference_get_provider_name(location_service_h service, char** provider) +EXPORT_API int location_preference_get_provider_name(location_service_h service, char** provider) { LocationMapPref* pref = NULL; LocationMapObject* object = NULL; @@ -347,7 +347,7 @@ int location_preference_get_provider_name(location_service_h service, char** pro return LOCATION_PREFERENCE_ERROR_NONE; } -int location_preference_get_distance_unit(location_service_h service, location_preference_distance_unit_e* unit) +EXPORT_API int location_preference_get_distance_unit(location_service_h service, location_preference_distance_unit_e* unit) { LocationMapPref* pref = NULL; LocationMapObject* object = NULL; @@ -390,7 +390,7 @@ int location_preference_get_distance_unit(location_service_h service, location_p } } -int location_preference_set_distance_unit(location_service_h service, location_preference_distance_unit_e unit) +EXPORT_API int location_preference_set_distance_unit(location_service_h service, location_preference_distance_unit_e unit) { LocationMapPref* pref = NULL; LocationMapObject* object = NULL; @@ -428,7 +428,7 @@ int location_preference_set_distance_unit(location_service_h service, location_p return LOCATION_PREFERENCE_ERROR_NONE; } -int location_preference_get_language(location_service_h service, char** language) +EXPORT_API int location_preference_get_language(location_service_h service, char** language) { LocationMapPref* pref = NULL; LocationMapObject* object = NULL; @@ -451,7 +451,7 @@ int location_preference_get_language(location_service_h service, char** language return LOCATION_PREFERENCE_ERROR_NONE; } -int location_preference_set_language(location_service_h service, const char* language) +EXPORT_API int location_preference_set_language(location_service_h service, const char* language) { LocationMapPref* pref = NULL; LocationMapObject* object = NULL; @@ -471,7 +471,7 @@ int location_preference_set_language(location_service_h service, const char* lan } -int location_preference_get_country_code(location_service_h service, char** country_code) +EXPORT_API int location_preference_get_country_code(location_service_h service, char** country_code) { LocationMapPref* pref = NULL; LocationMapObject* object = NULL; @@ -494,7 +494,7 @@ int location_preference_get_country_code(location_service_h service, char** coun return LOCATION_PREFERENCE_ERROR_NONE; } -int location_preference_set_country_code(location_service_h service, const char* country_code) +EXPORT_API int location_preference_set_country_code(location_service_h service, const char* country_code) { LocationMapPref* pref = NULL; LocationMapObject* object = NULL; @@ -512,3 +512,46 @@ int location_preference_set_country_code(location_service_h service, const char* return LOCATION_PREFERENCE_ERROR_NONE; } + +EXPORT_API int location_preference_set_maps_key (location_service_h service, const char* maps_key) +{ + LocationMapPref* pref = NULL; + LocationMapObject* object = NULL; + + LOCATION_PREFERENCE_NULL_ARG_CHECK(service); + LOCATION_PREFERENCE_NULL_ARG_CHECK(maps_key); + + object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service); + pref = location_map_get_service_pref(object); + LOCATIONS_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER"); + + location_map_pref_set_maps_key(pref, maps_key); + location_map_set_service_pref(object, pref); + location_map_pref_free(pref); + + return LOCATION_PREFERENCE_ERROR_NONE; +} + +EXPORT_API int location_preference_get_maps_key (location_service_h service, char** maps_key) +{ + LocationMapPref* pref = NULL; + LocationMapObject* object = NULL; + char* ret = NULL; + + LOCATION_PREFERENCE_NULL_ARG_CHECK(service); + LOCATION_PREFERENCE_NULL_ARG_CHECK(maps_key); + + object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service); + pref = location_map_get_service_pref(object); + LOCATIONS_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER"); + + ret = location_map_pref_get_maps_key(pref); + if(ret != NULL) + *maps_key = strdup(ret); + else + *maps_key = NULL; + + location_map_pref_free(pref); + return LOCATION_PREFERENCE_ERROR_NONE; + +} \ No newline at end of file diff --git a/src/locations.c b/src/locations.c index fb05e36..c871165 100755 --- a/src/locations.c +++ b/src/locations.c @@ -72,8 +72,7 @@ static void __cb_service_updated(GObject * self, guint type, gpointer data, gpoi location_manager_s *handle = (location_manager_s *) userdata; if (type == VELOCITY_UPDATED && handle->user_cb[_LOCATIONS_EVENT_TYPE_VELOCITY]) { LocationVelocity *vel = (LocationVelocity *) data; - LOCATIONS_LOGI("Current velocity: timestamp : %d, speed: %f, direction : %f, climb : %f", - vel->timestamp, vel->speed, vel->direction, vel->climb); + LOCATIONS_LOGI("Current velocity: timestamp : %d", vel->timestamp); ((location_velocity_updated_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_VELOCITY]) (vel->speed, vel->direction, vel->climb, vel->timestamp, handle->user_data @@ -81,8 +80,7 @@ static void __cb_service_updated(GObject * self, guint type, gpointer data, gpoi } else if (type == POSITION_UPDATED && handle->user_cb[_LOCATIONS_EVENT_TYPE_POSITION]) { LocationPosition *pos = (LocationPosition *) data; - LOCATIONS_LOGI("Current position: timestamp : %d, latitude : %f, altitude: %f, longitude: %f", - pos->timestamp, pos->latitude, pos->altitude, pos->longitude); + LOCATIONS_LOGI("Current position: timestamp : %d", pos->timestamp); ((location_position_updated_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_POSITION]) (pos->latitude, pos->longitude, pos->altitude, pos->timestamp, handle->user_data @@ -331,7 +329,7 @@ static void __foreach_boundary(LocationBoundary * boundary, void *user_data) * Public Implementation */ -bool location_manager_is_supported_method(location_method_e method) +EXPORT_API bool location_manager_is_supported_method(location_method_e method) { LocationMethod _method = LOCATION_METHOD_NONE; switch (method) { @@ -354,7 +352,7 @@ bool location_manager_is_supported_method(location_method_e method) return location_is_supported_method(_method); } -int location_manager_create(location_method_e method, location_manager_h * manager) +EXPORT_API int location_manager_create(location_method_e method, location_manager_h * manager) { LOCATIONS_NULL_ARG_CHECK(manager); if (location_init() != LOCATION_ERROR_NONE) @@ -410,7 +408,7 @@ int location_manager_create(location_method_e method, location_manager_h * manag return LOCATIONS_ERROR_NONE; } -int location_manager_destroy(location_manager_h manager) +EXPORT_API int location_manager_destroy(location_manager_h manager) { LOCATIONS_NULL_ARG_CHECK(manager); location_manager_s *handle = (location_manager_s *) manager; @@ -426,7 +424,7 @@ int location_manager_destroy(location_manager_h manager) return LOCATIONS_ERROR_NONE; } -int location_manager_start(location_manager_h manager) +EXPORT_API int location_manager_start(location_manager_h manager) { LOCATIONS_NULL_ARG_CHECK(manager); location_manager_s *handle = (location_manager_s *) manager; @@ -442,7 +440,7 @@ int location_manager_start(location_manager_h manager) return LOCATIONS_ERROR_NONE; } -int location_manager_stop(location_manager_h manager) +EXPORT_API int location_manager_stop(location_manager_h manager) { LOCATIONS_NULL_ARG_CHECK(manager); location_manager_s *handle = (location_manager_s *) manager; @@ -458,7 +456,7 @@ int location_manager_stop(location_manager_h manager) return LOCATIONS_ERROR_NONE; } -int location_manager_add_boundary(location_manager_h manager, location_bounds_h bounds) +EXPORT_API int location_manager_add_boundary(location_manager_h manager, location_bounds_h bounds) { LOCATIONS_NULL_ARG_CHECK(manager); LOCATIONS_NULL_ARG_CHECK(bounds); @@ -474,7 +472,7 @@ int location_manager_add_boundary(location_manager_h manager, location_bounds_h return LOCATIONS_ERROR_NONE; } -int location_manager_remove_boundary(location_manager_h manager, location_bounds_h bounds) +EXPORT_API int location_manager_remove_boundary(location_manager_h manager, location_bounds_h bounds) { LOCATIONS_NULL_ARG_CHECK(manager); LOCATIONS_NULL_ARG_CHECK(bounds); @@ -490,7 +488,7 @@ int location_manager_remove_boundary(location_manager_h manager, location_bounds return LOCATIONS_ERROR_NONE; } -int location_manager_foreach_boundary(location_manager_h manager, location_bounds_cb callback, void *user_data) +EXPORT_API int location_manager_foreach_boundary(location_manager_h manager, location_bounds_cb callback, void *user_data) { LOCATIONS_NULL_ARG_CHECK(manager); LOCATIONS_NULL_ARG_CHECK(callback); @@ -506,7 +504,7 @@ int location_manager_foreach_boundary(location_manager_h manager, location_bound return LOCATIONS_ERROR_NONE; } -int location_manager_get_method(location_manager_h manager, location_method_e * method) +EXPORT_API int location_manager_get_method(location_manager_h manager, location_method_e * method) { LOCATIONS_NULL_ARG_CHECK(manager); LOCATIONS_NULL_ARG_CHECK(method); @@ -540,7 +538,7 @@ int location_manager_get_method(location_manager_h manager, location_method_e * return LOCATIONS_ERROR_NONE; } -int location_manager_get_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, +EXPORT_API int location_manager_get_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t * timestamp) { LOCATIONS_NULL_ARG_CHECK(manager); @@ -577,7 +575,58 @@ int location_manager_get_position(location_manager_h manager, double *altitude, return LOCATIONS_ERROR_NONE; } -int location_manager_get_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t * timestamp) +EXPORT_API int location_manager_get_location(location_manager_h manager, double *altitude, double *latitude, double *longitude, double *climb, double *direction, double *speed, location_accuracy_level_e *level, double *horizontal, double *vertical, time_t *timestamp) +{ + LOCATIONS_NULL_ARG_CHECK(manager); + LOCATIONS_NULL_ARG_CHECK(altitude); + LOCATIONS_NULL_ARG_CHECK(latitude); + LOCATIONS_NULL_ARG_CHECK(longitude); + LOCATIONS_NULL_ARG_CHECK(climb); + LOCATIONS_NULL_ARG_CHECK(direction); + LOCATIONS_NULL_ARG_CHECK(speed); + LOCATIONS_NULL_ARG_CHECK(level); + LOCATIONS_NULL_ARG_CHECK(horizontal); + LOCATIONS_NULL_ARG_CHECK(vertical); + LOCATIONS_NULL_ARG_CHECK(timestamp); + + location_manager_s *handle = (location_manager_s *) manager; + int ret; + LocationPosition *pos = NULL; + LocationVelocity *vel = NULL; + LocationAccuracy *acc = NULL; + ret = location_get_position_ext(handle->object, &pos, &vel, &acc); + if (ret != LOCATION_ERROR_NONE) { + return __convert_error_code(ret); + } + + if (pos->status == LOCATION_STATUS_NO_FIX) { + *altitude = -1; + *latitude = -1; + *longitude = -1; + } else { + if (pos->status == LOCATION_STATUS_3D_FIX) { + *altitude = pos->altitude; + } else { + *altitude = -1; + } + *latitude = pos->latitude; + *longitude = pos->longitude; + } + *timestamp = pos->timestamp; + *climb = vel->climb; + *direction = vel->direction; + *speed = vel->speed; + *level = acc->level; + *horizontal = acc->horizontal_accuracy; + *vertical = acc->vertical_accuracy; + + location_position_free(pos); + location_velocity_free(vel); + location_accuracy_free(acc); + return LOCATIONS_ERROR_NONE; +} + +EXPORT_API int location_manager_get_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t * timestamp) { LOCATIONS_NULL_ARG_CHECK(manager); LOCATIONS_NULL_ARG_CHECK(climb); @@ -603,7 +652,7 @@ int location_manager_get_velocity(location_manager_h manager, double *climb, dou return LOCATIONS_ERROR_NONE; } -int location_manager_get_accuracy(location_manager_h manager, location_accuracy_level_e * level, double *horizontal, +EXPORT_API int location_manager_get_accuracy(location_manager_h manager, location_accuracy_level_e * level, double *horizontal, double *vertical) { LOCATIONS_NULL_ARG_CHECK(manager); @@ -632,7 +681,7 @@ int location_manager_get_accuracy(location_manager_h manager, location_accuracy_ return LOCATIONS_ERROR_NONE; } -int location_manager_get_last_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, +EXPORT_API int location_manager_get_last_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t * timestamp) { LOCATIONS_NULL_ARG_CHECK(manager); @@ -670,7 +719,58 @@ int location_manager_get_last_position(location_manager_h manager, double *altit return LOCATIONS_ERROR_NONE; } -int location_manager_get_last_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t * timestamp) +EXPORT_API int location_manager_get_last_location(location_manager_h manager, double *altitude, double *latitude, double *longitude, double *climb, double *direction, double *speed, location_accuracy_level_e * level, double *horizontal, double *vertical, time_t * timestamp) +{ + LOCATIONS_NULL_ARG_CHECK(manager); + LOCATIONS_NULL_ARG_CHECK(altitude); + LOCATIONS_NULL_ARG_CHECK(latitude); + LOCATIONS_NULL_ARG_CHECK(longitude); + LOCATIONS_NULL_ARG_CHECK(climb); + LOCATIONS_NULL_ARG_CHECK(direction); + LOCATIONS_NULL_ARG_CHECK(speed); + LOCATIONS_NULL_ARG_CHECK(level); + LOCATIONS_NULL_ARG_CHECK(horizontal); + LOCATIONS_NULL_ARG_CHECK(vertical); + LOCATIONS_NULL_ARG_CHECK(timestamp); + + location_manager_s *handle = (location_manager_s *) manager; + + int ret; + LocationPosition *last_pos = NULL; + LocationVelocity *last_vel = NULL; + LocationAccuracy *last_acc = NULL; + ret = location_get_last_position_ext(handle->object, &last_pos, &last_vel, &last_acc); + if (ret != LOCATION_ERROR_NONE) { + return __convert_error_code(ret); + } + + if (last_pos->status == LOCATION_STATUS_NO_FIX) { + *altitude = -1; + *latitude = -1; + *longitude = -1; + } else { + if (last_pos->status == LOCATION_STATUS_3D_FIX) { + *altitude = last_pos->altitude; + } else { + *altitude = -1; + } + *latitude = last_pos->latitude; + *longitude = last_pos->longitude; + } + *timestamp = last_pos->timestamp; + *climb = last_vel->climb; + *direction = last_vel->direction; + *speed = last_vel->speed; + *level = last_acc->level; + *horizontal = last_acc->horizontal_accuracy; + *vertical = last_acc->vertical_accuracy; + location_position_free(last_pos); + location_velocity_free(last_vel); + location_accuracy_free(last_acc); + return LOCATIONS_ERROR_NONE; +} + +EXPORT_API int location_manager_get_last_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t * timestamp) { LOCATIONS_NULL_ARG_CHECK(manager); LOCATIONS_NULL_ARG_CHECK(climb); @@ -697,7 +797,7 @@ int location_manager_get_last_velocity(location_manager_h manager, double *climb return LOCATIONS_ERROR_NONE; } -int location_manager_get_last_accuracy(location_manager_h manager, location_accuracy_level_e * level, double *horizontal, +EXPORT_API int location_manager_get_last_accuracy(location_manager_h manager, location_accuracy_level_e * level, double *horizontal, double *vertical) { LOCATIONS_NULL_ARG_CHECK(manager); @@ -722,7 +822,7 @@ int location_manager_get_last_accuracy(location_manager_h manager, location_accu return LOCATIONS_ERROR_NONE; } -int location_manager_get_accessibility_state(location_accessibility_state_e* state) +EXPORT_API int location_manager_get_accessibility_state(location_accessibility_state_e* state) { LOCATIONS_NULL_ARG_CHECK(state); @@ -750,7 +850,7 @@ int location_manager_get_accessibility_state(location_accessibility_state_e* sta return LOCATIONS_ERROR_NONE; } -int location_manager_set_position_updated_cb(location_manager_h manager, location_position_updated_cb callback, int interval, void *user_data) +EXPORT_API int location_manager_set_position_updated_cb(location_manager_h manager, location_position_updated_cb callback, int interval, void *user_data) { LOCATIONS_CHECK_CONDITION(interval >= 1 && interval <= 120, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER"); @@ -760,12 +860,12 @@ int location_manager_set_position_updated_cb(location_manager_h manager, locatio return __set_callback(_LOCATIONS_EVENT_TYPE_POSITION, manager, callback, user_data); } -int location_manager_unset_position_updated_cb(location_manager_h manager) +EXPORT_API int location_manager_unset_position_updated_cb(location_manager_h manager) { return __unset_callback(_LOCATIONS_EVENT_TYPE_POSITION, manager); } -int location_manager_set_velocity_updated_cb(location_manager_h manager, location_velocity_updated_cb callback, int interval, void *user_data) +EXPORT_API int location_manager_set_velocity_updated_cb(location_manager_h manager, location_velocity_updated_cb callback, int interval, void *user_data) { LOCATIONS_CHECK_CONDITION(interval >= 1 && interval <= 120, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER"); @@ -775,33 +875,33 @@ int location_manager_set_velocity_updated_cb(location_manager_h manager, locatio return __set_callback(_LOCATIONS_EVENT_TYPE_VELOCITY, manager, callback, user_data); } -int location_manager_unset_velocity_updated_cb(location_manager_h manager) +EXPORT_API int location_manager_unset_velocity_updated_cb(location_manager_h manager) { return __unset_callback(_LOCATIONS_EVENT_TYPE_VELOCITY, manager); } -int location_manager_set_service_state_changed_cb(location_manager_h manager, location_service_state_changed_cb callback, +EXPORT_API int location_manager_set_service_state_changed_cb(location_manager_h manager, location_service_state_changed_cb callback, void *user_data) { return __set_callback(_LOCATIONS_EVENT_TYPE_SERVICE_STATE, manager, callback, user_data); } -int location_manager_unset_service_state_changed_cb(location_manager_h manager) +EXPORT_API int location_manager_unset_service_state_changed_cb(location_manager_h manager) { return __unset_callback(_LOCATIONS_EVENT_TYPE_SERVICE_STATE, manager); } -int location_manager_set_zone_changed_cb(location_manager_h manager, location_zone_changed_cb callback, void *user_data) +EXPORT_API int location_manager_set_zone_changed_cb(location_manager_h manager, location_zone_changed_cb callback, void *user_data) { return __set_callback(_LOCATIONS_EVENT_TYPE_BOUNDARY, manager, callback, user_data); } -int location_manager_unset_zone_changed_cb(location_manager_h manager) +EXPORT_API int location_manager_unset_zone_changed_cb(location_manager_h manager) { return __unset_callback(_LOCATIONS_EVENT_TYPE_BOUNDARY, manager); } -int location_manager_get_distance(double start_latitude, double start_longitude, double end_latitude, double end_longitude, double *distance) +EXPORT_API int location_manager_get_distance(double start_latitude, double start_longitude, double end_latitude, double end_longitude, double *distance) { LOCATIONS_NULL_ARG_CHECK(distance); LOCATIONS_CHECK_CONDITION(start_latitude>=-90 && start_latitude<=90,LOCATIONS_ERROR_INVALID_PARAMETER,"LOCATIONS_ERROR_INVALID_PARAMETER"); @@ -825,7 +925,7 @@ int location_manager_get_distance(double start_latitude, double start_longitude, return LOCATIONS_ERROR_NONE; } -int location_manager_send_command(const char *cmd) +EXPORT_API int location_manager_send_command(const char *cmd) { LOCATIONS_NULL_ARG_CHECK(cmd); @@ -842,7 +942,7 @@ int location_manager_send_command(const char *cmd) // GPS Status & Satellites //////////////////////////////////////// -int gps_status_get_nmea(location_manager_h manager, char **nmea) +EXPORT_API int gps_status_get_nmea(location_manager_h manager, char **nmea) { LOCATIONS_NULL_ARG_CHECK(manager); LOCATIONS_NULL_ARG_CHECK(nmea); @@ -879,7 +979,7 @@ int gps_status_get_nmea(location_manager_h manager, char **nmea) return LOCATIONS_ERROR_NONE; } -int gps_status_get_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp) +EXPORT_API int gps_status_get_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp) { LOCATIONS_NULL_ARG_CHECK(manager); LOCATIONS_NULL_ARG_CHECK(num_of_active); @@ -908,7 +1008,7 @@ int gps_status_get_satellite(location_manager_h manager, int *num_of_active, int return LOCATIONS_ERROR_NONE; } -int gps_status_set_satellite_updated_cb(location_manager_h manager, gps_status_satellite_updated_cb callback, int interval, void *user_data) +EXPORT_API int gps_status_set_satellite_updated_cb(location_manager_h manager, gps_status_satellite_updated_cb callback, int interval, void *user_data) { LOCATIONS_CHECK_CONDITION(interval >= 1 && interval <= 120, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER"); @@ -918,13 +1018,13 @@ int gps_status_set_satellite_updated_cb(location_manager_h manager, gps_status_s return __set_callback(_LOCATIONS_EVENT_TYPE_SATELLITE, manager, callback, user_data); } -int gps_status_unset_satellite_updated_cb(location_manager_h manager) +EXPORT_API int gps_status_unset_satellite_updated_cb(location_manager_h manager) { return __unset_callback(_LOCATIONS_EVENT_TYPE_SATELLITE, manager); } -int gps_status_foreach_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data) +EXPORT_API int gps_status_foreach_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data) { LOCATIONS_NULL_ARG_CHECK(manager); LOCATIONS_NULL_ARG_CHECK(callback); @@ -959,7 +1059,7 @@ int gps_status_foreach_satellites_in_view(location_manager_h manager, gps_status return LOCATIONS_ERROR_NONE; } -int gps_status_get_last_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp) +EXPORT_API int gps_status_get_last_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp) { LOCATIONS_NULL_ARG_CHECK(manager); LOCATIONS_NULL_ARG_CHECK(num_of_active); @@ -988,7 +1088,7 @@ int gps_status_get_last_satellite(location_manager_h manager, int *num_of_active return LOCATIONS_ERROR_NONE; } -int gps_status_foreach_last_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback, +EXPORT_API int gps_status_foreach_last_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data) { LOCATIONS_NULL_ARG_CHECK(manager);