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;