GypsyAccuracy

GypsyAccuracy — Object for obtaining accuracy information from gypsy-daemon

Synopsis




                    GypsyAccuracy;
#define             GYPSY_ACCURACY_DBUS_SERVICE
#define             GYPSY_ACCURACY_DBUS_INTERFACE
enum                GypsyAccuracyFields;
GypsyAccuracy*      gypsy_accuracy_new                  (const char *object_path);
GypsyAccuracyFields gypsy_accuracy_get_accuracy         (GypsyAccuracy *accuracy,
                                                         double *pdop,
                                                         double *hdop,
                                                         double *vdop,
                                                         GError **error);

Object Hierarchy


  GObject
   +----GypsyAccuracy

Properties


  "object-path"              gchararray            : Write / Construct Only

Signals


  "accuracy-changed"                               : Run First / No Recursion

Description

GypsyAccuracy is used whenever the client program wishes to know about GPS accuracy changes. It can report the current accuracy, and has a signal to notify listeners to changes. The accuracy consists of positional accuracy, horizontal accuracy (on the latitude/longitude plane) and vertical (altitudinal) accuracy.

A GypsyAccuracy object is created using gypsy_accuracy_new() using the D-Bus path of the GPS device. This path is returned from the gypsy_control_create() function. The client can then find out about the course with gypsy_accuracy_get_accuracy().

As the accuracy information changes GypsyAccuracy will emit the accuracy-changed signal. This signal contains the accuracy information if gypsy-daemon knows it. It has a fields paramater which is a bitmask of GypsyAccuracyFields which indicates which of the position, horizontal or vertical contains valid information.

GypsyAccuracy *accuracy;
GError *error = NULL;

. . .

/ * path comes from the gypsy_control_create() function * /
accuracy = gypsy_accuracy_new (path);
g_signal_connect (accuracy, "accuracy-changed", G_CALLBACK (accuracy_changed), NULL);

. . .

static void 
accuracy_changed (GypsyAccuracy *accuracy, 
GypsyAccuracyFields fields,
double position,
double horizontal,
double vertical,
gpointer userdata)
{
  g_print ("horizontal: %f\n", (fields & GYPSY_ACCURACY_FIELDS_HORIZONTAL) ? horizontal : -1.0);
}

Details

GypsyAccuracy

typedef struct _GypsyAccuracy GypsyAccuracy;

There are no public fields in GypsyAccuracy.


GYPSY_ACCURACY_DBUS_SERVICE

#define GYPSY_ACCURACY_DBUS_SERVICE "org.freedesktop.Gypsy"

A define containing the address of the Accuracy service


GYPSY_ACCURACY_DBUS_INTERFACE

#define GYPSY_ACCURACY_DBUS_INTERFACE "org.freedesktop.Gypsy.Accuracy"

A define containing the name of the Accuracy interface


enum GypsyAccuracyFields

typedef enum {
	GYPSY_ACCURACY_FIELDS_NONE = 0,
	GYPSY_ACCURACY_FIELDS_POSITION = 1 << 0,
	GYPSY_ACCURACY_FIELDS_HORIZONTAL = 1 << 1,
	GYPSY_ACCURACY_FIELDS_VERTICAL = 1 << 2,
} GypsyAccuracyFields;

A bitmask telling which fields in the accuracy_changed callback are valid

GYPSY_ACCURACY_FIELDS_NONE None of the fields are valid
GYPSY_ACCURACY_FIELDS_POSITION The Position (3D) DOP field is valid
GYPSY_ACCURACY_FIELDS_HORIZONTAL The Horizonal (2D) DOP field is valid
GYPSY_ACCURACY_FIELDS_VERTICAL The Vertical (altitude) DOP field is valid

gypsy_accuracy_new ()

GypsyAccuracy*      gypsy_accuracy_new                  (const char *object_path);

Creates a new GypsyAccuracy object that listens for accuracy changes from the GPS found at object_path.

object_path : Object path to the GPS device
Returns : A GypsyAccuracy object

gypsy_accuracy_get_accuracy ()

GypsyAccuracyFields gypsy_accuracy_get_accuracy         (GypsyAccuracy *accuracy,
                                                         double *pdop,
                                                         double *hdop,
                                                         double *vdop,
                                                         GError **error);

Obtains the current accuracy, if known, from the GPS device. pdop, hdop and vdop can be NULL if the result is not required.

accuracy : A GypsyAccuracy
pdop : Pointer to store the position DOP
hdop : Pointer to store the horizonal DOP
vdop : Pointer to store the vertical DOP
error : Pointer to store a GError
Returns : Bitmask of GypsyAccuracyFields indicating what fields were set

Property Details

The "object-path" property

  "object-path"              gchararray            : Write / Construct Only

The path of the Gypsy GPS object

Default value: ""

Signal Details

The "accuracy-changed" signal

void                user_function                      (GypsyAccuracy *fields,
                                                        gint           pdop,
                                                        gdouble        hdop,
                                                        gdouble        vdop,
                                                        gdouble        arg4,
                                                        gpointer       user_data)      : Run First / No Recursion

The ::accuracy-changed signal is emitted when the GPS device indicates that one or more of the accuracy fields has changed. The fields which have changed will be indicated in the fields bitmask.

fields : A bitmask of GypsyAccuracyFields indicating which of the following fields are valid
pdop : The new position DOP
hdop : The new horizonal DOP
vdop : The new vertical DOP
user_data : user data set when the signal handler was connected.