4 * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
7 * Genie Kim <daejins.kim@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
26 #include "location-setting.h"
27 #include "location-log.h"
29 #include "module-internal.h"
31 #include "location-passive.h"
32 #include "location-marshal.h"
33 #include "location-ielement.h"
34 #include "location-signaling-util.h"
35 #include "location-common-util.h"
36 #include "location-privacy.h"
38 #include <vconf-internal-location-keys.h>
44 typedef struct _LocationPassivePrivate {
45 LocationPassiveMod *mod;
51 guint pos_updated_timestamp;
53 guint vel_updated_timestamp;
55 guint loc_updated_timestamp;
58 guint dist_updated_timestamp;
61 LocationPosition *pos;
62 LocationVelocity *vel;
63 LocationAccuracy *acc;
65 } LocationPassivePrivate;
76 PROP_REMOVAL_BOUNDARY,
83 static guint32 signals[LAST_SIGNAL] = {0, };
84 static GParamSpec *properties[PROP_MAX] = {NULL, };
86 #define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), LOCATION_TYPE_PASSIVE, LocationPassivePrivate))
88 static void location_ielement_interface_init(LocationIElementInterface *iface);
90 G_DEFINE_TYPE_WITH_CODE(LocationPassive, location_passive, G_TYPE_OBJECT,
91 G_IMPLEMENT_INTERFACE(LOCATION_TYPE_IELEMENT, location_ielement_interface_init));
93 static void __reset_pos_data_from_priv(LocationPassivePrivate *priv)
96 g_return_if_fail(priv);
99 location_position_free(priv->pos);
103 location_velocity_free(priv->vel);
107 location_accuracy_free(priv->acc);
110 priv->pos_updated_timestamp = 0;
111 priv->vel_updated_timestamp = 0;
114 static gboolean __get_started(gpointer self)
116 LocationPassivePrivate *priv = GET_PRIVATE(self);
117 g_return_val_if_fail(priv, FALSE);
119 return priv->is_started;
122 static int __set_started(gpointer self, gboolean started)
124 LocationPassivePrivate *priv = GET_PRIVATE(self);
125 g_return_val_if_fail(priv, -1);
127 if (priv->is_started != started) {
128 g_mutex_lock(&priv->mutex);
129 priv->is_started = started;
130 g_mutex_unlock(&priv->mutex);
136 static void passive_gps_cb(keynode_t * key, gpointer self)
139 g_return_if_fail(key);
140 g_return_if_fail(self);
141 LocationPassivePrivate *priv = GET_PRIVATE(self);
142 g_return_if_fail(priv);
143 g_return_if_fail(priv->mod);
144 g_return_if_fail(priv->mod->handler);
146 LocationPosition *pos = NULL;
147 LocationVelocity *vel = NULL;
148 LocationAccuracy *acc = NULL;
150 LocModPassiveOps ops = priv->mod->ops;
151 int ret = ops.get_last_position(priv->mod->handler, &pos, &vel, &acc);
152 if (ret != LOCATION_ERROR_NONE) {
153 LOCATION_LOGE("Fail to get position[%d]", ret);
157 location_signaling(self, signals, TRUE, priv->boundary_list,
158 pos, vel, acc, priv->pos_interval, priv->vel_interval, priv->loc_interval,
159 &(priv->enabled), &(priv->pos_updated_timestamp),
160 &(priv->vel_updated_timestamp), &(priv->loc_updated_timestamp),
161 &(priv->pos), &(priv->vel), &(priv->acc));
164 static void passive_wps_cb(keynode_t *key, gpointer self)
167 g_return_if_fail(key);
168 g_return_if_fail(self);
169 LocationPassivePrivate *priv = GET_PRIVATE(self);
170 g_return_if_fail(priv);
171 g_return_if_fail(priv->mod);
172 g_return_if_fail(priv->mod->handler);
174 LocationPosition *pos = NULL;
175 LocationVelocity *vel = NULL;
176 LocationAccuracy *acc = NULL;
178 LocModPassiveOps ops = priv->mod->ops;
179 int ret = ops.get_last_wps_position(priv->mod->handler, &pos, &vel, &acc);
180 if (ret != LOCATION_ERROR_NONE) {
181 LOCATION_LOGE("Fail to get position[%d]", ret);
185 if (location_setting_get_int(VCONFKEY_LOCATION_GPS_STATE) == VCONFKEY_LOCATION_GPS_CONNECTED)
188 location_signaling(self, signals, TRUE, priv->boundary_list,
189 pos, vel, acc, priv->pos_interval, priv->vel_interval, priv->loc_interval,
190 &(priv->enabled), &(priv->pos_updated_timestamp),
191 &(priv->vel_updated_timestamp), &(priv->loc_updated_timestamp),
192 &(priv->pos), &(priv->vel), &(priv->acc));
195 static int location_passive_start(LocationPassive *self)
198 LocationPassivePrivate *priv = GET_PRIVATE(self);
199 g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
200 g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
201 g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
203 LOC_COND_RET(__get_started(self) == TRUE, LOCATION_ERROR_NONE, _E, "__get_started. Error[%s]", err_msg(LOCATION_ERROR_NONE));
205 int ret = LOCATION_ERROR_NONE;
207 if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED)) {
208 ret = LOCATION_ERROR_SETTING_OFF;
210 __set_started(self, TRUE);
212 ret = location_setting_add_notify(VCONFKEY_LOCATION_LAST_GPS_TIMESTAMP, passive_gps_cb, self);
213 LOC_COND_RET(ret != LOCATION_ERROR_NONE, ret, _E, "Add vconf notify. Error[%s]", err_msg(ret));
215 ret = location_setting_add_notify(VCONFKEY_LOCATION_LAST_WPS_TIMESTAMP, passive_wps_cb, self);
216 LOC_COND_RET(ret != LOCATION_ERROR_NONE, ret, _E, "Add vconf notify. Error[%s]", err_msg(ret));
219 if (priv->app_type != CPPAPP && priv->set_noti == FALSE)
220 priv->set_noti = TRUE;
225 static int location_passive_stop(LocationPassive *self)
228 LocationPassivePrivate *priv = GET_PRIVATE(self);
229 g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
230 g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
231 g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
233 int ret = LOCATION_ERROR_NONE;
235 if (__get_started(self) == TRUE) {
236 __set_started(self, FALSE);
237 g_signal_emit(self, signals[SERVICE_DISABLED], 0, LOCATION_STATUS_NO_FIX);
240 if (priv->app_type != CPPAPP && priv->set_noti == TRUE)
241 priv->set_noti = FALSE;
243 __reset_pos_data_from_priv(priv);
248 static void location_passive_dispose(GObject *gobject)
251 LocationPassivePrivate *priv = GET_PRIVATE(gobject);
252 g_return_if_fail(priv);
254 g_mutex_clear(&priv->mutex);
256 if (priv->app_type != CPPAPP && priv->set_noti == TRUE)
257 priv->set_noti = FALSE;
259 G_OBJECT_CLASS(location_passive_parent_class)->dispose(gobject);
262 static void location_passive_finalize(GObject *gobject)
265 LocationPassivePrivate *priv = GET_PRIVATE(gobject);
266 g_return_if_fail(priv);
268 if (priv->boundary_list) {
269 g_list_free_full(priv->boundary_list, free_boundary_list);
270 priv->boundary_list = NULL;
274 location_position_free(priv->pos);
279 location_velocity_free(priv->vel);
284 location_accuracy_free(priv->acc);
287 G_OBJECT_CLASS(location_passive_parent_class)->finalize(gobject);
290 static void location_passive_set_property(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
292 LocationPassivePrivate *priv = GET_PRIVATE(object);
293 g_return_if_fail(priv);
296 switch (property_id) {
297 case PROP_BOUNDARY: {
298 GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value));
299 ret = set_prop_boundary(&priv->boundary_list, boundary_list);
300 if (ret != LOCATION_ERROR_NONE)
301 LOCATION_LOGE("Set boundary. Error[%d]", ret);
303 g_list_free(boundary_list);
306 case PROP_REMOVAL_BOUNDARY: {
307 LocationBoundary *req_boundary = (LocationBoundary *) g_value_dup_boxed(value);
308 ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
309 if (ret != 0) LOCATION_LOGD("Set removal boundary. Error[%d]", ret);
312 case PROP_POS_INTERVAL: {
313 guint interval = g_value_get_uint(value);
315 if (interval < LOCATION_UPDATE_INTERVAL_MAX)
316 priv->pos_interval = interval;
318 priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
320 priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
325 case PROP_VEL_INTERVAL: {
326 guint interval = g_value_get_uint(value);
328 if (interval < LOCATION_UPDATE_INTERVAL_MAX)
329 priv->vel_interval = interval;
331 priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
333 priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
337 case PROP_LOC_INTERVAL: {
338 guint interval = g_value_get_uint(value);
339 LOCATION_LOGD("Set prop>> PROP_LOC_INTERVAL: %u", interval);
341 if (interval < LOCATION_UPDATE_INTERVAL_MAX)
342 priv->loc_interval = interval;
344 priv->loc_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
346 priv->loc_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
351 case PROP_MIN_INTERVAL: {
352 guint interval = g_value_get_uint(value);
353 LOCATION_LOGD("Set prop>> update-min-interval: %u", interval);
355 if (interval < LOCATION_MIN_INTERVAL_MAX)
356 priv->min_interval = interval;
358 priv->min_interval = (guint)LOCATION_MIN_INTERVAL_MAX;
360 priv->min_interval = (guint)LOCATION_MIN_INTERVAL_DEFAULT;
365 case PROP_MIN_DISTANCE: {
366 gdouble distance = g_value_get_double(value);
367 LOCATION_LOGD("Set prop>> update-min-distance: %u", distance);
369 if (distance < LOCATION_MIN_DISTANCE_MAX)
370 priv->min_distance = distance;
372 priv->min_distance = (gdouble)LOCATION_MIN_DISTANCE_MAX;
374 priv->min_distance = (gdouble)LOCATION_MIN_DISTANCE_DEFAULT;
379 case PROP_SERVICE_STATUS: {
380 gint enabled = g_value_get_int(value);
381 LOCATION_LOGD("Set prop>> PROP_SERVICE_STATUS: %u", enabled);
382 priv->enabled = enabled;
386 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
391 static void location_passive_get_property(GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
393 LocationPassivePrivate *priv = GET_PRIVATE(object);
394 g_return_if_fail(priv);
396 switch (property_id) {
397 case PROP_METHOD_TYPE:
398 g_value_set_int(value, LOCATION_METHOD_PASSIVE);
400 case PROP_IS_STARTED:
401 g_value_set_boolean(value, __get_started(object));
403 case PROP_LAST_POSITION:
404 g_value_set_boxed(value, priv->pos);
407 g_value_set_pointer(value, g_list_first(priv->boundary_list));
409 case PROP_POS_INTERVAL:
410 g_value_set_uint(value, priv->pos_interval);
412 case PROP_VEL_INTERVAL:
413 g_value_set_uint(value, priv->vel_interval);
415 case PROP_LOC_INTERVAL:
416 g_value_set_uint(value, priv->loc_interval);
418 case PROP_MIN_INTERVAL:
419 g_value_set_uint(value, priv->min_interval);
421 case PROP_MIN_DISTANCE:
422 g_value_set_double(value, priv->min_distance);
424 case PROP_SERVICE_STATUS:
425 g_value_set_int(value, priv->enabled);
428 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
433 static int location_passive_get_position(LocationPassive *self, LocationPosition **position, LocationAccuracy **accuracy)
435 int ret = LOCATION_ERROR_NOT_AVAILABLE;
437 LocationPassivePrivate *priv = GET_PRIVATE(self);
438 g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
439 g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
440 setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
442 if (__get_started(self) != TRUE) {
443 LOCATION_LOGE("location is not started");
444 return LOCATION_ERROR_NOT_AVAILABLE;
448 *position = location_position_copy(priv->pos);
449 if (priv->acc) *accuracy = location_accuracy_copy(priv->acc);
450 else *accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
451 ret = LOCATION_ERROR_NONE;
457 static int location_passive_get_position_ext(LocationPassive *self, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy)
459 int ret = LOCATION_ERROR_NOT_AVAILABLE;
461 LocationPassivePrivate *priv = GET_PRIVATE(self);
462 g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
463 g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
464 setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
466 if (__get_started(self) != TRUE) {
467 LOCATION_LOGE("location is not started");
468 return LOCATION_ERROR_NOT_AVAILABLE;
471 if (priv->pos && priv->vel) {
472 *position = location_position_copy(priv->pos);
473 *velocity = location_velocity_copy(priv->vel);
474 if (priv->acc) *accuracy = location_accuracy_copy(priv->acc);
475 else *accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
476 ret = LOCATION_ERROR_NONE;
483 static int location_passive_get_last_position(LocationPassive *self, LocationPosition **position, LocationAccuracy **accuracy)
485 LocationPassivePrivate *priv = GET_PRIVATE(self);
486 g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
487 g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
488 setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
490 int ret = LOCATION_ERROR_NONE;
491 LocationVelocity *_velocity = NULL;
493 LocModPassiveOps ops = priv->mod->ops;
494 g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
495 g_return_val_if_fail(ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
497 ret = ops.get_last_position(priv->mod->handler, position, &_velocity, accuracy);
498 if (_velocity) location_velocity_free(_velocity);
503 static int location_passive_get_last_position_ext(LocationPassive *self, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy)
505 LocationPassivePrivate *priv = GET_PRIVATE(self);
506 g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
507 g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
508 setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
510 LocModPassiveOps ops = priv->mod->ops;
511 g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
512 g_return_val_if_fail(ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
514 return ops.get_last_position(priv->mod->handler, position, velocity, accuracy);
517 static int location_passive_get_velocity(LocationPassive *self, LocationVelocity **velocity, LocationAccuracy **accuracy)
519 int ret = LOCATION_ERROR_NOT_AVAILABLE;
521 LocationPassivePrivate *priv = GET_PRIVATE(self);
522 g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
523 g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
524 setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
526 if (__get_started(self) != TRUE) {
527 LOCATION_LOGE("location is not started");
528 return LOCATION_ERROR_NOT_AVAILABLE;
532 *velocity = location_velocity_copy(priv->vel);
533 if (priv->acc) *accuracy = location_accuracy_copy(priv->acc);
534 else *accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
535 ret = LOCATION_ERROR_NONE;
541 static int location_passive_get_last_velocity(LocationPassive *self, LocationVelocity **velocity, LocationAccuracy **accuracy)
543 LocationPassivePrivate *priv = GET_PRIVATE(self);
544 g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
545 g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
546 setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
548 int ret = LOCATION_ERROR_NONE;
549 LocationPosition *_position = NULL;
551 LocModPassiveOps ops = priv->mod->ops;
552 g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
553 ret = ops.get_last_position(priv->mod->handler, &_position, velocity, accuracy);
554 if (!_position) location_position_free(_position);
559 static int location_passive_request_single_location(LocationPassive *self, int timeout)
561 return LOCATION_ERROR_NOT_SUPPORTED;
564 static int location_passive_get_satellite(LocationPassive *self, LocationSatellite **satellite)
566 return LOCATION_ERROR_NOT_SUPPORTED;
569 static int location_passive_get_last_satellite(LocationPassive *self, LocationSatellite **satellite)
571 return LOCATION_ERROR_NOT_SUPPORTED;
574 static int location_passive_set_option(LocationPassive *self, const char *option)
576 LocationPassivePrivate *priv = GET_PRIVATE(self);
577 g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
579 return LOCATION_ERROR_NONE;
582 static int location_passive_get_nmea(LocationPassive *self, char **nmea_data)
584 return LOCATION_ERROR_NOT_SUPPORTED;
587 static void location_ielement_interface_init(LocationIElementInterface *iface)
589 iface->start = (TYPE_START_FUNC)location_passive_start;
590 iface->stop = (TYPE_STOP_FUNC)location_passive_stop;
591 iface->get_position = (TYPE_GET_POSITION)location_passive_get_position;
592 iface->get_position_ext = (TYPE_GET_POSITION_EXT)location_passive_get_position_ext;
593 iface->get_last_position = (TYPE_GET_POSITION)location_passive_get_last_position;
594 iface->get_last_position_ext = (TYPE_GET_POSITION_EXT)location_passive_get_last_position_ext;
595 iface->get_velocity = (TYPE_GET_VELOCITY)location_passive_get_velocity;
596 iface->get_last_velocity = (TYPE_GET_VELOCITY)location_passive_get_last_velocity;
597 iface->get_satellite = (TYPE_GET_SATELLITE)location_passive_get_satellite;
598 iface->get_last_satellite = (TYPE_GET_SATELLITE)location_passive_get_last_satellite;
599 iface->set_option = (TYPE_SET_OPTION)location_passive_set_option;
600 iface->request_single_location = (TYPE_REQUEST_SINGLE_LOCATION)location_passive_request_single_location;
601 iface->get_nmea = (TYPE_GET_NMEA)location_passive_get_nmea;
604 static void location_passive_init(LocationPassive *self)
607 LocationPassivePrivate *priv = GET_PRIVATE(self);
608 g_return_if_fail(priv);
610 priv->mod = (LocationPassiveMod *)module_new("passive");
611 if (!priv->mod) LOCATION_LOGW("module loading failed");
613 g_mutex_init(&priv->mutex);
614 priv->is_started = FALSE;
615 priv->set_noti = FALSE;
616 priv->enabled = FALSE;
618 priv->pos_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
619 priv->vel_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
620 priv->loc_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
621 priv->min_interval = LOCATION_UPDATE_INTERVAL_NONE;
623 priv->pos_updated_timestamp = 0;
624 priv->vel_updated_timestamp = 0;
625 priv->loc_updated_timestamp = 0;
630 priv->boundary_list = NULL;
632 priv->loc_timeout = 0;
634 priv->app_type = location_get_app_type(NULL);
635 if (priv->app_type == 0)
636 LOCATION_LOGW("Fail to get app_type");
639 static void location_passive_class_init(LocationPassiveClass *klass)
642 GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
644 gobject_class->set_property = location_passive_set_property;
645 gobject_class->get_property = location_passive_get_property;
647 gobject_class->dispose = location_passive_dispose;
648 gobject_class->finalize = location_passive_finalize;
650 g_type_class_add_private(klass, sizeof(LocationPassivePrivate));
652 signals[SERVICE_ENABLED] =
653 g_signal_new("service-enabled", G_TYPE_FROM_CLASS(klass),
654 G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
655 G_STRUCT_OFFSET(LocationPassiveClass, enabled),
656 NULL, NULL, location_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
658 signals[SERVICE_DISABLED] =
659 g_signal_new("service-disabled", G_TYPE_FROM_CLASS(klass),
660 G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
661 G_STRUCT_OFFSET(LocationPassiveClass, disabled),
662 NULL, NULL, location_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
664 #if 0 /* TODO: STATUS_CHANGED will aggregate SERVICE_ENABLED and SERVICE_DISABLED */
665 signals[STATUS_CHANGED] =
666 g_signal_new("status-changed", G_TYPE_FROM_CLASS(klass),
667 G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
668 G_STRUCT_OFFSET(LocationPassiveClass, status_changed),
669 NULL, NULL, location_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
672 signals[SERVICE_UPDATED] =
673 g_signal_new("service-updated", G_TYPE_FROM_CLASS(klass),
674 G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
675 G_STRUCT_OFFSET(LocationPassiveClass, service_updated),
676 NULL, NULL, location_VOID__INT_POINTER_POINTER_POINTER, G_TYPE_NONE, 4,
677 G_TYPE_INT, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);
679 signals[LOCATION_UPDATED] =
680 g_signal_new("location-updated", G_TYPE_FROM_CLASS(klass),
681 G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
682 G_STRUCT_OFFSET(LocationPassiveClass, location_updated),
683 NULL, NULL, location_VOID__INT_POINTER_POINTER_POINTER,
684 G_TYPE_NONE, 4, G_TYPE_INT, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);
687 g_signal_new("zone-in", G_TYPE_FROM_CLASS(klass),
688 G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
689 G_STRUCT_OFFSET(LocationPassiveClass, zone_in),
690 NULL, NULL, location_VOID__POINTER_POINTER_POINTER,
691 G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);
694 g_signal_new("zone-out", G_TYPE_FROM_CLASS(klass),
695 G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
696 G_STRUCT_OFFSET(LocationPassiveClass, zone_out),
697 NULL, NULL, location_VOID__POINTER_POINTER_POINTER,
698 G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);
700 properties[PROP_METHOD_TYPE] =
701 g_param_spec_int("method", "method type", "location method type name",
702 LOCATION_METHOD_PASSIVE, LOCATION_METHOD_PASSIVE, LOCATION_METHOD_PASSIVE, G_PARAM_READABLE);
704 properties[PROP_IS_STARTED] =
705 g_param_spec_boolean("is_started", "passive is started prop",
706 "passive is started status", FALSE, G_PARAM_READWRITE);
708 properties[PROP_LAST_POSITION] =
709 g_param_spec_boxed("last-position", "passive last position prop",
710 "passive last position data", LOCATION_TYPE_POSITION, G_PARAM_READABLE);
712 properties[PROP_POS_INTERVAL] =
713 g_param_spec_uint("pos-interval", "passive position interval prop",
714 "passive position interval data", LOCATION_UPDATE_INTERVAL_MIN,
715 LOCATION_UPDATE_INTERVAL_MAX, LOCATION_UPDATE_INTERVAL_DEFAULT, G_PARAM_READWRITE);
717 properties[PROP_VEL_INTERVAL] =
718 g_param_spec_uint("vel-interval", "passive velocity interval prop",
719 "passive velocity interval data", LOCATION_UPDATE_INTERVAL_MIN,
720 LOCATION_UPDATE_INTERVAL_MAX, LOCATION_UPDATE_INTERVAL_DEFAULT, G_PARAM_READWRITE);
722 properties[PROP_LOC_INTERVAL] =
723 g_param_spec_uint("loc-interval", "passive location interval prop",
724 "passive location interval data", LOCATION_UPDATE_INTERVAL_MIN,
725 LOCATION_UPDATE_INTERVAL_MAX, LOCATION_UPDATE_INTERVAL_DEFAULT, G_PARAM_READWRITE);
727 properties[PROP_MIN_INTERVAL] =
728 g_param_spec_uint("min-interval", "passive distance-based interval prop",
729 "passive distance-based interval data", LOCATION_MIN_INTERVAL_MIN,
730 LOCATION_MIN_INTERVAL_MAX, LOCATION_MIN_INTERVAL_DEFAULT, G_PARAM_READWRITE);
732 properties[PROP_MIN_DISTANCE] =
733 g_param_spec_double("min-distance", "passive distance-based distance prop",
734 "passive distance-based distance data", LOCATION_MIN_DISTANCE_MIN,
735 LOCATION_MIN_DISTANCE_MAX, LOCATION_MIN_DISTANCE_DEFAULT, G_PARAM_READWRITE);
737 properties[PROP_BOUNDARY] =
738 g_param_spec_pointer("boundary", "passive boundary prop",
739 "passive boundary data", G_PARAM_READWRITE);
741 properties[PROP_REMOVAL_BOUNDARY] =
742 g_param_spec_boxed("removal-boundary", "passive removal boundary prop",
743 "passive removal boundary data", LOCATION_TYPE_BOUNDARY, G_PARAM_READWRITE);
746 properties[PROP_SERVICE_STATUS] =
747 g_param_spec_int("service-status", "location service status prop",
748 "location service status data", LOCATION_STATUS_NO_FIX,
749 LOCATION_STATUS_3D_FIX, LOCATION_STATUS_NO_FIX, G_PARAM_READABLE);
751 g_object_class_install_properties(gobject_class, PROP_MAX, properties);