#define LOCATION_LOGE(fmt, args...) LOGE(fmt, ##args)
#define LOCATION_SECLOG(fmt, args...) SECURE_LOGD(fmt, ##args)
+#define _D(fmt, args...) LOGD(fmt, ##args)
+#define _W(fmt, args...) LOGW(fmt, ##args)
+#define _I(fmt, args...) LOGI(fmt, ##args)
+#define _E(fmt, args...) LOGE(fmt, ##args)
+
+#define LOC_IF_FAIL(ret, tag, fmt, arg...) \
+ do { if (ret != 0) { tag(fmt, ##arg); return ret; } } while (0)
+
+#define LOC_IF_FAIL_LOG(ret, tag, fmt, arg...) \
+ do { if (ret != 0) tag(fmt, ##arg); } while (0)
+
+#define LOC_COND_RET(cond, ret, tag, fmt, arg...) \
+ do { if (cond) { tag(fmt, ##arg); return ret; } } while (0)
+
+#define LOC_COND_VOID(cond, tag, fmt, arg...) \
+ do { if (cond) { tag(fmt, ##arg); return ; } } while (0)
+
+#define LOC_COND_LOG(cond, tag, fmt, arg...) \
+ do { if (cond) tag(fmt, ##arg); } while (0)
+
+#define LOC_FUNC_LOG LOGI("%s", __func__);
#endif
{
static volatile gsize type_volatile = 0;
if (g_once_init_enter(&type_volatile)) {
- GType type = g_boxed_type_register_static(
- g_intern_static_string("LocationAccuracy"),
- (GBoxedCopyFunc) location_accuracy_copy,
- (GBoxedFreeFunc) location_accuracy_free);
+ GType type = g_boxed_type_register_static(g_intern_static_string("LocationAccuracy"),
+ (GBoxedCopyFunc) location_accuracy_copy, (GBoxedFreeFunc) location_accuracy_free);
+
g_once_init_leave(&type_volatile, type);
}
return type_volatile;
location_boundary_copy(const LocationBoundary *boundary)
{
g_return_val_if_fail(boundary, NULL);
- if (boundary->type == LOCATION_BOUNDARY_RECT) {
+ if (boundary->type == LOCATION_BOUNDARY_RECT)
return location_boundary_new_for_rect(boundary->rect.left_top, boundary->rect.right_bottom);
- } else if (boundary->type == LOCATION_BOUNDARY_CIRCLE) {
+ else if (boundary->type == LOCATION_BOUNDARY_CIRCLE)
return location_boundary_new_for_circle(boundary->circle.center, boundary->circle.radius);
- } else if (boundary->type == LOCATION_BOUNDARY_POLYGON) {
+ else if (boundary->type == LOCATION_BOUNDARY_POLYGON)
return location_boundary_new_for_polygon(boundary->polygon.position_list);
- }
+
return NULL;
}
g_return_val_if_fail(a, 1);
g_return_val_if_fail(b, -1);
- if (location_position_equal((LocationPosition *) a, (LocationPosition *)b) == TRUE) {
+ if (location_position_equal((LocationPosition *) a, (LocationPosition *)b) == TRUE)
return 0;
- }
return -1;
}
case LOCATION_BOUNDARY_POLYGON: {
GList *boundary1_next = NULL;
GList *boundary2_start = NULL, *boundary2_prev = NULL, *boundary2_next = NULL;
- if (g_list_length(priv1->boundary->polygon.position_list) != g_list_length(priv2->boundary->polygon.position_list)) {
+ if (g_list_length(priv1->boundary->polygon.position_list) != g_list_length(priv2->boundary->polygon.position_list))
return -1;
- }
/* Find a matching index of Boundary2 with Boundary1's 1st postion. */
boundary2_start = g_list_find_custom(priv2->boundary->polygon.position_list, g_list_nth_data(priv1->boundary->polygon.position_list, 0), (GCompareFunc) compare_position);
boundary1_next = g_list_next(boundary1_next);
while (boundary1_next) {
boundary2_prev = g_list_previous(boundary2_prev);
- if (boundary2_prev == NULL) boundary2_prev = g_list_last(priv2->boundary->polygon.position_list);
- if (location_position_equal((LocationPosition *)boundary1_next->data, (LocationPosition *) boundary2_prev->data) == FALSE) {
+ if (boundary2_prev == NULL)
+ boundary2_prev = g_list_last(priv2->boundary->polygon.position_list);
+
+ if (location_position_equal((LocationPosition *)boundary1_next->data, (LocationPosition *) boundary2_prev->data) == FALSE)
return -1;
- }
+
boundary1_next = g_list_next(boundary1_next);
}
ret = 0;
boundary1_next = g_list_next(boundary1_next);
while (boundary1_next) {
boundary2_next = g_list_next(boundary2_next);
- if (boundary2_next == NULL) boundary2_next = g_list_first(priv2->boundary->polygon.position_list);
- if (location_position_equal((LocationPosition *)boundary1_next->data, (LocationPosition *) boundary2_next->data) == FALSE) {
+ if (boundary2_next == NULL)
+ boundary2_next = g_list_first(priv2->boundary->polygon.position_list);
+
+ if (location_position_equal((LocationPosition *)boundary1_next->data, (LocationPosition *) boundary2_next->data) == FALSE)
return -1;
- }
+
boundary1_next = g_list_next(boundary1_next);
}
ret = 0;
int set_prop_boundary(GList **prev_boundary_priv_list, GList *new_boundary_priv_list)
{
- LOCATION_LOGD("ENTER >>>");
+ LOC_FUNC_LOG
g_return_val_if_fail(new_boundary_priv_list, LOCATION_ERROR_PARAMETER);
int index = 0;
int set_prop_removal_boundary(GList **prev_boundary_list, LocationBoundary *boundary)
{
- LOCATION_LOGD("ENTER >>>");
+ LOC_FUNC_LOG
g_return_val_if_fail(*prev_boundary_list, LOCATION_ERROR_PARAMETER);
GList *check_list = NULL;
if (target_app_id == NULL) {
pid = getpid();
ret = app_manager_get_app_id(pid, &app_id);
- if (ret != APP_MANAGER_ERROR_NONE) {
- LOCATION_LOGE("Fail to get app_id. Err[%d]", ret);
- return LOCATION_ERROR_NONE;
- }
+ LOC_COND_RET(ret != APP_MANAGER_ERROR_NONE, LOCATION_ERROR_NONE, _E, "Fail to get app_id. Err[%d]", ret);
} else {
app_id = g_strdup(target_app_id);
}
return ret;
}
+
+const char* err_msg(int err)
+{
+ switch (err) {
+ case LOCATION_ERROR_NONE: return "LOCATION_ERROR_NONE";
+ case LOCATION_ERROR_NOT_ALLOWED: return "LOCATION_ERROR_NOT_ALLOWED";
+ case LOCATION_ERROR_NOT_AVAILABLE: return "LOCATION_ERROR_NOT_AVAILABLE";
+ case LOCATION_ERROR_NETWORK_FAILED: return "LOCATION_ERROR_NETWORK_FAILED";
+ case LOCATION_ERROR_NETWORK_NOT_CONNECTED: return "LOCATION_ERROR_NETWORK_NOT_CONNECTED";
+ case LOCATION_ERROR_CONFIGURATION: return "LOCATION_ERROR_CONFIGURATION";
+ case LOCATION_ERROR_PARAMETER: return "LOCATION_ERROR_PARAMETER";
+ case LOCATION_ERROR_NOT_FOUND: return "LOCATION_ERROR_NOT_FOUND";
+ case LOCATION_ERROR_NOT_SUPPORTED: return "LOCATION_ERROR_NOT_SUPPORTED";
+ case LOCATION_ERROR_UNKNOWN: return "LOCATION_ERROR_UNKNOWN";
+ case LOCATION_ERROR_SETTING_OFF: return "LOCATION_ERROR_SETTING_OFF";
+ case LOCATION_ERROR_SECURITY_DENIED: return "LOCATION_ERROR_SECURITY_DENIED";
+ default: return "LOCATION_ERROR_UNKNOWN";
+ }
+}
int location_get_app_type(char *app_id);
+const char* err_msg(int err);
G_END_DECLS
LocationVelocity *vel = NULL;
LocationAccuracy *acc = NULL;
- if (priv->pos) {
+ if (priv->pos)
pos = location_position_copy(priv->pos);
- } else {
+ else
pos = location_position_new(0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX);
- }
- if (priv->vel) {
+ if (priv->vel)
vel = location_velocity_copy(priv->vel);
- } else {
+ else
vel = location_velocity_new(0, 0.0, 0.0, 0.0);
- }
- if (priv->acc) {
+ if (priv->acc)
acc = location_accuracy_copy(priv->acc);
- } else {
+ else
acc = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
- }
g_signal_emit(object, signals[SERVICE_UPDATED], 0, priv->signal_type, pos, vel, acc);
priv->signal_type = 0;
static void __reset_pos_data_from_priv(LocationGpsPrivate *priv)
{
- LOCATION_LOGD("__reset_pos_data_from_priv");
+ LOC_FUNC_LOG
g_return_if_fail(priv);
if (priv->pos) {
static void gps_status_cb(gboolean enabled, LocationStatus status, gpointer self)
{
- LOCATION_LOGD("gps_status_cb");
+ LOC_FUNC_LOG
g_return_if_fail(self);
LocationGpsPrivate *priv = GET_PRIVATE(self);
g_return_if_fail(priv);
LocationGpsPrivate *priv = GET_PRIVATE(self);
g_return_if_fail(priv);
- if (priv->batch != NULL) {
+ if (priv->batch != NULL)
location_batch_free(priv->batch);
- }
+
priv->batch = location_get_batch_file(num_of_location);
g_signal_emit(self, signals[BATCH_UPDATED], 0, num_of_location);
#ifdef TIZEN_PROFILE_MOBILE
static void location_setting_search_cb(keynode_t *key, gpointer self)
{
- LOCATION_LOGD("location_setting_search_cb");
+ LOC_FUNC_LOG
g_return_if_fail(key);
g_return_if_fail(self);
LocationGpsPrivate *priv = GET_PRIVATE(self);
static void location_setting_gps_cb(keynode_t *key, gpointer self)
{
- LOCATION_LOGD("location_setting_gps_cb");
+ LOC_FUNC_LOG
g_return_if_fail(key);
g_return_if_fail(self);
LocationGpsPrivate *priv = GET_PRIVATE(self);
LOCATION_LOGD("location stopped by setting");
__set_started(self, FALSE);
ret = priv->mod->ops.stop(priv->mod->handler);
- if (ret == LOCATION_ERROR_NONE) {
+ if (ret == LOCATION_ERROR_NONE)
__reset_pos_data_from_priv(priv);
- } else {
+ else
LOCATION_LOGI("Fail to stop[%d]", ret);
- }
} else if (1 == location_setting_get_key_val(key) && priv->mod->ops.start && !__get_started(self)) {
LOCATION_LOGD("location resumed by setting");
static int location_gps_start(LocationGps *self)
{
- LOCATION_LOGD("ENTER >>>");
+ LOC_FUNC_LOG
LocationGpsPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
static int location_gps_stop(LocationGps *self)
{
- LOCATION_LOGD("location_gps_stop");
+ LOC_FUNC_LOG
LocationGpsPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
if (__get_started(self) == TRUE) {
__set_started(self, FALSE);
ret = priv->mod->ops.stop(priv->mod->handler);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Failed to stop. Error[%d]", ret);
- }
+ LOC_IF_FAIL_LOG(ret, _E, "Failed to stop [%s]", err_msg(ret));
} else {
return LOCATION_ERROR_NONE;
}
static int __set_sensor_batch(LocationGps *self, int batch_interval)
{
- LOCATION_LOGD("__set_sensor_batch");
+ LOC_FUNC_LOG
LocationGpsPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
bool supported = false;
ret = sensor_is_supported((sensor_type_e)0x1A02, &supported);
- if (ret != SENSOR_ERROR_NONE) {
- LOCATION_LOGD("sensor_is_supported() failed");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
-
- if (!supported) {
- LOCATION_LOGD("Not supported");
- return LOCATION_ERROR_NOT_SUPPORTED;
- }
+ LOC_IF_FAIL(ret, _E, "Fail to sensor_is_supported [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
+ LOC_COND_RET(!supported, LOCATION_ERROR_NOT_SUPPORTED, _E, "Batch sensor is not supported [%s]", err_msg(LOCATION_ERROR_NOT_SUPPORTED));
ret = sensor_get_default_sensor((sensor_type_e)0x1A02, &priv->sensor);
- if (ret != SENSOR_ERROR_NONE) {
- LOCATION_LOGD("sensor_get_default_sensor() failed (%d)", ret);
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_IF_FAIL(ret, _E, "Fail to sensor_get_default_sensor [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
ret = sensor_create_listener(priv->sensor, &priv->sensor_listener);
- if (ret != SENSOR_ERROR_NONE) {
- LOCATION_LOGD("sensor_create_listener() failed (%d)", ret);
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_IF_FAIL(ret, _E, "Fail to sensor_create_listener [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
ret = sensor_listener_set_event_cb(priv->sensor_listener, update_interval, __sensor_event_cb, self);
if (ret != SENSOR_ERROR_NONE) {
- LOCATION_LOGD("sensor_listener_set_event_cb() failed");
+ LOCATION_LOGE("sensor_listener_set_event_cb() failed");
sensor_destroy_listener(priv->sensor_listener);
return LOCATION_ERROR_NOT_AVAILABLE;
}
ret = sensor_listener_set_option(priv->sensor_listener, SENSOR_OPTION_ALWAYS_ON);
if (ret != SENSOR_ERROR_NONE) {
- LOCATION_LOGD("sensor_listener_set_option() failed");
+ LOCATION_LOGE("sensor_listener_set_option() failed");
sensor_destroy_listener(priv->sensor_listener);
return LOCATION_ERROR_NOT_AVAILABLE;
}
ret = sensor_listener_start(priv->sensor_listener);
if (ret != SENSOR_ERROR_NONE) {
- LOCATION_LOGD("sensor_listener_set_event_cb() failed");
+ LOCATION_LOGE("sensor_listener_set_event_cb() failed");
sensor_destroy_listener(priv->sensor_listener);
return LOCATION_ERROR_NOT_AVAILABLE;
}
static int location_gps_start_batch(LocationGps *self)
{
- LOCATION_LOGD("location_gps_start_batch");
+ LOC_FUNC_LOG
LocationGpsPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
__set_started(self, TRUE);
ret = priv->mod->ops.start_batch(priv->mod->handler, gps_batch_cb, priv->batch_interval, priv->batch_period, self);
if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Fail to start_batch. Error[%d]", ret);
+ LOCATION_LOGE("Fail to start_batch [%s]", err_msg(ret));
__set_started(self, FALSE);
return ret;
}
static int location_gps_stop_batch(LocationGps *self)
{
- LOCATION_LOGD("location_gps_stop_batch");
+ LOC_FUNC_LOG
LocationGpsPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
#ifdef TIZEN_DEVICE
ret = sensor_listener_stop(priv->sensor_listener);
- if (ret != SENSOR_ERROR_NONE) {
- LOCATION_LOGD("sensor_listener_stop() failed (%d)", ret);
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_IF_FAIL(ret, _E, "Fail to listener_stop [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
+
ret = sensor_listener_unset_event_cb(priv->sensor_listener);
- if (ret != SENSOR_ERROR_NONE) {
- LOCATION_LOGD("sensor_listener_unset_event_cb() failed (%d)", ret);
- }
+ LOC_IF_FAIL_LOG(ret, _E, "Fail to listener_unset_event_cb [%s]", err_msg(ret));
+
ret = sensor_destroy_listener(priv->sensor_listener);
- if (ret != SENSOR_ERROR_NONE) {
- LOCATION_LOGD("sensor_destroy_listener() failed (%d)", ret);
- }
+ LOC_IF_FAIL_LOG(ret, _E, "Fail to destroy_listener [%s]", err_msg(ret));
#else
if (__get_started(self) == TRUE) {
__set_started(self, FALSE);
ret = priv->mod->ops.stop_batch(priv->mod->handler);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Failed to stop_batch. Error[%d]", ret);
- }
+ LOC_IF_FAIL_LOG(ret, _E, "Failed to stop_batch [%s]", err_mgs(ret));
} else {
return LOCATION_ERROR_NONE;
}
static void location_gps_dispose(GObject *gobject)
{
- LOCATION_LOGD("location_gps_dispose");
+ LOC_FUNC_LOG
LocationGpsPrivate *priv = GET_PRIVATE(gobject);
g_return_if_fail(priv);
static void location_gps_finalize(GObject *gobject)
{
- LOCATION_LOGD("location_gps_finalize");
+ LOC_FUNC_LOG
LocationGpsPrivate *priv = GET_PRIVATE(gobject);
g_return_if_fail(priv);
case PROP_BOUNDARY: {
GList *boundary_list = g_list_copy(g_value_get_pointer(value));
ret = set_prop_boundary(&priv->boundary_list, boundary_list);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Set boundary. Error[%d]", ret);
+ LOC_IF_FAIL_LOG(ret, _E, "Set boundary. Error[%s]", err_msg(ret));
if (boundary_list) g_list_free(boundary_list);
break;
}
case PROP_REMOVAL_BOUNDARY: {
LocationBoundary *req_boundary = (LocationBoundary *) g_value_dup_boxed(value);
ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
- if (ret != 0) LOCATION_LOGD("Removal boundary. Error[%d]", ret);
+ LOC_IF_FAIL_LOG(ret, _E, "Removal boundary. Error[%s]", err_msg(ret));
break;
}
case PROP_POS_INTERVAL: {
g_return_if_fail(priv->mod->handler);
LocModGpsOps ops = priv->mod->ops;
switch (property_id) {
- case PROP_METHOD_TYPE:
- g_value_set_int(value, LOCATION_METHOD_GPS);
- break;
- case PROP_IS_STARTED:
- g_value_set_boolean(value, __get_started(object));
- break;
- case PROP_LAST_POSITION:
- g_value_set_boxed(value, priv->pos);
- break;
- case PROP_POS_INTERVAL:
- g_value_set_uint(value, priv->pos_interval);
- break;
- case PROP_VEL_INTERVAL:
- g_value_set_uint(value, priv->vel_interval);
- break;
- case PROP_SAT_INTERVAL:
- g_value_set_uint(value, priv->sat_interval);
- break;
- case PROP_LOC_INTERVAL:
- g_value_set_uint(value, priv->loc_interval);
- break;
- case PROP_BATCH_INTERVAL:
- g_value_set_uint(value, priv->batch_interval);
- break;
- case PROP_BATCH_PERIOD:
- g_value_set_uint(value, priv->batch_period);
- break;
- case PROP_MIN_INTERVAL:
- g_value_set_uint(value, priv->min_interval);
- break;
- case PROP_MIN_DISTANCE:
- g_value_set_double(value, priv->min_distance);
- break;
- case PROP_BOUNDARY:
- g_value_set_pointer(value, g_list_first(priv->boundary_list));
- break;
- case PROP_NMEA: {
- char *nmea_data = NULL;
- if (ops.get_nmea && LOCATION_ERROR_NONE == ops.get_nmea(priv->mod->handler, &nmea_data) && nmea_data) {
- LOCATION_SECLOG("Get prop>> Lastest nmea: \n%s", nmea_data);
- g_value_set_string(value, nmea_data);
- g_free(nmea_data);
- } else {
- LOCATION_LOGW("Get prop>> Lastest nmea: failed");
- g_value_set_string(value, NULL);
- }
- break;
- }
- case PROP_SATELLITE: {
- LocationSatellite *satellite = NULL;
- if (ops.get_satellite && priv->mod->handler && LOCATION_ERROR_NONE == ops.get_satellite(priv->mod->handler, &satellite) && satellite) {
- LOCATION_LOGD("Get prop>> Last sat: num_used(%d) num_view(%d)", satellite->num_of_sat_used, satellite->num_of_sat_inview);
- g_value_set_boxed(value, satellite);
- location_satellite_free(satellite);
- } else {
- LOCATION_LOGW("Get prop>> Last sat: failed");
- g_value_set_boxed(value, NULL);
- }
- break;
+ case PROP_METHOD_TYPE:
+ g_value_set_int(value, LOCATION_METHOD_GPS);
+ break;
+ case PROP_IS_STARTED:
+ g_value_set_boolean(value, __get_started(object));
+ break;
+ case PROP_LAST_POSITION:
+ g_value_set_boxed(value, priv->pos);
+ break;
+ case PROP_POS_INTERVAL:
+ g_value_set_uint(value, priv->pos_interval);
+ break;
+ case PROP_VEL_INTERVAL:
+ g_value_set_uint(value, priv->vel_interval);
+ break;
+ case PROP_SAT_INTERVAL:
+ g_value_set_uint(value, priv->sat_interval);
+ break;
+ case PROP_LOC_INTERVAL:
+ g_value_set_uint(value, priv->loc_interval);
+ break;
+ case PROP_BATCH_INTERVAL:
+ g_value_set_uint(value, priv->batch_interval);
+ break;
+ case PROP_BATCH_PERIOD:
+ g_value_set_uint(value, priv->batch_period);
+ break;
+ case PROP_MIN_INTERVAL:
+ g_value_set_uint(value, priv->min_interval);
+ break;
+ case PROP_MIN_DISTANCE:
+ g_value_set_double(value, priv->min_distance);
+ break;
+ case PROP_BOUNDARY:
+ g_value_set_pointer(value, g_list_first(priv->boundary_list));
+ break;
+ case PROP_NMEA: {
+ char *nmea_data = NULL;
+ if (ops.get_nmea && LOCATION_ERROR_NONE == ops.get_nmea(priv->mod->handler, &nmea_data) && nmea_data) {
+ LOCATION_SECLOG("Get prop>> Lastest nmea: \n%s", nmea_data);
+ g_value_set_string(value, nmea_data);
+ g_free(nmea_data);
+ } else {
+ LOCATION_LOGW("Get prop>> Lastest nmea: failed");
+ g_value_set_string(value, NULL);
}
- case PROP_SERVICE_STATUS:
- g_value_set_int(value, priv->enabled);
break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ }
+ case PROP_SATELLITE: {
+ LocationSatellite *satellite = NULL;
+ if (ops.get_satellite && priv->mod->handler && LOCATION_ERROR_NONE == ops.get_satellite(priv->mod->handler, &satellite) && satellite) {
+ LOCATION_LOGD("Get prop>> Last sat: num_used(%d) num_view(%d)", satellite->num_of_sat_used, satellite->num_of_sat_inview);
+ g_value_set_boxed(value, satellite);
+ location_satellite_free(satellite);
+ } else {
+ LOCATION_LOGW("Get prop>> Last sat: failed");
+ g_value_set_boxed(value, NULL);
+ }
break;
+ }
+ case PROP_SERVICE_STATUS:
+ g_value_set_int(value, priv->enabled);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
}
}
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
- if (__get_started(self) != TRUE) {
- LOCATION_LOGE("location is not started");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "Location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
if (priv->pos) {
*position = location_position_copy(priv->pos);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
- if (__get_started(self) != TRUE) {
- LOCATION_LOGE("location is not started");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "Location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
if (priv->pos && priv->vel) {
*position = location_position_copy(priv->pos);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
- if (__get_started(self) != TRUE) {
- LOCATION_LOGE("location is not started");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "Location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
if (priv->vel) {
*velocity = location_velocity_copy(priv->vel);
static gboolean __single_location_timeout_cb(void *data)
{
- LOCATION_LOGD("__single_location_timeout_cb");
+ LOC_FUNC_LOG
LocationGps *self = (LocationGps *)data;
LocationGpsPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, FALSE);
static void
gps_single_location_cb(gboolean enabled, LocationPosition *pos, LocationVelocity *vel, LocationAccuracy *acc, gpointer self)
{
- LOCATION_LOGD("gps_single_location_cb");
+ LOC_FUNC_LOG
g_return_if_fail(self);
g_return_if_fail(pos);
g_return_if_fail(vel);
static int
location_gps_request_single_location(LocationGps *self, int timeout)
{
- LOCATION_LOGD("location_gps_request_single_location");
+ LOC_FUNC_LOG
LocationGpsPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
__set_started(self, FALSE);
return ret;
} else {
- if (priv->loc_timeout != 0) {
+ if (priv->loc_timeout != 0)
g_source_remove(priv->loc_timeout);
- }
+
priv->loc_timeout = g_timeout_add_seconds(timeout, __single_location_timeout_cb, self);
}
setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
ret = priv->mod->ops.get_nmea(priv->mod->handler, nmea_data);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Failed to get_nmea. Error[%d]", ret);
- }
+ LOC_IF_FAIL_LOG(ret, _E, "Failed to get_nmea [%s]", err_msg(ret));
return ret;
}
setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
#ifndef TIZEN_DEVICE
- if (__get_started(self) != TRUE) {
- LOCATION_LOGE("location is not started");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "Location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
#endif
if (priv->batch) {
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
- if (__get_started(self) != TRUE) {
- LOCATION_LOGE("location is not started");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "Location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
if (priv->sat) {
*satellite = location_satellite_copy(priv->sat);
int ret = LOCATION_ERROR_NONE;
ret = priv->mod->ops.set_option(priv->mod->handler, option);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Failed to set_option. Error[%d]", ret);
- }
+ LOC_IF_FAIL_LOG(ret, _E, "Failed to set_option [%s]", err_msg(ret));
return ret;
}
static void location_gps_init(LocationGps *self)
{
- LOCATION_LOGD("location_gps_init");
+ LOC_FUNC_LOG
LocationGpsPrivate *priv = GET_PRIVATE(self);
g_return_if_fail(priv);
priv->mod = (LocationGpsMod *)module_new("gps");
- if (!priv->mod) LOCATION_LOGW("module loading failed");
+ LOC_COND_LOG(!priv->mod, _E, "Module loading failed");
g_mutex_init(&priv->mutex);
priv->is_started = FALSE;
#endif
priv->app_type = location_get_app_type(NULL);
- if (priv->app_type == 0) {
- LOCATION_LOGW("Fail to get app_type");
- }
+ LOC_COND_LOG(priv->app_type == 0, _W, "Fail to get app_type");
}
static void location_gps_class_init(LocationGpsClass *klass)
{
- LOCATION_LOGD("location_gps_class_init");
+ LOC_FUNC_LOG
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
gobject_class->set_property = location_gps_set_property;
{
g_return_val_if_fail(priv, FALSE);
- if (g_type == LOCATION_TYPE_GPS) {
+ if (g_type == LOCATION_TYPE_GPS)
priv->current_method = LOCATION_METHOD_GPS;
- } else if (g_type == LOCATION_TYPE_WPS) {
+ else if (g_type == LOCATION_TYPE_WPS)
priv->current_method = LOCATION_METHOD_WPS;
- } else if (g_type == LOCATION_TYPE_MOCK) {
- priv->current_method = LOCATION_METHOD_MOCK;
- } else if (g_type == LOCATION_TYPE_HYBRID) {
+ else if (g_type == LOCATION_TYPE_MOCK)
+ priv->current_method = LOCATION_METHOD_MOCK;
+ else if (g_type == LOCATION_TYPE_HYBRID)
priv->current_method = LOCATION_METHOD_HYBRID;
- } else
+ else
return FALSE;
return TRUE;
{
if (!priv->gps && !priv->wps & !priv->mock) return -1;
- if (priv->gps_enabled) {
+ if (priv->gps_enabled)
hybrid_set_current_method(priv, LOCATION_TYPE_GPS);
- } else if (priv->wps_enabled) {
+ else if (priv->wps_enabled)
hybrid_set_current_method(priv, LOCATION_TYPE_WPS);
- } else if (priv->mock_enabled) {
+ else if (priv->mock_enabled)
hybrid_set_current_method(priv, LOCATION_TYPE_MOCK);
- } else {
+ else
hybrid_set_current_method(priv, LOCATION_TYPE_HYBRID);
- }
return 0;
}
LocationVelocity *vel = NULL;
LocationAccuracy *acc = NULL;
- if (priv->pos) {
+ if (priv->pos)
pos = location_position_copy(priv->pos);
- } else {
+ else
pos = location_position_new(0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX);
- }
- if (priv->vel) {
+ if (priv->vel)
vel = location_velocity_copy(priv->vel);
- } else {
+ else
vel = location_velocity_new(0, 0.0, 0.0, 0.0);
- }
- if (priv->acc) {
+ if (priv->acc)
acc = location_accuracy_copy(priv->acc);
- } else {
+ else
acc = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
- }
g_signal_emit(object, signals[SERVICE_UPDATED], 0, priv->signal_type, pos, vel, acc);
priv->signal_type = 0;
static void
location_hybrid_gps_cb(keynode_t *key, gpointer self)
{
- LOCATION_LOGD("location_hybrid_gps_cb");
+ LOC_FUNC_LOG
g_return_if_fail(key);
g_return_if_fail(self);
LocationHybridPrivate *priv = GET_PRIVATE(self);
if (wps_started == FALSE && 1 == location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
LOCATION_LOGD("GPS stoped by setting, so restart WPS");
ret = location_start(priv->wps);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGW("Fail hyhrid/wps location_start : [%d]", ret);
- return;
- }
+ LOC_COND_VOID(ret != LOCATION_ERROR_NONE, _E, "Fail hybrid/wps location_start : [%s]", err_msg(ret));
}
} else if (1 == onoff) {
LOCATION_LOGD("Hybrid GPS resumed by setting");
static void
hybrid_service_updated(GObject *obj, gint type, gpointer data, gpointer velocity, gpointer accuracy, gpointer self)
{
- LOCATION_LOGD("hybrid_service_updated");
+ LOC_FUNC_LOG
LocationPosition *pos = NULL;
LocationVelocity *vel = NULL;
LocationAccuracy *acc = NULL;
if (priv->wps && wps_started == FALSE) {
LOCATION_LOGD("Starting WPS");
ret = location_start(priv->wps);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGW("Fail hyhrid location_start : [%d]", ret);
- return;
- }
+ LOC_COND_VOID(ret != LOCATION_ERROR_NONE, _E, "Fail hyhrid location_start : [%s]", err_msg(ret));
}
return;
}
if (acc) priv->acc = location_accuracy_copy(acc);
if (pos) {
- if (!priv->enabled) {
+ if (!priv->enabled)
enable_signaling(self, signals, &(priv->enabled), TRUE, pos->status);
- }
if (type == DISTANCE_UPDATED) {
distance_based_position_signaling(self, signals, priv->enabled, pos, vel, acc,
if (g_type == LOCATION_TYPE_GPS && wps_started == TRUE) {
LOCATION_LOGD("Calling WPS stop");
ret = location_stop(priv->wps);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGW("Fail hybrid location_stop : [%d]", ret);
- return;
- }
+ LOC_COND_VOID(ret != LOCATION_ERROR_NONE, _E, "Fail hyhrid location_stop : [%s]", err_msg(ret));
}
} else if (g_type == LOCATION_TYPE_WPS
if (acc) priv->acc = location_accuracy_copy(acc);
if (pos) {
- if (!priv->enabled) {
+ if (!priv->enabled)
enable_signaling(self, signals, &(priv->enabled), TRUE, pos->status);
- }
if (type == DISTANCE_UPDATED) {
distance_based_position_signaling(self, signals, priv->enabled, pos, vel, acc,
static void
hybrid_service_enabled(GObject *obj, guint status, gpointer self)
{
- LOCATION_LOGD("hybrid_service_enabled");
+ LOC_FUNC_LOG
LocationHybridPrivate *priv = GET_PRIVATE((LocationHybrid *)self);
g_return_if_fail(priv);
static void
hybrid_service_disabled(GObject *obj, guint status, gpointer self)
{
- LOCATION_LOGD("hybrid_service_disabled");
+ LOC_FUNC_LOG
LocationHybridPrivate *priv = GET_PRIVATE((LocationHybrid *)self);
g_return_if_fail(priv);
GType g_type = G_TYPE_FROM_INSTANCE(obj);
static int
location_hybrid_start(LocationHybrid *self)
{
- LOCATION_LOGD("location_hybrid_start");
+ LOC_FUNC_LOG
int ret_gps = LOCATION_ERROR_NONE;
int ret_wps = LOCATION_ERROR_NONE;
LocationHybridPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
- if (!priv->gps && !priv->wps) {
- LOCATION_LOGE("GPS and WPS Object are not created.");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_COND_RET(!priv->gps && !priv->wps, LOCATION_ERROR_NOT_AVAILABLE, _E, "GPS and WPS Object are not created.");
if (priv->gps) g_object_get(priv->gps, "is_started", &gps_started, NULL);
if (priv->wps) g_object_get(priv->wps, "is_started", &wps_started, NULL);
if (ret_gps != LOCATION_ERROR_NONE && ret_wps != LOCATION_ERROR_NONE && ret_mock != LOCATION_ERROR_NONE) {
LOCATION_LOGD("ret_gps = %d, ret_wps = %d, ret_mock = %d", ret_gps, ret_wps, ret_mock);
- if (ret_gps == LOCATION_ERROR_SECURITY_DENIED || ret_wps == LOCATION_ERROR_SECURITY_DENIED || ret_mock == LOCATION_ERROR_SECURITY_DENIED) {
+ if (ret_gps == LOCATION_ERROR_SECURITY_DENIED || ret_wps == LOCATION_ERROR_SECURITY_DENIED || ret_mock == LOCATION_ERROR_SECURITY_DENIED)
return LOCATION_ERROR_SECURITY_DENIED;
- } else if (ret_gps == LOCATION_ERROR_SETTING_OFF || ret_wps == LOCATION_ERROR_SETTING_OFF || ret_mock == LOCATION_ERROR_SETTING_OFF) {
+ else if (ret_gps == LOCATION_ERROR_SETTING_OFF || ret_wps == LOCATION_ERROR_SETTING_OFF || ret_mock == LOCATION_ERROR_SETTING_OFF)
return LOCATION_ERROR_SETTING_OFF;
- } else if (ret_gps == LOCATION_ERROR_NOT_ALLOWED || ret_wps == LOCATION_ERROR_NOT_ALLOWED || ret_mock == LOCATION_ERROR_NOT_ALLOWED) {
+ else if (ret_gps == LOCATION_ERROR_NOT_ALLOWED || ret_wps == LOCATION_ERROR_NOT_ALLOWED || ret_mock == LOCATION_ERROR_NOT_ALLOWED)
return LOCATION_ERROR_NOT_ALLOWED;
- } else {
+ else
return LOCATION_ERROR_NOT_AVAILABLE;
- }
}
if (priv->set_noti == FALSE) {
static int
location_hybrid_stop(LocationHybrid *self)
{
- LOCATION_LOGD("location_hybrid_stop");
+ LOC_FUNC_LOG
LocationHybridPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
if (priv->wps) g_object_get(priv->wps, "is_started", &wps_started, NULL);
if (priv->mock) g_object_get(priv->mock, "is_started", &mock_started, NULL);
- if ((gps_started == FALSE) && (wps_started == FALSE) && (mock_started == FALSE)) {
+ if ((gps_started == FALSE) && (wps_started == FALSE) && (mock_started == FALSE))
return LOCATION_ERROR_NONE;
- }
if (priv->gps) ret_gps = location_stop(priv->gps);
if (priv->wps) ret_wps = location_stop(priv->wps);
static void
location_hybrid_dispose(GObject *gobject)
{
- LOCATION_LOGD("location_hybrid_dispose");
+ LOC_FUNC_LOG
LocationHybridPrivate *priv = GET_PRIVATE(gobject);
g_return_if_fail(priv);
static void
location_hybrid_finalize(GObject *gobject)
{
- LOCATION_LOGD("location_hybrid_finalize");
+ LOC_FUNC_LOG
LocationHybridPrivate *priv = GET_PRIVATE(gobject);
g_return_if_fail(priv);
case PROP_BOUNDARY: {
GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value));
ret = set_prop_boundary(&priv->boundary_list, boundary_list);
- if (ret != 0) LOCATION_LOGD("Set boundary. Error[%d]", ret);
+ LOC_COND_VOID(ret != LOCATION_ERROR_NONE, _E, "Set boundary. Error[%s]", err_msg(ret));
break;
}
case PROP_REMOVAL_BOUNDARY: {
LocationBoundary *req_boundary = (LocationBoundary *) g_value_dup_boxed(value);
ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
- if (ret != 0) LOCATION_LOGD("Removal boundary. Error[%d]", ret);
+ LOC_COND_VOID(ret != LOCATION_ERROR_NONE, _E, "Removal boundary. Error[%s]", err_msg(ret));
break;
}
case PROP_POS_INTERVAL: {
{
LocationHybridPrivate *priv = GET_PRIVATE(object);
g_return_if_fail(priv);
- if (!priv->gps && !priv->wps) {
- LOCATION_LOGW("Get property is not available now");
- return;
- }
+
+ LOC_COND_VOID(!priv->gps && !priv->wps, _E, "Error : Get property is not available now");
LOCATION_LOGW("Get Propery ID[%d]", property_id);
static int
location_hybrid_get_position(LocationHybrid *self, LocationPosition **position, LocationAccuracy **accuracy)
{
+ LOC_FUNC_LOG
int ret = LOCATION_ERROR_NOT_AVAILABLE;
- LOCATION_LOGD("location_hybrid_get_position");
- if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+ if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED))
return LOCATION_ERROR_SETTING_OFF;
- }
LocationHybridPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
ret = LOCATION_ERROR_NONE;
}
- if (priv->acc) {
+ if (priv->acc)
*accuracy = location_accuracy_copy(priv->acc);
- }
return ret;
}
static int
location_hybrid_get_position_ext(LocationHybrid *self, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy)
{
- LOCATION_LOGD("location_hybrid_get_position_ext");
- if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+ LOC_FUNC_LOG
+ if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED))
return LOCATION_ERROR_SETTING_OFF;
- }
LocationHybridPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
return LOCATION_ERROR_NOT_AVAILABLE;
}
- if (priv->acc) {
+ if (priv->acc)
*accuracy = location_accuracy_copy(priv->acc);
- } else {
+ else
*accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
- }
return LOCATION_ERROR_NONE;
}
static int
location_hybrid_get_last_position(LocationHybrid *self, LocationPosition **position, LocationAccuracy **accuracy)
{
- LOCATION_LOGD("location_hybrid_get_last_position");
+ LOC_FUNC_LOG
int ret = LOCATION_ERROR_NONE;
LocationPosition *gps_pos = NULL, *wps_pos = NULL;
static int
location_hybrid_get_last_position_ext(LocationHybrid *self, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy)
{
- LOCATION_LOGD("location_hybrid_get_last_position_ext");
+ LOC_FUNC_LOG
int ret = LOCATION_ERROR_NONE;
LocationPosition *gps_pos = NULL, *wps_pos = NULL, *mock_pos = NULL;
static int
location_hybrid_get_velocity(LocationHybrid *self, LocationVelocity **velocity, LocationAccuracy **accuracy)
{
+ LOC_FUNC_LOG
int ret = LOCATION_ERROR_NOT_AVAILABLE;
- LOCATION_LOGD("location_hybrid_get_velocity");
- if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+ if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED))
return LOCATION_ERROR_SETTING_OFF;
- }
LocationHybridPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
ret = LOCATION_ERROR_NONE;
}
- if (priv->acc) {
+ if (priv->acc)
*accuracy = location_accuracy_copy(priv->acc);
- }
return ret;
}
static int
location_hybrid_get_last_velocity(LocationHybrid *self, LocationVelocity **velocity, LocationAccuracy **accuracy)
{
- LOCATION_LOGD("location_hybrid_get_last_velocity");
+ LOC_FUNC_LOG
int ret = LOCATION_ERROR_NONE;
LocationHybridPrivate *priv = GET_PRIVATE(self);
static int
location_hybrid_get_satellite(LocationHybrid *self, LocationSatellite **satellite)
{
+ LOC_FUNC_LOG
int ret = LOCATION_ERROR_NOT_AVAILABLE;
- LOCATION_LOGD("location_hybrid_get_satellite");
- if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+ if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED))
return LOCATION_ERROR_SETTING_OFF;
- }
LocationHybridPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
static int
location_hybrid_get_last_satellite(LocationHybrid *self, LocationSatellite **satellite)
{
- LOCATION_LOGD("location_hybrid_get_last_satellite");
+ LOC_FUNC_LOG
int ret = LOCATION_ERROR_NONE;
LocationHybridPrivate *priv = GET_PRIVATE(self);
static int
location_hybrid_set_option(LocationHybrid *self, const char *option)
{
- LOCATION_LOGD("location_hybrid_set_option");
+ LOC_FUNC_LOG
LocationHybridPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
static int
location_hybrid_request_single_location(LocationHybrid *self, int timeout)
{
- LOCATION_LOGD("location_hybrid_request_single_location");
+ LOC_FUNC_LOG
LocationHybridPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
int ret = LOCATION_ERROR_NOT_AVAILABLE;
- if (priv->gps) {
+ if (priv->gps)
ret = location_request_single_location(priv->gps, timeout);
- } else if (priv->wps) {
+ else if (priv->wps)
ret = location_request_single_location(priv->wps, timeout);
- } else if (priv->mock) {
+ else if (priv->mock)
ret = location_request_single_location(priv->mock, timeout);
- }
return ret;
}
static int
location_hybrid_get_nmea(LocationHybrid *self, char **nmea_data)
{
- LOCATION_LOGD("location_hybrid_get_nmea");
+ LOC_FUNC_LOG
LocationHybridPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
int ret = LOCATION_ERROR_NONE;
+ LOC_COND_RET(!priv->mock, LOCATION_ERROR_NOT_AVAILABLE, _E, "MOCK Object is not created [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
- if (!priv->mock) {
- LOCATION_LOGE("MOCK Object is not created.");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ if (priv->mock)
+ ret = location_set_mock_location(priv->mock, position, velocity, accuracy);
- if (priv->mock) ret = location_set_mock_location(priv->mock, position, velocity, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("ret = %d", ret);
+ LOC_IF_FAIL_LOG(ret, _E, "set_mock_location [%s]", err_msg(ret));
return ret;
}
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
int ret = LOCATION_ERROR_NONE;
+ LOC_COND_RET(!priv->mock, LOCATION_ERROR_NOT_AVAILABLE, _E, "MOCK Object is not created [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
- if (!priv->mock) {
- LOCATION_LOGE("MOCK Object is not created.");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ if (priv->mock)
+ ret = location_clear_mock_location(priv->mock);
- if (priv->mock) ret = location_clear_mock_location(priv->mock);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("ret = %d", ret);
+ LOC_IF_FAIL_LOG(ret, _E, "clear_mock_location [%s]", err_msg(ret));
return ret;
}
static void
location_hybrid_init(LocationHybrid *self)
{
- LOCATION_LOGD("location_hybrid_init");
+ LOC_FUNC_LOG
LocationHybridPrivate *priv = GET_PRIVATE(self);
g_return_if_fail(priv);
static void
location_hybrid_class_init(LocationHybridClass *klass)
{
- LOCATION_LOGD("location_hybrid_class_init");
+ LOC_FUNC_LOG
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
gobject_class->set_property = location_hybrid_set_property;
static void
__reset_pos_data_from_priv(LocationMockPrivate *priv)
{
- LOCATION_LOGD("__reset_pos_data_from_priv");
+ LOC_FUNC_LOG
g_return_if_fail(priv);
if (priv->pos) {
static void
mock_status_cb(gboolean enabled, LocationStatus status, gpointer self)
{
- LOCATION_LOGD("mock_status_cb");
+ LOC_FUNC_LOG
g_return_if_fail(self);
LocationMockPrivate *priv = GET_PRIVATE(self);
g_return_if_fail(priv);
static void
location_setting_mock_cb(keynode_t *key, gpointer self)
{
- LOCATION_LOGD("location_setting_mock_cb");
+ LOC_FUNC_LOG
g_return_if_fail(key);
g_return_if_fail(self);
LocationMockPrivate *priv = GET_PRIVATE(self);
if (priv->mod->ops.stop && __get_started(self)) {
__set_started(self, FALSE);
ret = priv->mod->ops.stop(priv->mod->handler);
- if (ret == LOCATION_ERROR_NONE) {
+ if (ret == LOCATION_ERROR_NONE)
__reset_pos_data_from_priv(priv);
- }
}
} else {
if (location_setting_get_int(VCONFKEY_LOCATION_MOCK_ENABLED) == 1 && priv->mod->ops.start && !__get_started(self)) {
static int
location_mock_start(LocationMock *self)
{
- LOCATION_LOGD("ENTER >>>");
+ LOC_FUNC_LOG
LocationMockPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
static int
location_mock_stop(LocationMock *self)
{
- LOCATION_LOGD("location_mock_stop");
+ LOC_FUNC_LOG
LocationMockPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
if (__get_started(self) == TRUE) {
__set_started(self, FALSE);
ret = priv->mod->ops.stop(priv->mod->handler);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGD("Failed to stop. Error[%d]", ret);
- }
+ LOC_IF_FAIL_LOG(ret, _E, "Failed to stop [%s]", err_msg(ret));
}
if (priv->app_type != CPPAPP && priv->set_noti == TRUE) {
static void
location_mock_dispose(GObject *gobject)
{
- LOCATION_LOGD("location_mock_dispose");
-
+ LOC_FUNC_LOG
LocationMockPrivate *priv = GET_PRIVATE(gobject);
g_return_if_fail(priv);
static void
location_mock_finalize(GObject *gobject)
{
- LOCATION_LOGD("location_mock_finalize");
+ LOC_FUNC_LOG
LocationMockPrivate *priv = GET_PRIVATE(gobject);
g_return_if_fail(priv);
module_free(priv->mod, "mock");
case PROP_BOUNDARY: {
GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value));
ret = set_prop_boundary(&priv->boundary_list, boundary_list);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Set boundary. Error[%d]", ret);
+ LOC_IF_FAIL_LOG(ret, _E, "Set boundary. Error[%s]", err_msg(ret));
if (boundary_list) g_list_free(boundary_list);
break;
}
case PROP_REMOVAL_BOUNDARY: {
LocationBoundary *req_boundary = (LocationBoundary *) g_value_dup_boxed(value);
ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
- if (ret != 0) LOCATION_LOGD("Set removal boundary. Error[%d]", ret);
+ LOC_IF_FAIL_LOG(ret, _E, "Set removal boundary. Error[%s]", err_msg(ret));
break;
}
case PROP_POS_INTERVAL: {
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_MOCK_ENABLED);
- if (__get_started(self) != TRUE) {
- LOCATION_LOGE("location is not started");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
if (priv->pos) {
*position = location_position_copy(priv->pos);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_MOCK_ENABLED);
- if (__get_started(self) != TRUE) {
- LOCATION_LOGE("location is not started");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
if (priv->pos && priv->vel) {
*position = location_position_copy(priv->pos);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_MOCK_ENABLED);
- if (__get_started(self) != TRUE) {
- LOCATION_LOGE("location is not started");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
if (priv->vel) {
*velocity = location_velocity_copy(priv->vel);
static gboolean
__single_location_timeout_cb(void *data)
{
- LOCATION_LOGD("__single_location_timeout_cb");
+ LOC_FUNC_LOG
LocationMock *self = (LocationMock *)data;
LocationMockPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, FALSE);
static void
mock_single_location_cb(gboolean enabled, LocationPosition *pos, LocationVelocity *vel, LocationAccuracy *acc, gpointer self)
{
- LOCATION_LOGD("mock_single_location_cb");
+ LOC_FUNC_LOG
g_return_if_fail(self);
g_return_if_fail(pos);
g_return_if_fail(vel);
static int
location_mock_request_single_location(LocationMock *self, int timeout)
{
- LOCATION_LOGD("location_mock_request_single_location");
+ LOC_FUNC_LOG
LocationMockPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
__set_started(self, FALSE);
return ret;
} else {
- if (priv->loc_timeout != 0) {
+ if (priv->loc_timeout != 0)
g_source_remove(priv->loc_timeout);
- }
+
priv->loc_timeout = g_timeout_add_seconds(timeout, __single_location_timeout_cb, self);
}
int ret = LOCATION_ERROR_NONE;
ret = priv->mod->ops.set_option(priv->mod->handler, option);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Failed to set_option. Error[%d]", ret);
- }
+ LOC_IF_FAIL_LOG(ret, _E, "Failed to set_option. Error[%d]", ret);
return ret;
}
static int
location_mock_set_mock_location(LocationMock *self, LocationPosition *position, LocationVelocity *velocity, LocationAccuracy *accuracy)
{
+ LOC_FUNC_LOG
LocationMockPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod->ops.set_mock_location, LOCATION_ERROR_NOT_AVAILABLE);
- LOCATION_LOGD("ENTER >>>");
-
int ret = LOCATION_ERROR_NONE;
if (!location_setting_get_int(VCONFKEY_LOCATION_MOCK_ENABLED)) {
ret = LOCATION_ERROR_SETTING_OFF;
} else {
ret = priv->mod->ops.set_mock_location(priv->mod->handler, position, velocity, accuracy, __set_mock_location_cb, self);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Failed to set_mock_location. Error[%d]", ret);
- }
+ LOC_IF_FAIL_LOG(ret, _E, "Failed to set_mock_location [%s]", err_msg(ret));
}
return ret;
static int
location_mock_clear_mock_location(LocationMock *self)
{
+ LOC_FUNC_LOG
LocationMockPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod->ops.set_mock_location, LOCATION_ERROR_NOT_AVAILABLE);
- LOCATION_LOGD("ENTER >>>");
-
int ret = LOCATION_ERROR_NONE;
if (!location_setting_get_int(VCONFKEY_LOCATION_MOCK_ENABLED)) {
ret = LOCATION_ERROR_SETTING_OFF;
} else {
ret = priv->mod->ops.clear_mock_location(priv->mod->handler, __set_mock_location_cb, self);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Failed to set_mock_location. Error[%d]", ret);
- }
+ LOC_IF_FAIL_LOG(ret, _E, "Failed to clear_mock_location [%s]", err_msg(ret));
}
return ret;
static void
location_mock_init(LocationMock *self)
{
- LOCATION_LOGD("location_mock_init");
+ LOC_FUNC_LOG
LocationMockPrivate *priv = GET_PRIVATE(self);
g_return_if_fail(priv);
priv->mod = (LocationMockMod *)module_new("mock");
- if (!priv->mod) LOCATION_LOGW("module loading failed");
+ LOC_COND_LOG(!priv->mod, _E, "Module loading failed");
g_mutex_init(&priv->mutex);
priv->is_started = FALSE;
priv->loc_timeout = 0;
priv->app_type = location_get_app_type(NULL);
- if (priv->app_type == 0) {
- LOCATION_LOGW("Fail to get app_type");
- }
+ LOC_COND_LOG(priv->app_type == 0, _E, "Fail to get app_type");
}
static void
location_mock_class_init(LocationMockClass *klass)
{
- LOCATION_LOGD("location_mock_class_init");
+ LOC_FUNC_LOG
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
}
EXPORT_API LocationPosition *
-location_position_new(guint timestamp,
- gdouble latitude,
- gdouble longitude,
- gdouble altitude,
- LocationStatus status)
+location_position_new(guint timestamp, gdouble latitude, gdouble longitude, gdouble altitude, LocationStatus status)
{
if (latitude < -90 || latitude > 90) return NULL;
if (longitude < -180 || longitude > 180) return NULL;
LocationPosition *new_position = NULL;
- new_position = location_position_new(position->timestamp,
- position->latitude,
- position->longitude,
- position->altitude,
- position->status);
+ new_position = location_position_new(position->timestamp, position->latitude, position->longitude, position->altitude, position->status);
return new_position;
*lat = atoi(latitude);
*lon = atoi(longitude);
- if (*d_lat == 'S') {
+ if (*d_lat == 'S')
*lat = *lat * -1;
- }
- if (*d_lon == 'W') {
+
+ if (*d_lon == 'W')
*lon = *lon * -1;
- }
}
char *session = NULL;
char smack_label[100] = {0, };
- if (cynara_initialize(&cynara, NULL) != CYNARA_API_SUCCESS)
- {
+ if (cynara_initialize(&cynara, NULL) != CYNARA_API_SUCCESS) {
LOCATION_LOGE("cynara initialize failed");
cynara = NULL;
return LOCATION_ERROR_NOT_ALLOWED;
snprintf(uid, 16, "%d", getuid());
ret = cynara_check(cynara, smack_label, session, uid, privilege_name);
- if (session) {
+ if (session)
free(session);
- }
- if (cynara) {
+ if (cynara)
cynara_finish(cynara);
- }
- if (ret != CYNARA_API_ACCESS_ALLOWED) {
- LOCATION_LOGE("cynara_check failed [%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_COND_RET(ret != CYNARA_API_ACCESS_ALLOWED, LOCATION_ERROR_NOT_ALLOWED, _E, "Cynara_check failed [%s]", err_msg(LOCATION_ERROR_NOT_ALLOWED));
return LOCATION_ERROR_NONE;
}
{
static volatile gsize type_volatile = 0;
if (g_once_init_enter(&type_volatile)) {
- GType type = g_boxed_type_register_static(
- g_intern_static_string("LocationSatellite"),
- (GBoxedCopyFunc) location_satellite_copy,
- (GBoxedFreeFunc) location_satellite_free);
+ GType type = g_boxed_type_register_static(g_intern_static_string("LocationSatellite"),
+ (GBoxedCopyFunc) location_satellite_copy, (GBoxedFreeFunc) location_satellite_free);
g_once_init_leave(&type_volatile, type);
}
return type_volatile;
if (satellite->num_of_sat_inview > 0 && satellite->sat_inview) {
int i = 0;
for (i = 0 ; i < satellite->num_of_sat_inview ; i++)
- if (satellite->sat_inview[i].used)(satellite->num_of_sat_used)++;
+ if (satellite->sat_inview[i].used) (satellite->num_of_sat_used)++;
}
}
EXPORT_API gboolean
location_satellite_get_satellite_details(const LocationSatellite *satellite,
- guint index,
- guint *prn,
- gboolean *used,
- guint *elevation,
- guint *azimuth,
- gint *snr)
+ guint index, guint *prn, gboolean *used, guint *elevation, guint *azimuth, gint *snr)
{
g_return_val_if_fail(satellite, FALSE);
g_return_val_if_fail(prn, FALSE);
EXPORT_API gboolean
location_satellite_set_satellite_details(LocationSatellite *satellite,
- guint index,
- guint prn,
- gboolean used,
- guint elevation,
- guint azimuth,
- gint snr)
+ guint index, guint prn, gboolean used, guint elevation, guint azimuth, gint snr)
{
g_return_val_if_fail(satellite, FALSE);
g_return_val_if_fail(satellite->sat_inview, FALSE);
{
g_return_val_if_fail(path, 0);
int val = 0;
- if (vconf_get_int(path, &val)) {
+ if (vconf_get_int(path, &val))
LOCATION_SECLOG("failed [%s]", path);
- }
+
return val;
}
{
g_return_val_if_fail(path, FALSE);
gboolean val = FALSE;
- if (vconf_get_bool(path, &val)) {
+ if (vconf_get_bool(path, &val))
LOCATION_SECLOG("failed [%s]", path);
- }
+
return val;
}
static char *__convert_event_from_vconf(const char *vconf)
{
char *event = NULL;
- if (g_strcmp0(vconf, VCONFKEY_LOCATION_USE_MY_LOCATION) == 0) {
+ if (g_strcmp0(vconf, VCONFKEY_LOCATION_USE_MY_LOCATION) == 0)
event = g_strdup(SYS_EVENT_LOCATION_ENABLE_STATE);
- } else if (g_strcmp0(vconf, VCONFKEY_LOCATION_ENABLED) == 0) {
+ else if (g_strcmp0(vconf, VCONFKEY_LOCATION_ENABLED) == 0)
event = g_strdup(SYS_EVENT_GPS_ENABLE_STATE);
- } else if (g_strcmp0(vconf, VCONFKEY_LOCATION_NETWORK_ENABLED) == 0) {
+ else if (g_strcmp0(vconf, VCONFKEY_LOCATION_NETWORK_ENABLED) == 0)
event = g_strdup(SYS_EVENT_NPS_ENABLE_STATE);
- }
return event;
}
{
const char *value = NULL;
- if (g_strcmp0(event_name, SYS_EVENT_LOCATION_ENABLE_STATE) == 0) {
+ if (g_strcmp0(event_name, SYS_EVENT_LOCATION_ENABLE_STATE) == 0)
value = bundle_get_val(data, EVT_KEY_LOCATION_ENABLE_STATE);
- } else if (g_strcmp0(event_name, SYS_EVENT_GPS_ENABLE_STATE) == 0) {
+ else if (g_strcmp0(event_name, SYS_EVENT_GPS_ENABLE_STATE) == 0)
value = bundle_get_val(data, EVT_KEY_GPS_ENABLE_STATE);
- } else if (g_strcmp0(event_name, SYS_EVENT_NPS_ENABLE_STATE) == 0) {
+ else if (g_strcmp0(event_name, SYS_EVENT_NPS_ENABLE_STATE) == 0)
value = bundle_get_val(data, EVT_KEY_NPS_ENABLE_STATE);
- }
LOCATION_SECLOG("[%s: %s]", event_name, value);
}
#define setting_retval_if_fail(path) {\
int val = location_setting_get_int(path);\
- if (val == -1){\
+ if (val == -1) {\
return LOCATION_ERROR_UNKNOWN;\
} else if (val == 0) {\
return LOCATION_ERROR_SETTING_OFF;\
- }\
+ } \
}
/* For test
}
}
- if (signal_type != 0) {
+ if (signal_type != 0)
g_signal_emit(obj, signals[SERVICE_UPDATED], 0, signal_type, pos, vel, acc);
- }
if (boundary_list) {
while ((priv = (LocationBoundaryPrivate *)g_list_nth_data(boundary_list, index)) != NULL) {
{
static volatile gsize type_volatile = 0;
if (g_once_init_enter(&type_volatile)) {
- GType type = g_boxed_type_register_static(
- g_intern_static_string("LocationVelocity"),
- (GBoxedCopyFunc) location_velocity_copy,
- (GBoxedFreeFunc) location_velocity_free);
+ GType type = g_boxed_type_register_static(g_intern_static_string("LocationVelocity"),
+ (GBoxedCopyFunc) location_velocity_copy, (GBoxedFreeFunc) location_velocity_free);
+
g_once_init_leave(&type_volatile, type);
}
return type_volatile;
location_velocity_copy(const LocationVelocity *velocity)
{
g_return_val_if_fail(velocity, NULL);
-
LocationVelocity *new_velocity = NULL;
-
new_velocity = location_velocity_new(velocity->timestamp, velocity->speed, velocity->direction, velocity->climb);
return new_velocity;
static void
__reset_pos_data_from_priv(LocationWpsPrivate *priv)
{
- LOCATION_LOGD("__reset_pos_data_from_priv");
+ LOC_FUNC_LOG
g_return_if_fail(priv);
if (priv->pos) {
static void
location_setting_wps_cb(keynode_t *key, gpointer self)
{
- LOCATION_LOGD("location_setting_wps_cb");
+ LOC_FUNC_LOG
g_return_if_fail(key);
g_return_if_fail(self);
LocationWpsPrivate *priv = GET_PRIVATE(self);
if (priv->mod->ops.stop && __get_started(self)) {
__set_started(self, FALSE);
ret = priv->mod->ops.stop(priv->mod->handler);
- if (ret == LOCATION_ERROR_NONE) {
+ if (ret == LOCATION_ERROR_NONE)
__reset_pos_data_from_priv(priv);
- }
}
} else {
if (1 == location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED) && priv->mod->ops.start && !__get_started(self)) {
static int
location_wps_start(LocationWps *self)
{
- LOCATION_LOGD("location_wps_start");
+ LOC_FUNC_LOG
LocationWpsPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
static int
location_wps_stop(LocationWps *self)
{
- LOCATION_LOGD("location_wps_stop");
+ LOC_FUNC_LOG
LocationWpsPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
if (__get_started(self) == TRUE) {
__set_started(self, FALSE);
ret = priv->mod->ops.stop(priv->mod->handler);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGD("Failed to stop. Error[%d]", ret);
- }
+ LOC_IF_FAIL_LOG(ret, _E, "Failed to stop [%s]", err_msg(ret));
}
if (priv->app_type != CPPAPP && priv->set_noti == TRUE) {
static void
location_wps_dispose(GObject *gobject)
{
- LOCATION_LOGD("location_wps_dispose");
-
+ LOC_FUNC_LOG
LocationWpsPrivate *priv = GET_PRIVATE(gobject);
g_return_if_fail(priv);
static void
location_wps_finalize(GObject *gobject)
{
- LOCATION_LOGD("location_wps_finalize");
+ LOC_FUNC_LOG
LocationWpsPrivate *priv = GET_PRIVATE(gobject);
g_return_if_fail(priv);
module_free(priv->mod, "wps");
case PROP_BOUNDARY: {
GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value));
ret = set_prop_boundary(&priv->boundary_list, boundary_list);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Set boundary. Error[%d]", ret);
+ LOC_IF_FAIL_LOG(ret, _E, "Set boundary [%s]", err_msg(ret));
if (boundary_list) g_list_free(boundary_list);
break;
}
case PROP_REMOVAL_BOUNDARY: {
LocationBoundary *req_boundary = (LocationBoundary *) g_value_dup_boxed(value);
ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
- if (ret != 0) LOCATION_LOGD("Set removal boundary. Error[%d]", ret);
+ LOC_IF_FAIL_LOG(ret, _E, "Set removal boundary [%s]", err_msg(ret));
break;
}
case PROP_POS_INTERVAL: {
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_NETWORK_ENABLED);
- if (__get_started(self) != TRUE) {
- LOCATION_LOGE("location is not started");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
if (priv->pos && priv->vel) {
*position = location_position_copy(priv->pos);
location_wps_get_velocity(LocationWps *self, LocationVelocity **velocity, LocationAccuracy **accuracy)
{
int ret = LOCATION_ERROR_NOT_AVAILABLE;
-
LocationWpsPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_NETWORK_ENABLED);
- if (__get_started(self) != TRUE) {
- LOCATION_LOGE("location is not started");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
+ LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
if (priv->vel) {
*velocity = location_velocity_copy(priv->vel);
static gboolean __single_location_timeout_cb(void *data)
{
- LOCATION_LOGD("__single_location_timeout_cb");
+ LOC_FUNC_LOG
LocationWps *self = (LocationWps *)data;
LocationWpsPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, FALSE);
static void
wps_single_location_cb(gboolean enabled, LocationPosition *pos, LocationVelocity *vel, LocationAccuracy *acc, gpointer self)
{
- LOCATION_LOGD("wps_single_location_cb");
+ LOC_FUNC_LOG
g_return_if_fail(self);
g_return_if_fail(pos);
g_return_if_fail(vel);
static int
location_wps_request_single_location(LocationWps *self, int timeout)
{
- LOCATION_LOGD("location_wps_request_single_location");
+ LOC_FUNC_LOG
LocationWpsPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
__set_started(self, FALSE);
return ret;
} else {
- if (priv->loc_timeout != 0) {
+ if (priv->loc_timeout != 0)
g_source_remove(priv->loc_timeout);
- }
+
priv->loc_timeout = g_timeout_add_seconds(timeout, __single_location_timeout_cb, self);
}
static void
location_wps_init(LocationWps *self)
{
- LOCATION_LOGD("location_wps_init");
+ LOC_FUNC_LOG
LocationWpsPrivate *priv = GET_PRIVATE(self);
g_return_if_fail(priv);
priv->loc_timeout = 0;
priv->app_type = location_get_app_type(NULL);
- if (priv->app_type == 0) {
+ if (priv->app_type == 0)
LOCATION_LOGW("Fail to get app_type");
- }
}
static void
location_wps_class_init(LocationWpsClass *klass)
{
- LOCATION_LOGD("location_wps_class_init");
+ LOC_FUNC_LOG
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
gobject_class->set_property = location_wps_set_property;
static LocationMethod __convert_method_from_key(const char *key)
{
LocationMethod _method = LOCATION_METHOD_NONE;
- if (g_strcmp0(key, VCONFKEY_LOCATION_USE_MY_LOCATION) == 0) {
+ if (g_strcmp0(key, VCONFKEY_LOCATION_USE_MY_LOCATION) == 0)
_method = LOCATION_METHOD_HYBRID;
- } else if (g_strcmp0(key, VCONFKEY_LOCATION_ENABLED) == 0) {
+ else if (g_strcmp0(key, VCONFKEY_LOCATION_ENABLED) == 0)
_method = LOCATION_METHOD_GPS;
- } else if (g_strcmp0(key, VCONFKEY_LOCATION_NETWORK_ENABLED) == 0) {
+ else if (g_strcmp0(key, VCONFKEY_LOCATION_NETWORK_ENABLED) == 0)
_method = LOCATION_METHOD_WPS;
- } else if (g_strcmp0(key, VCONFKEY_LOCATION_MOCK_ENABLED) == 0) {
+ else if (g_strcmp0(key, VCONFKEY_LOCATION_MOCK_ENABLED) == 0)
_method = LOCATION_METHOD_MOCK;
- }
return _method;
}
static void __location_setting_cb(keynode_t *key, gpointer data)
{
- if (key == NULL || data == NULL) {
+ if (key == NULL || data == NULL)
return;
- }
+
LocationSetting *_setting = (LocationSetting *)data;
LocationMethod _method = LOCATION_METHOD_NONE;
break;
}
- if (!self) LOCATION_LOGE("Fail to create location object. Method [%d]", method);
+ LOC_COND_LOG(!self, _E, "Fail to create location object. [method=%d]", method);
return self;
}
int ret = LOCATION_ERROR_NONE;
ret = location_ielement_request_single_location(LOCATION_IELEMENT(obj), timeout);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to request single location. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to request single location [%s]", err_msg(ret));
return ret;
}
int ret = LOCATION_ERROR_NONE;
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
ret = location_ielement_start(LOCATION_IELEMENT(obj));
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to start. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to start [%s]", err_msg(ret));
return ret;
}
location_stop(LocationObject *obj)
{
g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
- int ret = LOCATION_ERROR_NONE;
+ int ret = LOCATION_ERROR_NONE;
ret = location_ielement_stop(LOCATION_IELEMENT(obj));
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to stop. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to stop [%s]", err_msg(ret));
return ret;
}
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
ret = location_ielement_start_batch(LOCATION_IELEMENT(obj));
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to Batch start. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to start_batch [%s]", err_msg(ret));
return ret;
}
g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
int ret = LOCATION_ERROR_NONE;
ret = location_ielement_stop_batch(LOCATION_IELEMENT(obj));
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to Batch stop. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to stop_batch [%d]", err_msg(ret));
return ret;
}
int vconf_ret = VCONF_ERROR;
char *_key = __convert_setting_key(method);
- if (!_key) {
- LOCATION_LOGE("Invalid method[%d]", method);
- return LOCATION_ERROR_NOT_SUPPORTED;
- }
+ LOC_COND_RET(!_key, LOCATION_ERROR_NOT_SUPPORTED, _E, "Invalid method = %d [%s]", method, err_msg(LOCATION_ERROR_NOT_SUPPORTED));
vconf_ret = vconf_get_int(_key, &vconf_val);
if (vconf_ret != VCONF_OK) {
- LOCATION_SECLOG("failed [%s], error [%d]", _key, vconf_ret);
+ LOCATION_SECLOG("vconf_get failed [%s], error [%d]", _key, vconf_ret);
g_free(_key);
return LOCATION_ERROR_NOT_AVAILABLE;
} else {
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_ENABLE_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
/* for itself */
_key = __convert_setting_key(method);
- if (!_key) {
- LOCATION_LOGE("Invalid method[%d]", method);
- return LOCATION_ERROR_NOT_SUPPORTED;
- }
+ LOC_COND_RET(!_key, LOCATION_ERROR_NOT_SUPPORTED, _E, "Invalid method = %d [%s]", method, err_msg(LOCATION_ERROR_NOT_SUPPORTED));
+
ret = vconf_set_int(_key, enable);
if (ret != VCONF_OK) {
LOCATION_SECLOG("vconf_set_int failed [%s], ret=[%d]", _key, ret);
/* for hybrid */
_key = __convert_setting_key(LOCATION_METHOD_HYBRID);
- if (!_key) {
- LOCATION_LOGE("Invalid method[%d]", LOCATION_METHOD_HYBRID);
- return LOCATION_ERROR_NOT_SUPPORTED;
- }
+ LOC_COND_RET(!_key, LOCATION_ERROR_NOT_SUPPORTED, _E, "Invalid method = %d [%s]", LOCATION_METHOD_HYBRID, err_msg(LOCATION_ERROR_NOT_SUPPORTED));
if (enable) {
ret = vconf_set_int(_key, enable);
{
int ret = LOCATION_ERROR_NONE;
char *_key = __convert_setting_key(method);
- if (!_key) {
- LOCATION_LOGE("Invalid method[%d]", method);
- return LOCATION_ERROR_PARAMETER;
- }
+ LOC_COND_RET(!_key, LOCATION_ERROR_PARAMETER, _E, "Invalid method = %d [%s]", method, err_msg(LOCATION_ERROR_PARAMETER));
g_location_setting.callback = callback;
g_location_setting.user_data = user_data;
{
int ret = LOCATION_ERROR_NONE;
char *_key = __convert_setting_key(method);
- if (!_key) {
- LOCATION_LOGE("Invalid method[%d]", method);
- return LOCATION_ERROR_PARAMETER;
- }
+ LOC_COND_RET(!_key, LOCATION_ERROR_PARAMETER, _E, "Invalid method = %d [%s]", method, err_msg(LOCATION_ERROR_PARAMETER));
g_location_setting.callback = NULL;
g_location_setting.user_data = NULL;
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
ret = location_ielement_get_position(LOCATION_IELEMENT(obj), position, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_position. Error [%d]", ret);
+ LOC_COND_RET(ret != LOCATION_ERROR_NONE, ret, _E, "Fail to get_position [%s]", err_msg(ret));
return ret;
}
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
ret = location_ielement_get_position_ext(LOCATION_IELEMENT(obj), position, velocity, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_position_ext. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to get_position_ext [%s]", err_msg(ret));
return ret;
}
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
ret = location_ielement_get_last_position(LOCATION_IELEMENT(obj), position, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_position. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to get_last_position [%s]", err_msg(ret));
return ret;
}
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
ret = location_ielement_get_last_position_ext(LOCATION_IELEMENT(obj), position, velocity, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_position_ext. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to get_last_position_ext [%s]", err_msg(ret));
return ret;
}
int ret = LOCATION_ERROR_NONE;
ret = location_ielement_get_nmea(LOCATION_IELEMENT(obj), nmea);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Fail to get_nmea. Error [%d]", ret);
- }
+ LOC_IF_FAIL(ret, _E, "Fail to get_nmea [%s]", err_msg(ret));
return ret;
}
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
ret = location_ielement_get_satellite(LOCATION_IELEMENT(obj), satellite);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Fail to get_satellite. Error [%d]", ret);
- }
+ LOC_IF_FAIL(ret, _E, "Fail to get_satellite [%s]", err_msg(ret));
return ret;
}
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
ret = location_ielement_get_batch(LOCATION_IELEMENT(obj), batch);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_batch. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to get_batch [%s]", err_msg(ret));
return ret;
}
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
ret = location_ielement_get_last_satellite(LOCATION_IELEMENT(obj), satellite);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_satellite. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to get_last_satellite [%s]", err_msg(ret));
return ret;
}
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
ret = location_ielement_get_velocity(LOCATION_IELEMENT(obj), velocity, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_velocity. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to get_velocity [%s]", err_msg(ret));
return ret;
}
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
ret = location_ielement_get_last_velocity(LOCATION_IELEMENT(obj), velocity, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_velocity. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to get_last_velocity [%s]", err_msg(ret));
return ret;
}
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
ret = location_ielement_set_option(LOCATION_IELEMENT(obj), option);
- if (ret != LOCATION_ERROR_NONE)
- LOCATION_LOGE("Fail to get_velocity. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to get_velocity [%s]", err_msg(ret));
return ret;
}
int ret = LOCATION_ERROR_NONE;
ret = location_ielement_get_status(LOCATION_IELEMENT(obj), state);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_position. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to get_position [%s]", err_msg(ret));
return ret;
}
int ret = 0;
char *_key = NULL;
- if (method != LOCATION_METHOD_MOCK) {
- return LOCATION_ERROR_PARAMETER;
- }
+ LOC_COND_RET(method != LOCATION_METHOD_MOCK, LOCATION_ERROR_PARAMETER, _E, "Method is not mock [%s]", err_msg(LOCATION_ERROR_PARAMETER));
#ifndef TIZEN_PROFILE_TV
ret = location_check_cynara(LOCATION_PRIVILEGE);
- if (ret != LOCATION_ERROR_NONE) {
- LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
#endif
#if 0 /* Tizen platform didn't turn developer option on */
gboolean developer_option = FALSE;
ret = vconf_get_bool(VCONFKEY_SETAPPL_DEVELOPER_OPTION_STATE, &developer_option);
- if (!developer_option) {
- LOCATION_LOGE("Cannot enable mock location because developer option is not turned on", ret);
- return LOCATION_ERROR_NOT_ALLOWED;
- }
+ LOC_COND_RET(!developer_option, LOCATION_ERROR_NOT_ALLOWED, _E, "Cannot enable mock location because developer option is not turned on", ret);
#endif
_key = __convert_setting_key(method);
- if (!_key) {
- LOCATION_LOGE("Invalid method[%d]", method);
- return LOCATION_ERROR_NOT_SUPPORTED;
- }
+ LOC_COND_RET(!_key, LOCATION_ERROR_NOT_SUPPORTED, _E, "Invalid method = %d [%s]", method, err_msg(LOCATION_ERROR_NOT_SUPPORTED));
+
ret = vconf_set_int(_key, enable);
if (ret != VCONF_OK) {
LOCATION_SECLOG("vconf_set_int failed [%s], ret=[%d]", _key, ret);
int vconf_val = 0;
_key = __convert_setting_key(method);
- if (!_key) {
- LOCATION_LOGE("Invalid method[%d]", method);
- return LOCATION_ERROR_NOT_SUPPORTED;
- }
+ LOC_COND_RET(!_key, LOCATION_ERROR_NOT_SUPPORTED, _E, "Invalid method = %d [%s]", method, err_msg(LOCATION_ERROR_NOT_SUPPORTED));
ret = vconf_get_int(_key, &vconf_val);
if (ret != VCONF_OK) {
if (vconf_val) {
_key = __convert_mock_setting_key(method);
- if (!_key) {
- LOCATION_LOGE("Invalid method[%d]", method);
- return LOCATION_ERROR_NOT_SUPPORTED;
- }
+ LOC_COND_RET(!_key, LOCATION_ERROR_NOT_SUPPORTED, _E, "Invalid method[%d]", method);
ret = vconf_set_int(_key, enable);
if (ret != VCONF_OK) {
LOCATION_SECLOG("vconf_set_int failed [%s], ret=[%d]", _key, ret);
int ret = LOCATION_ERROR_NONE;
ret = location_ielement_set_mock_location(LOCATION_IELEMENT(obj), position, velocity, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to location_ielement_set_mock_location. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to set_mock_location [%s]", err_msg(ret));
return ret;
}
int ret = LOCATION_ERROR_NONE;
ret = location_ielement_clear_mock_location(LOCATION_IELEMENT(obj));
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to location_ielement_set_mock_location. Error [%d]", ret);
+ LOC_IF_FAIL(ret, _E, "Fail to clear_mock_location [%s]", err_msg(ret));
return ret;
-}
\ No newline at end of file
+}
if (0 == g_strcmp0(module_name, "gps")) {
LocationGpsMod *_mod = (LocationGpsMod *) mod;
- if (_mod->shutdown && _mod->handler) {
+ if (_mod->shutdown && _mod->handler)
_mod->shutdown(_mod->handler);
- }
+
_mod->handler = NULL;
_mod->init = NULL;
_mod->shutdown = NULL;
_mod->gmod = NULL;
} else if (0 == g_strcmp0(module_name, "wps")) {
LocationWpsMod *_mod = (LocationWpsMod *) mod;
- if (_mod->shutdown && _mod->handler) {
+ if (_mod->shutdown && _mod->handler)
_mod->shutdown(_mod->handler);
- }
+
_mod->handler = NULL;
_mod->init = NULL;
_mod->shutdown = NULL;
_mod->gmod = NULL;
} else if (0 == g_strcmp0(module_name, "mock")) {
LocationMockMod *_mod = (LocationMockMod *) mod;
- if (_mod->shutdown && _mod->handler) {
+ if (_mod->shutdown && _mod->handler)
_mod->shutdown(_mod->handler);
- }
+
_mod->handler = NULL;
_mod->init = NULL;
_mod->shutdown = NULL;
{
GMod *gmod = NULL;
gmod = gmod_new(module_name, FALSE);
- if (!gmod) {
+ if (!gmod)
return FALSE;
- }
+
gmod_free(gmod);
return TRUE;
char name[256] = { 0, };
for (index = -1; index < MAX_MODULE_INDEX; index++) {
- if (index >= 0) {
+ if (index >= 0)
g_snprintf(name, 256, "%s%d", module_name, index);
- } else {
+ else
g_snprintf(name, 256, "%s", module_name);
- }
ret = mod_is_supported(name);
if (ret == TRUE) {
+[Version] libslp-location_1.2.1
+[Date] 9 May 2016
+[Changes] Change tag style for error log
+[Developer] Kyoungjun Sung <kj7.sung@samsung.com>
+
+================================================================================
+
[Version] libslp-location_1.2.0
[Date] 15 Apr 2016
[Changes] Support HW batch mode when sensor API is available
Name: liblbs-location
Summary: Location Based Service Library
-Version: 1.2.0
+Version: 1.2.1
Release: 1
Group: Location/Libraries
License: Apache-2.0