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
}
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
* 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) {
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)
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;
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;
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;
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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");
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");
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");
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);
// 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);
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);
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");
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);
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);
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);